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


Java ThreadReference.resume方法代码示例

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


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

示例1: resume

import com.sun.jdi.ThreadReference; //导入方法依赖的package包/类
public void resume() {
    switch (suspendPolicy()) {
        case EventRequest.SUSPEND_ALL:
            vm.resume();
            break;
        case EventRequest.SUSPEND_EVENT_THREAD:
            ThreadReference thread = eventThread();
            if (thread == null) {
                throw new InternalException("Inconsistent suspend policy");
            }
            thread.resume();
            break;
        case EventRequest.SUSPEND_NONE:
            // Do nothing
            break;
        default:
            throw new InternalException("Invalid suspend policy");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:EventSetImpl.java

示例2: resume

import com.sun.jdi.ThreadReference; //导入方法依赖的package包/类
@Override
public void resume() {
    /**
     * To ensure that all threads are fully resumed when the VM is resumed, make sure the suspend count
     * of each thread is no larger than 1.
     * Notes: Decrementing the thread' suspend count to 1 is on purpose, because it doesn't break the
     * the thread's suspend state, and also make sure the next instruction vm.resume() is able to resume
     * all threads fully.
     */
    for (ThreadReference tr : DebugUtility.getAllThreadsSafely(this)) {
        while (!tr.isCollected() && tr.suspendCount() > 1) {
            tr.resume();
        }
    }
    vm.resume();
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:17,代码来源:DebugSession.java

示例3: resumeThread

import com.sun.jdi.ThreadReference; //导入方法依赖的package包/类
/**
 * Resume the thread the times as it has been suspended.
 *
 * @param thread
 *              the thread reference
 */
public static void resumeThread(ThreadReference thread) {
    // if thread is not found or is garbage collected, do nothing
    if (thread == null || thread.isCollected()) {
        return;
    }
    try {
        int suspends = thread.suspendCount();
        for (int i = 0; i < suspends; i++) {
            /**
             * Invoking this method will decrement the count of pending suspends on this thread.
             * If it is decremented to 0, the thread will continue to execute.
             */
            thread.resume();
        }
    } catch (ObjectCollectedException ex) {
        // ObjectCollectionException can be thrown if the thread has already completed (exited) in the VM when calling suspendCount,
        // the resume operation to this thread is meanness.
    }
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:26,代码来源:DebugUtility.java

示例4: resume

import com.sun.jdi.ThreadReference; //导入方法依赖的package包/类
public void resume() {
    for (ThreadReference thread : threads()) {
        thread.resume();
    }

    for (ThreadGroupReference threadGroup : threadGroups()) {
        threadGroup.resume();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:ThreadGroupReferenceImpl.java

示例5: stepIntoThread

import com.sun.jdi.ThreadReference; //导入方法依赖的package包/类
private void stepIntoThread(ThreadReference thread) {
    StepRequest request = DebugUtility.createStepIntoRequest(thread,
            this.context.getStepFilters().classNameFilters);
    currentDebugSession.getEventHub().stepEvents().filter(debugEvent -> request.equals(debugEvent.event.request()))
            .take(1).subscribe(debugEvent -> {
                debugEvent.shouldResume = false;
                // Have to send to events to keep the UI sync with the step in operations:
                context.getProtocolServer().sendEvent(new Events.StoppedEvent("step", thread.uniqueID()));
                context.getProtocolServer().sendEvent(new Events.ContinuedEvent(thread.uniqueID()));
            });
    request.enable();
    thread.resume();
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:14,代码来源:JavaHotCodeReplaceProvider.java

示例6: build

import com.sun.jdi.ThreadReference; //导入方法依赖的package包/类
synchronized void build() {
    if (pkt == null) {
        return;
    }
    PacketStream ps = new PacketStream(vm, pkt);
    JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps);
    suspendPolicy = compEvt.suspendPolicy;
    if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
        switch(suspendPolicy) {
            case JDWP.SuspendPolicy.ALL:
                vm.printTrace("EventSet: SUSPEND_ALL");
                break;

            case JDWP.SuspendPolicy.EVENT_THREAD:
                vm.printTrace("EventSet: SUSPEND_EVENT_THREAD");
                break;

            case JDWP.SuspendPolicy.NONE:
                vm.printTrace("EventSet: SUSPEND_NONE");
                break;
        }
    }

    ThreadReference fix6485605 = null;
    for (int i = 0; i < compEvt.events.length; i++) {
        EventImpl evt = createEvent(compEvt.events[i]);
        if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
            try {
                vm.printTrace("Event: " + evt);
            } catch (VMDisconnectedException ee) {
                // ignore - see bug 6502716
            }
        }

        switch (evt.destination()) {
            case UNKNOWN_EVENT:
                // Ignore disabled, deleted, unknown events, but
                // save the thread if there is one since we might
                // have to resume it.  Note that events for different
                // threads can't be in the same event set.
                if (evt instanceof ThreadedEventImpl &&
                    suspendPolicy == JDWP.SuspendPolicy.EVENT_THREAD) {
                    fix6485605 = ((ThreadedEventImpl)evt).thread();
                }
                continue;
            case CLIENT_EVENT:
                addEvent(evt);
                break;
            case INTERNAL_EVENT:
                if (internalEventSet == null) {
                    internalEventSet = new EventSetImpl(this.vm, null);
                }
                internalEventSet.addEvent(evt);
                break;
            default:
                throw new InternalException("Invalid event destination");
        }
    }
    pkt = null; // No longer needed - free it up

    // Avoid hangs described in 6296125, 6293795
    if (super.size() == 0) {
        // This set has no client events.  If we don't do
        // needed resumes, no one else is going to.
        if (suspendPolicy == JDWP.SuspendPolicy.ALL) {
            vm.resume();
        } else if (suspendPolicy == JDWP.SuspendPolicy.EVENT_THREAD) {
            // See bug 6485605.
            if (fix6485605 != null) {
                fix6485605.resume();
            } else {
                // apparently, there is nothing to resume.
            }
        }
        suspendPolicy = JDWP.SuspendPolicy.NONE;

    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:80,代码来源:EventSetImpl.java


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