Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java
41161 views
/*1* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.share.jpda;2425import nsk.share.*;2627/**28* This class implements communicational channel between29* debugger and debugee used for synchronization and data exchange.30* This channel is based on TCP/IP sockets and works in all31* modes (local, remote and manual). In a remote mode32* connection to <code>BindServer</code> is used for redirecting IOPipe messages.33* In all other modes direct TCP/IP coonnection between two VMs is used.34*35* @see BindServer36*/37public class IOPipe extends SocketIOPipe {3839public static final byte PORTS_COUNT = 10;40public static final byte NO_PORTS = 0;4142public static final String PIPE_LOG_PREFIX = "IOPipe> ";4344private DebugeeProcess debugee;4546/**47* Make <code>IOPipe</code> at debugee's side.48*49* @deprecated Use DebugeeArgumentHandler.createDebugeeIOPipe(Log) instead.50*51* @see DebugeeArgumentHandler#createDebugeeIOPipe(Log)52*/53@Deprecated54public IOPipe(DebugeeArgumentHandler argumentHandler, Log log) {55this(log, getTestHost(argumentHandler), argumentHandler.getPipePortNumber(),56(long)argumentHandler.getWaitTime() * 60 * 1000, false);57}5859/**60* Make <code>IOPipe</code> at debugger's side61* with given <code>Debugee</code> mirror.62*63* @deprecated Use Debugee.createIOPipe() instead.64*/65@Deprecated66public IOPipe(DebugeeProcess debugee) {67this(debugee.getLog(),68debugee.getArgumentHandler().getDebugeeHost(),69debugee.getArgumentHandler().getPipePortNumber(),70(long)debugee.getArgumentHandler().getWaitTime() * 60 * 1000,71true);7273this.debugee = debugee;74}7576/**77* Make general <code>IOPipe</code> object with specified parameters.78*/79protected IOPipe(Log log, String host, int port, long timeout, boolean listening) {80super("IOPipe", log, PIPE_LOG_PREFIX, host, port, timeout, listening);81}8283protected void connect() {84if (listening) {85setServerSocket(debugee.getPipeServerSocket());86setConnectingProcess(debugee.getProcess());87}8889super.connect();90}9192/**93* Get appropriate test host name relying on the provided argumnets.94*/95private static String getTestHost(DebugeeArgumentHandler argumentHandler) {96return argumentHandler.getTestHost();97}9899} // IOPipe100101102