summaryrefslogtreecommitdiff
path: root/java/jdk16/files/patch-j2se-attach-BSDAttachProvider.java
diff options
context:
space:
mode:
authorGreg Lewis <glewis@FreeBSD.org>2009-02-02 07:35:54 +0000
committerGreg Lewis <glewis@FreeBSD.org>2009-02-02 07:35:54 +0000
commit78a3416947c6700d8e2868fbbd16308ff0583952 (patch)
tree75e61f0939f46d70dced95c6c01882852234f2e1 /java/jdk16/files/patch-j2se-attach-BSDAttachProvider.java
parent- update to 0.04 (diff)
. Implement the virtual machine interface for BSD. This allows
jmap -histo and jmap -dump to work. Submitted by: Brian Gardner <brian@experts-exchange.com> Sponsored by: Experts Exchange
Notes
Notes: svn path=/head/; revision=227431
Diffstat (limited to 'java/jdk16/files/patch-j2se-attach-BSDAttachProvider.java')
-rw-r--r--java/jdk16/files/patch-j2se-attach-BSDAttachProvider.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/java/jdk16/files/patch-j2se-attach-BSDAttachProvider.java b/java/jdk16/files/patch-j2se-attach-BSDAttachProvider.java
new file mode 100644
index 000000000000..fa3c3e31c0af
--- /dev/null
+++ b/java/jdk16/files/patch-j2se-attach-BSDAttachProvider.java
@@ -0,0 +1,44 @@
+$FreeBSD$
+
+--- ../../j2se/src/solaris/classes/sun/tools/attach/BSDAttachProvider.java 10 May 2007 05:38:51 -0000 1.1
++++ ../../j2se/src/solaris/classes/sun/tools/attach/BSDAttachProvider.java 2 Feb 2009 00:27:30 -0000
+@@ -14,7 +14,7 @@
+ import java.io.IOException;
+
+ /*
+- * An AttachProvider implementation for Linux that uses a UNIX domain
++ * An AttachProvider implementation for BSD that uses a UNIX domain
+ * socket.
+ */
+ public class BSDAttachProvider extends HotSpotAttachProvider {
+@@ -36,12 +36,28 @@
+ public VirtualMachine attachVirtualMachine(String vmid)
+ throws AttachNotSupportedException, IOException
+ {
+- throw new AttachNotSupportedException("Attach not yet supported on BSD");
++ if (isNotAttachable(vmid)) {
++ throw new AttachNotSupportedException("can only attach to Java SE 6.0 or newer");
++ }
++ return new BSDVirtualMachine(this, vmid);
+ }
+
+ public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
+ throws AttachNotSupportedException, IOException
+ {
+- throw new AttachNotSupportedException("Attach not yet supported on BSD");
++ if (vmd.provider() != this) {
++ throw new AttachNotSupportedException("provider mismatch");
++ }
++ // To avoid re-checking if the VM if attachable, we check if the descriptor
++ // is for a hotspot VM - these descriptors are created by the listVirtualMachines
++ // implementation which only returns a list of attachable VMs.
++ if (vmd instanceof HotSpotVirtualMachineDescriptor) {
++ assert ((HotSpotVirtualMachineDescriptor)vmd).isAttachable();
++ checkAttachPermission();
++ return new BSDVirtualMachine(this, vmd.id());
++ } else {
++ return attachVirtualMachine(vmd.id());
++ }
+ }
++
+ }