本文整理匯總了Java中com.sun.tools.attach.VirtualMachineDescriptor.provider方法的典型用法代碼示例。如果您正苦於以下問題:Java VirtualMachineDescriptor.provider方法的具體用法?Java VirtualMachineDescriptor.provider怎麽用?Java VirtualMachineDescriptor.provider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.tools.attach.VirtualMachineDescriptor
的用法示例。
在下文中一共展示了VirtualMachineDescriptor.provider方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getVmDescByServerName
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
/**
* 獲取指定服務名的本地JMX VM 描述對象
* @param serverName
* @return
*/
public static List<VirtualMachineDescriptor> getVmDescByServerName(String serverName){
List<VirtualMachineDescriptor> vmDescList = new ArrayList<>();
if (StringUtils.isEmpty(serverName)){
return vmDescList;
}
List<VirtualMachineDescriptor> vms = VirtualMachine.list();
for (VirtualMachineDescriptor desc : vms) {
//java -jar 形式啟動的Java應用
if(desc.displayName().matches(".*\\.jar(\\s*-*.*)*") && desc.displayName().contains(serverName)){
vmDescList.add(desc);
}else if(hasContainsServerName(desc.displayName(),serverName)){
vmDescList.add(desc);
}else if (isJSVC(desc.id(),serverName)){
VirtualMachineDescriptor descriptor = new VirtualMachineDescriptor(desc.provider(),desc.id(),serverName);
vmDescList.add(descriptor);
}
}
return vmDescList;
}
示例2: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
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 SolarisVirtualMachine(this, vmd.id());
} else {
return attachVirtualMachine(vmd.id());
}
}
示例3: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
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());
}
}
示例4: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
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 LinuxVirtualMachine(this, vmd.id());
} else {
return attachVirtualMachine(vmd.id());
}
}
示例5: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
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 AixVirtualMachine(this, vmd.id());
} else {
return attachVirtualMachine(vmd.id());
}
}
示例6: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
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 VirtualMachineImpl(this, vmd.id());
} else {
return attachVirtualMachine(vmd.id());
}
}
示例7: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
/**
* Attaches to a Java virtual machine.
*
* <p> A Java virtual machine can be described using a {@link
* com.sun.tools.attach.VirtualMachineDescriptor VirtualMachineDescriptor}.
* This method invokes the descriptor's {@link
* com.sun.tools.attach.VirtualMachineDescriptor#provider() provider()} method
* to check that it is equal to this provider. It then attempts to attach to the
* Java virtual machine.
*
* @param vmd
* The virtual machine descriptor
*
* @return VirtualMachine representing the target virtual machine.
*
* @throws SecurityException
* If a security manager has been installed and it denies
* {@link com.sun.tools.attach.AttachPermission AttachPermission}
* <tt>("attachVirtualMachine")</tt>, or other permission
* required by the implementation.
*
* @throws AttachNotSupportedException
* If the descriptor's {@link
* com.sun.tools.attach.VirtualMachineDescriptor#provider() provider()} method
* returns a provider that is not this provider, or it does not correspond
* to a Java virtual machine to which this provider can attach.
*
* @throws IOException
* If some other I/O error occurs
*
* @throws NullPointerException
* If <code>vmd</code> is <code>null</code>
*/
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
if (vmd.provider() != this) {
throw new AttachNotSupportedException("provider mismatch");
}
return attachVirtualMachine(vmd.id());
}
示例8: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
/**
* Attaches to a Java virtual machine.
*
* <p> A Java virtual machine can be described using a
* {@link com.sun.tools.attach.VirtualMachineDescriptor VirtualMachineDescriptor}.
* This method invokes the descriptor's
* {@link com.sun.tools.attach.VirtualMachineDescriptor#provider() provider()} method
* to check that it is equal to this provider. It then attempts to attach to the
* Java virtual machine.
*
* @param vmd
* The virtual machine descriptor
*
* @return VirtualMachine representing the target virtual machine.
*
* @throws SecurityException
* If a security manager has been installed and it denies
* {@link com.sun.tools.attach.AttachPermission AttachPermission}
* ("{@code attachVirtualMachine}"), or other permission
* required by the implementation.
*
* @throws AttachNotSupportedException
* If the descriptor's
* {@link com.sun.tools.attach.VirtualMachineDescriptor#provider() provider()}
* method returns a provider that is not this provider, or it does not
* correspond to a Java virtual machine to which this provider can attach.
*
* @throws IOException
* If some other I/O error occurs
*
* @throws NullPointerException
* If {@code vmd} is {@code null}
*/
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
if (vmd.provider() != this) {
throw new AttachNotSupportedException("provider mismatch");
}
return attachVirtualMachine(vmd.id());
}
示例9: attachVirtualMachine
import com.sun.tools.attach.VirtualMachineDescriptor; //導入方法依賴的package包/類
/**
* Attaches to a Java virtual machine.
* <p/>
* A Java virtual machine can be described using a {@link
* com.sun.tools.attach.VirtualMachineDescriptor VirtualMachineDescriptor}.
* This method invokes the descriptor's {@link
* com.sun.tools.attach.VirtualMachineDescriptor#provider() provider()} method
* to check that it is equal to this provider. It then attempts to attach to the
* Java virtual machine.
*
* @param vmd The virtual machine descriptor
* @return VirtualMachine representing the target virtual machine.
* @throws SecurityException If a security manager has been installed and it denies
* {@link com.sun.tools.attach.AttachPermission AttachPermission}
* <tt>("attachVirtualMachine")</tt>, or other permission
* required by the implementation.
* @throws AttachNotSupportedException If the descriptor's {@link
* com.sun.tools.attach.VirtualMachineDescriptor#provider() provider()} method
* returns a provider that is not this provider, or it does not correspond
* to a Java virtual machine to which this provider can attach.
* @throws IOException If some other I/O error occurs
* @throws NullPointerException If <code>vmd</code> is <code>null</code>
*/
public VirtualMachine attachVirtualMachine(VirtualMachineDescriptor vmd)
throws AttachNotSupportedException, IOException
{
if (vmd.provider() != this) {
throw new AttachNotSupportedException("provider mismatch");
}
return attachVirtualMachine(vmd.id());
}