Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java
66661 views
1
/*
2
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
package nsk.share.jpda;
25
26
import nsk.share.*;
27
import nsk.share.jdi.Binder;
28
29
/**
30
* This class implements communicational channel between
31
* debugger and debugee used for synchronization and data exchange.
32
* This channel is based on TCP/IP sockets and works in all
33
* modes (local, remote and manual). In a remote mode
34
* connection to <code>BindServer</code> is used for redirecting IOPipe messages.
35
* In all other modes direct TCP/IP coonnection between two VMs is used.
36
*
37
* @see BindServer
38
*/
39
public class IOPipe extends SocketIOPipe {
40
41
public static final byte PORTS_COUNT = 10;
42
public static final byte NO_PORTS = 0;
43
44
public static final String PIPE_LOG_PREFIX = "IOPipe> ";
45
46
/**
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
@Deprecated
54
public IOPipe(DebugeeArgumentHandler argumentHandler, Log log) {
55
this(log, getTestHost(argumentHandler), argumentHandler.getPipePortNumber(),
56
(long)argumentHandler.getWaitTime() * 60 * 1000, false);
57
}
58
59
/**
60
* Make <code>IOPipe</code> at debugger's side
61
* with given <code>Debugee</code> mirror.
62
*
63
* @deprecated Preferred way is to start IOPipe before launching debuggee process.
64
*
65
* @see #startDebuggerPipe
66
*/
67
@Deprecated
68
public IOPipe(DebugeeProcess debugee) {
69
this(debugee.getLog(),
70
debugee.getArgumentHandler().getDebugeeHost(),
71
debugee.getArgumentHandler().getPipePortNumber(),
72
(long)debugee.getArgumentHandler().getWaitTime() * 60 * 1000,
73
true);
74
setServerSocket(debugee.getPipeServerSocket());
75
}
76
77
/**
78
* Make general <code>IOPipe</code> object with specified parameters.
79
*/
80
protected IOPipe(Log log, String host, int port, long timeout, boolean listening) {
81
super("IOPipe", log, PIPE_LOG_PREFIX, host, port, timeout, listening);
82
}
83
84
/**
85
* Creates and starts listening <code>IOPipe</code> at debugger side.
86
*/
87
public static IOPipe startDebuggerPipe(Binder binder) {
88
IOPipe ioPipe = new IOPipe(binder.getLog(),
89
binder.getArgumentHandler().getDebugeeHost(),
90
binder.getArgumentHandler().getPipePortNumber(),
91
(long)binder.getArgumentHandler().getWaitTime() * 60 * 1000,
92
true);
93
ioPipe.setServerSocket(binder.getPipeServerSocket());
94
ioPipe.startListening();
95
return ioPipe;
96
}
97
98
99
protected void connect() {
100
super.connect();
101
}
102
103
/**
104
* Get appropriate test host name relying on the provided argumnets.
105
*/
106
private static String getTestHost(DebugeeArgumentHandler argumentHandler) {
107
return argumentHandler.getTestHost();
108
}
109
110
} // IOPipe
111
112