当前位置: 首页>>代码示例>>Java>>正文


Java VirtualMachine类代码示例

本文整理汇总了Java中com.sun.jdi.VirtualMachine的典型用法代码示例。如果您正苦于以下问题:Java VirtualMachine类的具体用法?Java VirtualMachine怎么用?Java VirtualMachine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VirtualMachine类属于com.sun.jdi包,在下文中一共展示了VirtualMachine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: solveGrabbing

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
public boolean solveGrabbing(VirtualMachine vm) {
    if (vm == null) return true;
    if (Boolean.FALSE.equals(doGrabCheck)) {
        return true;
    }
    if (GraphicsEnvironment.isHeadless()) {
        doGrabCheck = Boolean.FALSE;
        return true;
    }
    // Check if AWT-EventQueue thread is suspended and a window holds a grab
    List<ThreadReference> allThreads = VirtualMachineWrapper.allThreads0(vm);
    for (ThreadReference t : allThreads) {
        if (!t.isSuspended()) continue;
        boolean success = solveGrabbing(t);
        if (!success) {
            return false;
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:AWTGrabHandler.java

示例2: ungrabWindowAWT

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
private boolean ungrabWindowAWT(ThreadReference tr, ObjectReference grabbedWindow) {
    // Call XBaseWindow.ungrabInput()
    try {
        VirtualMachine vm = MirrorWrapper.virtualMachine(grabbedWindow);
        List<ReferenceType> xbaseWindowClassesByName = VirtualMachineWrapper.classesByName(vm, "sun.awt.X11.XBaseWindow");
        if (xbaseWindowClassesByName.isEmpty()) {
            logger.info("Unable to release X grab, no XBaseWindow class in target VM "+VirtualMachineWrapper.description(vm));
            return false;
        }
        ClassType XBaseWindowClass = (ClassType) xbaseWindowClassesByName.get(0);
        Method ungrabInput = XBaseWindowClass.concreteMethodByName("ungrabInput", "()V");
        if (ungrabInput == null) {
            logger.info("Unable to release X grab, method ungrabInput not found in target VM "+VirtualMachineWrapper.description(vm));
            return false;
        }
        XBaseWindowClass.invokeMethod(tr, ungrabInput, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
    } catch (VMDisconnectedExceptionWrapper vmdex) {
        return true; // Disconnected, all is good.
    } catch (Exception ex) {
        logger.log(Level.INFO, "Unable to release X grab.", ex);
        return false;
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AWTGrabHandler.java

示例3: instanceCounts

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
public long[] instanceCounts(List<? extends ReferenceType> classes) {
    if (!canGetInstanceInfo()) {
        throw new UnsupportedOperationException(
            "target does not support getting instances");
    }
    long[] retValue ;
    ReferenceTypeImpl[] rtArray = new ReferenceTypeImpl[classes.size()];
    int ii = 0;
    for (ReferenceType rti: classes) {
        validateMirror(rti);
        rtArray[ii++] = (ReferenceTypeImpl)rti;
    }
    try {
        retValue = JDWP.VirtualMachine.InstanceCounts.
                            process(vm, rtArray).counts;
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }

    return retValue;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:VirtualMachineImpl.java

示例4: createMethodImpl

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
static MethodImpl createMethodImpl(VirtualMachine vm,
                                   ReferenceTypeImpl declaringType,
                                   long ref,
                                   String name,
                                   String signature,
                                   String genericSignature,
                                   int modifiers) {
    if ((modifiers & (VMModifiers.NATIVE | VMModifiers.ABSTRACT)) != 0) {
        return new NonConcreteMethodImpl(vm, declaringType, ref,
                                         name, signature,
                                         genericSignature,
                                         modifiers);
    } else {
        return new ConcreteMethodImpl(vm, declaringType, ref,
                                      name, signature,
                                      genericSignature,
                                      modifiers);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:MethodImpl.java

示例5: getQuantumTookitClassLoader

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
private static ObjectReference getQuantumTookitClassLoader(VirtualMachine vm) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper {
    ClassType classQuantumToolkit = getClass(vm, "com.sun.javafx.tk.quantum.QuantumToolkit");
    if (classQuantumToolkit == null) {
        return null;
    }
    ClassLoaderReference cl = ReferenceTypeWrapper.classLoader(classQuantumToolkit);
    return cl;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:RemoteServices.java

示例6: getArrayClass

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
static ArrayType getArrayClass(VirtualMachine vm, String name) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper {
    List<ReferenceType> classList = VirtualMachineWrapper.classesByName(vm, name);
    ReferenceType clazz = null;
    for (ReferenceType c : classList) {
        if (ReferenceTypeWrapper.classLoader(c) == null) {
            clazz = c;
            break;
        }
    }
    return (ArrayType) clazz;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:RemoteServices.java

示例7: TypeComponentImpl

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
TypeComponentImpl(VirtualMachine vm, ReferenceTypeImpl declaringType,
                  long ref, String name, String signature,
                  String genericSignature, int modifiers) {
    // The generic signature is set when this is created.
    super(vm);
    this.declaringType = declaringType;
    this.ref = ref;
    this.name = name;
    this.signature = signature;
    if (genericSignature != null && genericSignature.length() != 0) {
        this.genericSignature = genericSignature;
    } else {
        this.genericSignature = null;
    }
    this.modifiers = modifiers;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:TypeComponentImpl.java

示例8: getOrLoadClass

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
private static ReferenceType getOrLoadClass(VirtualMachine vm, String name) {
    List<ReferenceType> types = vm.classesByName(name);
    if (types.size() > 0) {
        if (types.size() == 1) {
            return types.get(0);
        }
        try {
            ReferenceType preferedType = JPDAUtils.getPreferredReferenceType(types, null);
            if (preferedType != null) {
                return preferedType;
            }
        } catch (VMDisconnectedExceptionWrapper ex) {
            throw ex.getCause();
        }
        // No preferred, just take the first one:
        return types.get(0);
    }
    // DO NOT TRY TO LOAD CLASSES AT ALL! See http://www.netbeans.org/issues/show_bug.cgi?id=168949
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:VariableMirrorTranslator.java

示例9: createOperator

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
private Operator createOperator (
    VirtualMachine virtualMachine,
    final Object startLock
) {
    return new Operator (
        virtualMachine,
        debuggerImpl,
        new Executor () {
            @Override
            public boolean exec(Event event) {
                synchronized(startLock) {
                    startLock.notify();
                }
                return false;
            }

            @Override
            public void removed(EventRequest eventRequest) {}
            
        },
        new Runnable () {
            @Override
            public void run () {
                debuggerImpl.finish();
            }
        },
        debuggerImpl.accessLock
    );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:StartActionProvider.java

示例10: testToString

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
@Test
public void testToString() throws Exception {
    Value i = this.getLocalValue("i");
    assertEquals("NumericFormatter should be able to format int correctly.", "111", formatter.toString(i, new HashMap<>()));


    VirtualMachine vm = getVM();

    assertEquals("NumericFormatter should be able to format double correctly.", "111.000000",
        formatter.toString(vm.mirrorOf(111.0), new HashMap<>()));
    assertEquals("NumericFormatter should be able to format float correctly.", "111.000000",
        formatter.toString(vm.mirrorOf(111.0f), new HashMap<>()));

    Map<String, Object> options = formatter.getDefaultOptions();
    options.put(NUMERIC_PRECISION_OPTION, 1);
    assertEquals("NumericFormatter should be able to format double correctly.", "111.0",
        formatter.toString(vm.mirrorOf(111.0), options));
    assertEquals("NumericFormatter should be able to format float correctly.", "111.0",
        formatter.toString(vm.mirrorOf(111.0f), options));

    options.put(NUMERIC_PRECISION_OPTION, -1);
    assertEquals("NumericFormatter should be able to format double correctly.", "111.000000",
        formatter.toString(vm.mirrorOf(111.0), options));
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:25,代码来源:NumericFormatterTest.java

示例11: getClass

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
private static ClassType getClass(VirtualMachine vm, String name) throws InternalExceptionWrapper,
                                                                         ObjectCollectedExceptionWrapper,
                                                                         VMDisconnectedExceptionWrapper {
    List<ReferenceType> classList = VirtualMachineWrapper.classesByName(vm, name);
    ReferenceType clazz = null;
    for (ReferenceType c : classList) {
        if (ReferenceTypeWrapper.classLoader(c) == null) {
            clazz = c;
            break;
        }
    }
    if (clazz == null && classList.size() > 0) {
        clazz = classList.get(0);
    }
    return (ClassType) clazz;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:RemoteServices.java

示例12: createVirtualMachine

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
public synchronized VirtualMachine createVirtualMachine(
                                    Connection connection,
                                    Process process) throws IOException {

    if (!connection.isOpen()) {
        throw new IllegalStateException("connection is not open");
    }

    VirtualMachine vm;
    try {
        vm = new VirtualMachineImpl(this, connection, process,
                                               ++vmSequenceNumber);
    } catch (VMDisconnectedException e) {
        throw new IOException(e.getMessage());
    }
    targets.add(vm);
    return vm;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:VirtualMachineManagerImpl.java

示例13: launch

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
public VirtualMachine
    launch(Map<String,? extends Connector.Argument> arguments)
    throws IOException, IllegalConnectorArgumentsException,
           VMStartException
{
    String command = argument(ARG_COMMAND, arguments).value();
    String address = argument(ARG_ADDRESS, arguments).value();

    String quote = argument(ARG_QUOTE, arguments).value();

    if (quote.length() > 1) {
        throw new IllegalConnectorArgumentsException("Invalid length",
                                                     ARG_QUOTE);
    }

    TransportService.ListenKey listener = transportService.startListening(address);

    try {
        return launch(tokenizeCommand(command, quote.charAt(0)),
                      address, listener, transportService);
    } finally {
        transportService.stopListening(listener);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:RawCommandLineLauncher.java

示例14: createVirtualMachine

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
private VirtualMachine createVirtualMachine(Class vmImplClass,
                                            String javaExec, String corefile)
    throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    java.lang.reflect.Method connectByCoreMethod = vmImplClass.getMethod(
                             "createVirtualMachineForCorefile",
                              new Class[] {
                                  VirtualMachineManager.class,
                                  String.class, String.class,
                                  Integer.TYPE
                              });
    return (VirtualMachine) connectByCoreMethod.invoke(null,
                              new Object[] {
                                  Bootstrap.virtualMachineManager(),
                                  javaExec,
                                  corefile,
                                  new Integer(0)
                              });
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:19,代码来源:SACoreAttachingConnector.java

示例15: ungrabWindowFX

import com.sun.jdi.VirtualMachine; //导入依赖的package包/类
private boolean ungrabWindowFX(ThreadReference tr) {
    // javafx.stage.Window.impl_getWindows() - Iterator<Window>
    // while (iterator.hasNext()) {
    //     Window w = iterator.next();
    //     ungrabWindowFX(w);
    // }
    try {
        VirtualMachine vm = MirrorWrapper.virtualMachine(tr);
        List<ReferenceType> windowClassesByName = VirtualMachineWrapper.classesByName(vm, "javafx.stage.Window");
        if (windowClassesByName.isEmpty()) {
            logger.info("Unable to release FX X grab, no javafx.stage.Window class in target VM "+VirtualMachineWrapper.description(vm));
            return true; // We do not know whether there was any grab
        }
        ClassType WindowClass = (ClassType) windowClassesByName.get(0);
        Method getWindowsMethod = WindowClass.concreteMethodByName("impl_getWindows", "()Ljava/util/Iterator;");
        if (getWindowsMethod == null) {
            logger.info("Unable to release FX X grab, no impl_getWindows() method in "+WindowClass);
            return true; // We do not know whether there was any grab
        }
        ObjectReference windowsIterator = (ObjectReference) WindowClass.invokeMethod(tr, getWindowsMethod, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
        if (windowsIterator == null) {
            return true; // We do not know whether there was any grab
        }
        InterfaceType IteratorClass = (InterfaceType) VirtualMachineWrapper.classesByName(vm, Iterator.class.getName()).get(0);
        Method hasNext = IteratorClass.methodsByName("hasNext", "()Z").get(0);
        Method next = IteratorClass.methodsByName("next", "()Ljava/lang/Object;").get(0);
        while (hasNext(hasNext, tr, windowsIterator)) {
            ObjectReference w = next(next, tr, windowsIterator);
            ungrabWindowFX(WindowClass, w, tr);
        }
    } catch (VMDisconnectedExceptionWrapper vmdex) {
        return true; // Disconnected, all is good.
    } catch (Exception ex) {
        logger.log(Level.INFO, "Unable to release FX X grab (if any).", ex);
        return true; // We do not know whether there was any grab
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:AWTGrabHandler.java


注:本文中的com.sun.jdi.VirtualMachine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。