mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8286441: Remove mode parameter from jdk.internal.perf.Perf.attach()
Reviewed-by: redestad, alanb
This commit is contained in:
parent
46a775af11
commit
fcf49f42ce
@ -1097,7 +1097,7 @@ static size_t sharedmem_filesize(int fd, TRAPS) {
|
||||
|
||||
// attach to a named shared memory region.
|
||||
//
|
||||
static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemoryMode mode, char** addr, size_t* sizep, TRAPS) {
|
||||
static void mmap_attach_shared(const char* user, int vmid, char** addr, size_t* sizep, TRAPS) {
|
||||
|
||||
char* mapAddress;
|
||||
int result;
|
||||
@ -1105,31 +1105,11 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
|
||||
size_t size = 0;
|
||||
const char* luser = NULL;
|
||||
|
||||
int mmap_prot;
|
||||
int file_flags;
|
||||
int mmap_prot = PROT_READ;
|
||||
int file_flags = O_RDONLY | O_NOFOLLOW;
|
||||
|
||||
ResourceMark rm;
|
||||
|
||||
// map the high level access mode to the appropriate permission
|
||||
// constructs for the file and the shared memory mapping.
|
||||
if (mode == PerfMemory::PERF_MODE_RO) {
|
||||
mmap_prot = PROT_READ;
|
||||
file_flags = O_RDONLY | O_NOFOLLOW;
|
||||
}
|
||||
else if (mode == PerfMemory::PERF_MODE_RW) {
|
||||
#ifdef LATER
|
||||
mmap_prot = PROT_READ | PROT_WRITE;
|
||||
file_flags = O_RDWR | O_NOFOLLOW;
|
||||
#else
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Unsupported access mode");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Illegal access mode");
|
||||
}
|
||||
|
||||
// for linux, determine if vmid is for a containerized process
|
||||
int nspid = LINUX_ONLY(os::Linux::get_namespace_pid(vmid)) NOT_LINUX(-1);
|
||||
|
||||
@ -1288,7 +1268,7 @@ void PerfMemory::delete_memory_region() {
|
||||
// the indicated process's PerfData memory region into this JVMs
|
||||
// address space.
|
||||
//
|
||||
void PerfMemory::attach(const char* user, int vmid, PerfMemoryMode mode, char** addrp, size_t* sizep, TRAPS) {
|
||||
void PerfMemory::attach(const char* user, int vmid, char** addrp, size_t* sizep, TRAPS) {
|
||||
|
||||
if (vmid == 0 || vmid == os::current_process_id()) {
|
||||
*addrp = start();
|
||||
@ -1296,7 +1276,7 @@ void PerfMemory::attach(const char* user, int vmid, PerfMemoryMode mode, char**
|
||||
return;
|
||||
}
|
||||
|
||||
mmap_attach_shared(user, vmid, mode, addrp, sizep, CHECK);
|
||||
mmap_attach_shared(user, vmid, addrp, sizep, CHECK);
|
||||
}
|
||||
|
||||
// detach from the PerfData memory region of another JVM
|
||||
|
||||
@ -1573,36 +1573,17 @@ static size_t sharedmem_filesize(const char* filename, TRAPS) {
|
||||
// this method opens a file mapping object and maps the object
|
||||
// into the address space of the process
|
||||
//
|
||||
static void open_file_mapping(const char* user, int vmid,
|
||||
PerfMemory::PerfMemoryMode mode,
|
||||
char** addrp, size_t* sizep, TRAPS) {
|
||||
static void open_file_mapping(const char* user, int vmid, char** addrp, size_t* sizep, TRAPS) {
|
||||
|
||||
ResourceMark rm;
|
||||
|
||||
void *mapAddress = 0;
|
||||
size_t size = 0;
|
||||
HANDLE fmh;
|
||||
DWORD ofm_access;
|
||||
DWORD mv_access;
|
||||
DWORD ofm_access = FILE_MAP_READ;
|
||||
DWORD mv_access = FILE_MAP_READ;
|
||||
const char* luser = NULL;
|
||||
|
||||
if (mode == PerfMemory::PERF_MODE_RO) {
|
||||
ofm_access = FILE_MAP_READ;
|
||||
mv_access = FILE_MAP_READ;
|
||||
}
|
||||
else if (mode == PerfMemory::PERF_MODE_RW) {
|
||||
#ifdef LATER
|
||||
ofm_access = FILE_MAP_READ | FILE_MAP_WRITE;
|
||||
mv_access = FILE_MAP_READ | FILE_MAP_WRITE;
|
||||
#else
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Unsupported access mode");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
"Illegal access mode");
|
||||
}
|
||||
|
||||
// if a user name wasn't specified, then find the user name for
|
||||
// the owner of the target vm.
|
||||
@ -1796,7 +1777,7 @@ void PerfMemory::delete_memory_region() {
|
||||
// the indicated process's PerfData memory region into this JVMs
|
||||
// address space.
|
||||
//
|
||||
void PerfMemory::attach(const char* user, int vmid, PerfMemoryMode mode,
|
||||
void PerfMemory::attach(const char* user, int vmid,
|
||||
char** addrp, size_t* sizep, TRAPS) {
|
||||
|
||||
if (vmid == 0 || vmid == os::current_process_id()) {
|
||||
@ -1805,7 +1786,7 @@ void PerfMemory::attach(const char* user, int vmid, PerfMemoryMode mode,
|
||||
return;
|
||||
}
|
||||
|
||||
open_file_mapping(user, vmid, mode, addrp, sizep, CHECK);
|
||||
open_file_mapping(user, vmid, addrp, sizep, CHECK);
|
||||
}
|
||||
|
||||
// detach from the PerfData memory region of another JVM
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -64,7 +64,7 @@ static char* jstr_to_utf(JNIEnv *env, jstring str, TRAPS) {
|
||||
return utfstr;
|
||||
}
|
||||
|
||||
PERF_ENTRY(jobject, Perf_Attach(JNIEnv *env, jobject unused, jstring user, int vmid, int mode))
|
||||
PERF_ENTRY(jobject, Perf_Attach(JNIEnv *env, jobject unused, jstring user, int vmid))
|
||||
|
||||
PerfWrapper("Perf_Attach");
|
||||
|
||||
@ -80,14 +80,8 @@ PERF_ENTRY(jobject, Perf_Attach(JNIEnv *env, jobject unused, jstring user, int v
|
||||
user_utf = user == NULL ? NULL : jstr_to_utf(env, user, CHECK_NULL);
|
||||
}
|
||||
|
||||
if (mode != PerfMemory::PERF_MODE_RO &&
|
||||
mode != PerfMemory::PERF_MODE_RW) {
|
||||
THROW_0(vmSymbols::java_lang_IllegalArgumentException());
|
||||
}
|
||||
|
||||
// attach to the PerfData memory region for the specified VM
|
||||
PerfMemory::attach(user_utf, vmid, (PerfMemory::PerfMemoryMode) mode,
|
||||
&address, &capacity, CHECK_NULL);
|
||||
PerfMemory::attach(user_utf, vmid, &address, &capacity, CHECK_NULL);
|
||||
|
||||
{
|
||||
ThreadToNativeFromVM ttnfv(thread);
|
||||
@ -300,7 +294,7 @@ PERF_END
|
||||
|
||||
static JNINativeMethod perfmethods[] = {
|
||||
|
||||
{CC "attach", CC "(" JLS "II)" BB, FN_PTR(Perf_Attach)},
|
||||
{CC "attach0", CC "(" JLS "I)" BB, FN_PTR(Perf_Attach)},
|
||||
{CC "detach", CC "(" BB ")V", FN_PTR(Perf_Detach)},
|
||||
{CC "createLong", CL_ARGS, FN_PTR(Perf_CreateLong)},
|
||||
{CC "createByteArray", CBA_ARGS, FN_PTR(Perf_CreateByteArray)},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -128,11 +128,6 @@ class PerfMemory : AllStatic {
|
||||
static void delete_memory_region();
|
||||
|
||||
public:
|
||||
enum PerfMemoryMode {
|
||||
PERF_MODE_RO = 0,
|
||||
PERF_MODE_RW = 1
|
||||
};
|
||||
|
||||
static char* alloc(size_t size);
|
||||
static char* start() { return _start; }
|
||||
static char* end() { return _end; }
|
||||
@ -148,8 +143,7 @@ class PerfMemory : AllStatic {
|
||||
|
||||
// methods for attaching to and detaching from the PerfData
|
||||
// memory segment of another JVM process on the same system.
|
||||
static void attach(const char* user, int vmid, PerfMemoryMode mode,
|
||||
char** addrp, size_t* size, TRAPS);
|
||||
static void attach(const char* user, int vmid, char** addrp, size_t* size, TRAPS);
|
||||
static void detach(char* addr, size_t bytes);
|
||||
|
||||
static void initialize();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,9 +56,6 @@ public final class Perf {
|
||||
|
||||
private static Perf instance;
|
||||
|
||||
private static final int PERF_MODE_RO = 0;
|
||||
private static final int PERF_MODE_RW = 1;
|
||||
|
||||
private Perf() { } // prevent instantiation
|
||||
|
||||
/**
|
||||
@ -171,50 +168,28 @@ public final class Perf {
|
||||
* for the Java virtual machine running this method, then the returned
|
||||
* <code>ByteBuffer</code> object will always be coherent and dynamically
|
||||
* changing.
|
||||
* <p>
|
||||
* The attach mode specifies the access permissions requested for the
|
||||
* instrumentation buffer of the target virtual machine. The permitted
|
||||
* access permissions are:
|
||||
* <ul>
|
||||
* <li>"r" - Read only access. This Java virtual machine has only
|
||||
* read access to the instrumentation buffer for the target Java
|
||||
* virtual machine.
|
||||
* <li>"rw" - Read/Write access. This Java virtual machine has read and
|
||||
* write access to the instrumentation buffer for the target Java virtual
|
||||
* machine. This mode is currently not supported and is reserved for
|
||||
* future enhancements.
|
||||
* </ul>
|
||||
*
|
||||
* @param lvmid an integer that uniquely identifies the
|
||||
* target local Java virtual machine.
|
||||
* @param mode a string indicating the attach mode.
|
||||
* @return ByteBuffer a direct allocated byte buffer
|
||||
* @throws IllegalArgumentException The lvmid or mode was invalid.
|
||||
* @throws IllegalArgumentException The lvmid was invalid.
|
||||
* @throws IOException An I/O error occurred while trying to acquire
|
||||
* the instrumentation buffer.
|
||||
* @throws OutOfMemoryError The instrumentation buffer could not be mapped
|
||||
* into the virtual machine's address space.
|
||||
* @see java.nio.ByteBuffer
|
||||
*/
|
||||
public ByteBuffer attach(int lvmid, String mode)
|
||||
public ByteBuffer attach(int lvmid)
|
||||
throws IllegalArgumentException, IOException
|
||||
{
|
||||
if (mode.compareTo("r") == 0) {
|
||||
return attachImpl(null, lvmid, PERF_MODE_RO);
|
||||
}
|
||||
else if (mode.compareTo("rw") == 0) {
|
||||
return attachImpl(null, lvmid, PERF_MODE_RW);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("unknown mode");
|
||||
}
|
||||
return attachImpl(null, lvmid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach to the instrumentation buffer for the specified Java virtual
|
||||
* machine owned by the given user.
|
||||
* <p>
|
||||
* This method behaves just as the <code>attach(int lvmid, String mode)
|
||||
* This method behaves just as the <code>attach(int lvmid)
|
||||
* </code> method, except that it only searches for Java virtual machines
|
||||
* owned by the specified user.
|
||||
*
|
||||
@ -223,27 +198,18 @@ public final class Perf {
|
||||
* virtual machine.
|
||||
* @param lvmid an integer that uniquely identifies the
|
||||
* target local Java virtual machine.
|
||||
* @param mode a string indicating the attach mode.
|
||||
* @return ByteBuffer a direct allocated byte buffer
|
||||
* @throws IllegalArgumentException The lvmid or mode was invalid.
|
||||
* @throws IllegalArgumentException The lvmid was invalid.
|
||||
* @throws IOException An I/O error occurred while trying to acquire
|
||||
* the instrumentation buffer.
|
||||
* @throws OutOfMemoryError The instrumentation buffer could not be mapped
|
||||
* into the virtual machine's address space.
|
||||
* @see java.nio.ByteBuffer
|
||||
*/
|
||||
public ByteBuffer attach(String user, int lvmid, String mode)
|
||||
public ByteBuffer attach(String user, int lvmid)
|
||||
throws IllegalArgumentException, IOException
|
||||
{
|
||||
if (mode.compareTo("r") == 0) {
|
||||
return attachImpl(user, lvmid, PERF_MODE_RO);
|
||||
}
|
||||
else if (mode.compareTo("rw") == 0) {
|
||||
return attachImpl(user, lvmid, PERF_MODE_RW);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("unknown mode");
|
||||
}
|
||||
return attachImpl(user, lvmid);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,18 +225,17 @@ public final class Perf {
|
||||
* virtual machine.
|
||||
* @param lvmid an integer that uniquely identifies the
|
||||
* target local Java virtual machine.
|
||||
* @param mode a string indicating the attach mode.
|
||||
* @return ByteBuffer a direct allocated byte buffer
|
||||
* @throws IllegalArgumentException The lvmid or mode was invalid.
|
||||
* @throws IllegalArgumentException The lvmid was invalid.
|
||||
* @throws IOException An I/O error occurred while trying to acquire
|
||||
* the instrumentation buffer.
|
||||
* @throws OutOfMemoryError The instrumentation buffer could not be mapped
|
||||
* into the virtual machine's address space.
|
||||
*/
|
||||
private ByteBuffer attachImpl(String user, int lvmid, int mode)
|
||||
private ByteBuffer attachImpl(String user, int lvmid)
|
||||
throws IllegalArgumentException, IOException
|
||||
{
|
||||
final ByteBuffer b = attach(user, lvmid, mode);
|
||||
final ByteBuffer b = attach0(user, lvmid);
|
||||
|
||||
if (lvmid == 0) {
|
||||
// The native instrumentation buffer for this Java virtual
|
||||
@ -326,15 +291,14 @@ public final class Perf {
|
||||
* virtual machine.
|
||||
* @param lvmid an integer that uniquely identifies the
|
||||
* target local Java virtual machine.
|
||||
* @param mode a string indicating the attach mode.
|
||||
* @return ByteBuffer a direct allocated byte buffer
|
||||
* @throws IllegalArgumentException The lvmid or mode was invalid.
|
||||
* @throws IllegalArgumentException The lvmid was invalid.
|
||||
* @throws IOException An I/O error occurred while trying to acquire
|
||||
* the instrumentation buffer.
|
||||
* @throws OutOfMemoryError The instrumentation buffer could not be mapped
|
||||
* into the virtual machine's address space.
|
||||
*/
|
||||
private native ByteBuffer attach(String user, int lvmid, int mode)
|
||||
private native ByteBuffer attach0(String user, int lvmid)
|
||||
throws IllegalArgumentException, IOException;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -258,7 +258,7 @@ class VMManagementImpl implements VMManagement {
|
||||
@SuppressWarnings("removal")
|
||||
Perf perf = AccessController.doPrivileged(new Perf.GetPerfAction());
|
||||
try {
|
||||
ByteBuffer bb = perf.attach(0, "r");
|
||||
ByteBuffer bb = perf.attach(0);
|
||||
if (bb.capacity() == 0) {
|
||||
noPerfData = true;
|
||||
return null;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -66,10 +66,7 @@ import java.net.*;
|
||||
* (protocol) dependent. These components are ignored by the
|
||||
* default local protocol, <em>local:</em>. For the default remote
|
||||
* protocol, <em>rmi</em>, the Path component is interpreted as
|
||||
* the name of the RMI remote object. The Query component may
|
||||
* contain an access mode specifier <em>?mode=</em> specifying
|
||||
* <em>"r"</em> or <em>"rw"</em> access (write access currently
|
||||
* ignored). The Fragment part is ignored.
|
||||
* the name of the RMI remote object. The Fragment part is ignored.
|
||||
* </p></li>
|
||||
* </ul>
|
||||
* <p>
|
||||
@ -497,26 +494,6 @@ public class HostIdentifier {
|
||||
return uri.getFragment();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mode indicated in this HostIdentifier.
|
||||
*
|
||||
* @return String - the mode string. If no mode is specified, then "r"
|
||||
* is returned. otherwise, the specified mode is returned.
|
||||
*/
|
||||
public String getMode() {
|
||||
String query = getQuery();
|
||||
if (query != null) {
|
||||
String[] queryArgs = query.split("\\+");
|
||||
for (String queryArg : queryArgs) {
|
||||
if (queryArg.startsWith("mode=")) {
|
||||
int index = queryArg.indexOf('=');
|
||||
return queryArg.substring(index + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "r";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the URI associated with the HostIdentifier.
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -375,26 +375,6 @@ public class VmIdentifier {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the mode indicated in this VmIdentifier.
|
||||
*
|
||||
* @return String - the mode string. If no mode is specified, then "r"
|
||||
* is returned. otherwise, the specified mode is returned.
|
||||
*/
|
||||
public String getMode() {
|
||||
String query = getQuery();
|
||||
if (query != null) {
|
||||
String[] queryArgs = query.split("\\+");
|
||||
for (String queryArg : queryArgs) {
|
||||
if (queryArg.startsWith("mode=")) {
|
||||
int index = queryArg.indexOf('=');
|
||||
return queryArg.substring(index + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return "r";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the URI associated with the VmIdentifier.
|
||||
*
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,23 +53,11 @@ public class PerfDataBuffer extends AbstractPerfDataBuffer {
|
||||
*/
|
||||
public PerfDataBuffer(VmIdentifier vmid) throws MonitorException {
|
||||
File f = new File(vmid.getURI());
|
||||
String mode = vmid.getMode();
|
||||
|
||||
try {
|
||||
FileChannel fc = new RandomAccessFile(f, mode).getChannel();
|
||||
ByteBuffer bb = null;
|
||||
|
||||
if (mode.equals("r")) {
|
||||
bb = fc.map(FileChannel.MapMode.READ_ONLY, 0L, (int)fc.size());
|
||||
} else if (mode.equals("rw")) {
|
||||
bb = fc.map(FileChannel.MapMode.READ_WRITE, 0L, (int)fc.size());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid mode: " + mode);
|
||||
}
|
||||
|
||||
fc.close(); // doesn't need to remain open
|
||||
|
||||
try (FileChannel fc = new RandomAccessFile(f, "r").getChannel()) {
|
||||
ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0L, (int)fc.size());
|
||||
createPerfDataBuffer(bb, 0);
|
||||
// fc doesn't need to remain open
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new MonitorException("Could not find " + vmid.toString());
|
||||
} catch (IOException e) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -62,7 +62,7 @@ public class PerfDataBuffer extends AbstractPerfDataBuffer {
|
||||
public PerfDataBuffer(VmIdentifier vmid) throws MonitorException {
|
||||
try {
|
||||
// Try 1.4.2 and later first
|
||||
ByteBuffer bb = perf.attach(vmid.getLocalVmId(), vmid.getMode());
|
||||
ByteBuffer bb = perf.attach(vmid.getLocalVmId());
|
||||
createPerfDataBuffer(bb, vmid.getLocalVmId());
|
||||
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,7 +75,7 @@ public class Jps {
|
||||
}
|
||||
|
||||
MonitoredVm vm = null;
|
||||
String vmidString = "//" + lvmid + "?mode=r";
|
||||
String vmidString = "//" + lvmid;
|
||||
|
||||
String errorString = null;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -53,8 +53,7 @@ public interface RemoteHost extends Remote {
|
||||
* @throws RemoteException
|
||||
*
|
||||
*/
|
||||
RemoteVm attachVm(int vmid, String mode) throws RemoteException,
|
||||
MonitorException;
|
||||
RemoteVm attachVm(int vmid) throws RemoteException, MonitorException;
|
||||
|
||||
/**
|
||||
* Remote method to detach from a remote HotSpot Java Virtual Machine
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -141,8 +141,7 @@ public class MonitoredHostProvider extends MonitoredHost {
|
||||
VmIdentifier nvmid = null;
|
||||
try {
|
||||
nvmid = hostId.resolve(vmid);
|
||||
RemoteVm rvm = remoteHost.attachVm(vmid.getLocalVmId(),
|
||||
vmid.getMode());
|
||||
RemoteVm rvm = remoteHost.attachVm(vmid.getLocalVmId());
|
||||
RemoteMonitoredVm rmvm = new RemoteMonitoredVm(rvm, nvmid, timer,
|
||||
interval);
|
||||
rmvm.attach();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,18 +67,12 @@ public class RemoteHostImpl implements RemoteHost, HostListener {
|
||||
monitoredHost.addHostListener(this);
|
||||
}
|
||||
|
||||
public RemoteVm attachVm(int lvmid, String mode)
|
||||
throws RemoteException, MonitorException {
|
||||
public RemoteVm attachVm(int lvmid) throws RemoteException, MonitorException {
|
||||
Integer v = lvmid;
|
||||
RemoteVm stub = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("local://").append(lvmid).append("@localhost");
|
||||
if (mode != null) {
|
||||
sb.append("?mode=").append(mode);
|
||||
}
|
||||
|
||||
String vmidStr = sb.toString();
|
||||
String vmidStr = "local://" + lvmid + "@localhost";
|
||||
|
||||
try {
|
||||
VmIdentifier vmid = new VmIdentifier(vmidStr);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -143,7 +143,7 @@ public class ConnectorAddressLink {
|
||||
Perf perf = Perf.getPerf();
|
||||
ByteBuffer bb;
|
||||
try {
|
||||
bb = perf.attach(vmid, "r");
|
||||
bb = perf.attach(vmid);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException(iae.getMessage());
|
||||
}
|
||||
@ -200,7 +200,7 @@ public class ConnectorAddressLink {
|
||||
Perf perf = Perf.getPerf();
|
||||
ByteBuffer bb;
|
||||
try {
|
||||
bb = perf.attach(vmid, "r");
|
||||
bb = perf.attach(vmid);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new IOException(iae.getMessage());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user