本文整理汇总了Java中com.sun.jdi.request.EventRequest.SUSPEND_ALL属性的典型用法代码示例。如果您正苦于以下问题:Java EventRequest.SUSPEND_ALL属性的具体用法?Java EventRequest.SUSPEND_ALL怎么用?Java EventRequest.SUSPEND_ALL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.jdi.request.EventRequest
的用法示例。
在下文中一共展示了EventRequest.SUSPEND_ALL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resume
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");
}
}
示例2: resumeAction
@Override
protected void resumeAction() {
SuspendContextImpl context = getSuspendContext();
if (context != null && context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD) {
myThreadBlockedMonitor.startWatching(myContextThread);
}
if (context != null
&& Registry.is("debugger.step.resumes.one.thread")
&& context.getSuspendPolicy() == EventRequest.SUSPEND_ALL
&& myContextThread != null) {
getSuspendManager().resumeThread(context, myContextThread);
}
else {
super.resumeAction();
}
}
示例3: run
@Override
public void run() {
EventQueue queue = Env.vm().eventQueue();
while (connected) {
try {
EventSet eventSet = queue.remove();
boolean resumeStoppedApp = false;
EventIterator it = eventSet.eventIterator();
while (it.hasNext()) {
resumeStoppedApp |= !handleEvent(it.nextEvent());
}
if (resumeStoppedApp) {
eventSet.resume();
} else if (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL) {
setCurrentThread(eventSet);
notifier.vmInterrupted();
}
} catch (InterruptedException exc) {
// Do nothing. Any changes will be seen at top of loop.
} catch (VMDisconnectedException discExc) {
handleDisconnectedException();
break;
}
}
synchronized (this) {
completed = true;
notifyAll();
}
}
示例4: JDWPtoJDISuspendPolicy
static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
switch(jdwpPolicy) {
case JDWP.SuspendPolicy.ALL:
return EventRequest.SUSPEND_ALL;
case JDWP.SuspendPolicy.EVENT_THREAD:
return EventRequest.SUSPEND_EVENT_THREAD;
case JDWP.SuspendPolicy.NONE:
return EventRequest.SUSPEND_NONE;
default:
throw new IllegalArgumentException("Illegal policy constant: " + jdwpPolicy);
}
}
示例5: JDItoJDWPSuspendPolicy
static byte JDItoJDWPSuspendPolicy(int jdiPolicy) {
switch(jdiPolicy) {
case EventRequest.SUSPEND_ALL:
return JDWP.SuspendPolicy.ALL;
case EventRequest.SUSPEND_EVENT_THREAD:
return JDWP.SuspendPolicy.EVENT_THREAD;
case EventRequest.SUSPEND_NONE:
return JDWP.SuspendPolicy.NONE;
default:
throw new IllegalArgumentException("Illegal policy constant: " + jdiPolicy);
}
}
示例6: suspends
public boolean suspends(ThreadReferenceProxyImpl thread) {
assertNotResumed();
if(isEvaluating()) {
return false;
}
switch(getSuspendPolicy()) {
case EventRequest.SUSPEND_ALL:
return !isExplicitlyResumed(thread);
case EventRequest.SUSPEND_EVENT_THREAD:
return thread == getThread();
}
return false;
}
示例7: findContextByThread
/**
* Returns suspend context that suspends the thread specified (may be currently evaluating)
*/
@Nullable
public static SuspendContextImpl findContextByThread(@NotNull SuspendManager suspendManager, ThreadReferenceProxyImpl thread) {
for (SuspendContextImpl context : ((SuspendManagerImpl)suspendManager).getPausedContexts()) {
if ((context.getThread() == thread || context.getSuspendPolicy() == EventRequest.SUSPEND_ALL)
&& !context.isExplicitlyResumed(thread)){
return context;
}
}
return null;
}
示例8: clearCashes
public void clearCashes(@MagicConstant(flagsFromClass = EventRequest.class) int suspendPolicy) {
if (!isAttached()) return;
switch (suspendPolicy) {
case EventRequest.SUSPEND_ALL:
getVirtualMachineProxy().clearCaches();
break;
case EventRequest.SUSPEND_EVENT_THREAD:
getVirtualMachineProxy().clearCaches();
//suspendContext.getThread().clearAll();
break;
}
}
示例9: applyThreadFilter
protected void applyThreadFilter(ThreadReferenceProxy thread) {
if (getSuspendContext().getSuspendPolicy() == EventRequest.SUSPEND_ALL) {
// there could be explicit resume as a result of call to voteSuspend()
// e.g. when breakpoint was considered invalid, in that case the filter will be applied _after_
// resuming and all breakpoints in other threads will be ignored.
// As resume() implicitly cleares the filter, the filter must be always applied _before_ any resume() action happens
final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(getProject()).getBreakpointManager();
breakpointManager.applyThreadFilter(DebugProcessImpl.this, thread.getThreadReference());
}
}
示例10: shouldSetAsActiveContext
private boolean shouldSetAsActiveContext(final SuspendContextImpl suspendContext) {
final ThreadReferenceProxyImpl newThread = suspendContext.getThread();
if (newThread == null || suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_ALL || isSteppingThrough(newThread)) {
return true;
}
final SuspendContextImpl currentSuspendContext = getContextManager().getContext().getSuspendContext();
if (currentSuspendContext == null) {
return mySteppingThroughThread.get() == null;
}
if (enableBreakpointsDuringEvaluation()) {
final ThreadReferenceProxyImpl currentThread = currentSuspendContext.getThread();
return currentThread == null || Comparing.equal(currentThread.getThreadReference(), newThread.getThreadReference());
}
return false;
}
示例11: toSuspendEventRequest
private int toSuspendEventRequest(SuspendPolicy suspendPolicy) {
if (suspendPolicy == null) {
return EventRequest.SUSPEND_ALL;
}
switch (suspendPolicy) {
case NONE:
return EventRequest.SUSPEND_NONE;
case THREAD:
return EventRequest.SUSPEND_EVENT_THREAD;
default:
return EventRequest.SUSPEND_ALL;
}
}
示例12: run
public void run() {
EventQueue queue = env.vm().eventQueue();
while (connected) {
try {
EventSet eventSet = queue.remove();
boolean resumeStoppedApp = false;
EventIterator it = eventSet.eventIterator();
while (it.hasNext()) {
resumeStoppedApp |= !handleEvent(it.nextEvent());
}
if (resumeStoppedApp) {
eventSet.resume();
} else if (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL) {
setCurrentThread(eventSet);
notifier.vmInterrupted();
}
} catch (InterruptedException exc) {
// Do nothing. Any changes will be seen at top of loop.
} catch (VMDisconnectedException discExc) {
handleDisconnectedException();
break;
}
}
synchronized (this) {
completed = true;
notifyAll();
}
}
示例13: clearCashes
public void clearCashes(int suspendPolicy) {
if (!isAttached()) return;
switch (suspendPolicy) {
case EventRequest.SUSPEND_ALL:
getVirtualMachineProxy().clearCaches();
break;
case EventRequest.SUSPEND_EVENT_THREAD:
getVirtualMachineProxy().clearCaches();
//suspendContext.getThread().clearAll();
break;
}
}
示例14: testIgnoreEvent
/**
*
* @param eventSet
* @return <code>null</code> not to ignore the event, or non-<code>null</code> to ignore the event.
* The threads in the returned set should be resumed prior deferring the set for the future processing.
* If the set is empty, the event should be ignored completely, without any later processing.
* @throws InternalExceptionWrapper
* @throws VMDisconnectedExceptionWrapper
*/
private Set<ThreadReference> testIgnoreEvent(EventSet eventSet) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper {
int suspendPolicy = EventSetWrapper.suspendPolicy(eventSet);
ThreadReference tref = null;
for (Event e : eventSet) {
tref = getEventThread(e);
}
if (tref != null && suspendPolicy == EventRequest.SUSPEND_EVENT_THREAD) {
synchronized (methodInvokingThreads) {
if (methodInvokingThreads.contains(tref)) {
// Ignore events that occur during method invocations
// in the invocation thread completely
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "testIgnoreEvent({0}) = []", eventSet);
}
return Collections.emptySet();
}
}
}
Set<ThreadReference> threadsToResume = null;
if (suspendPolicy == EventRequest.SUSPEND_ALL) {
// Event suspended all threads, including those in which a method is being invoked.
logger.log(Level.FINE, "methodInvokingThreads = {0}", methodInvokingThreads);
synchronized (methodInvokingThreads) {
if (!methodInvokingThreads.isEmpty()) {
threadsToResume = new HashSet<ThreadReference>(methodInvokingThreads);
}
}
if (threadsToResume != null) {
synchronized (threadsResumedForEvents) {
Set<ThreadReference> resumed = threadsResumedForEvents.get(eventSet);
if (resumed != null) {
resumed.addAll(threadsToResume);
} else {
resumed = threadsToResume;
}
threadsResumedForEvents.put(eventSet, resumed);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Set threadsResumedForEvents "+resumed+" for events "+System.identityHashCode(eventSet));
}
}
}
}
if (logger.isLoggable(Level.FINE)) {
logger.fine("testIgnoreEvent("+eventSet+") = "+threadsToResume);
}
return threadsToResume;
}
示例15: pushSuspendContext
@Override
public SuspendContextImpl pushSuspendContext(@MagicConstant(flagsFromClass = EventRequest.class) final int suspendPolicy, int nVotes) {
SuspendContextImpl suspendContext = new SuspendContextImpl(myDebugProcess, suspendPolicy, nVotes, null) {
@Override
protected void resumeImpl() {
if (LOG.isDebugEnabled()) {
LOG.debug("Start resuming...");
}
myDebugProcess.logThreads();
switch(getSuspendPolicy()) {
case EventRequest.SUSPEND_ALL:
int resumeAttempts = 5;
while (--resumeAttempts > 0) {
try {
myDebugProcess.getVirtualMachineProxy().resume();
break;
}
catch (InternalException e) {
//InternalException 13 means that there are running threads that we are trying to resume
//On MacOS it happened that native thread didn't stop while some java thread reached breakpoint
//noinspection StatementWithEmptyBody
if (/*Patches.MAC_RESUME_VM_HACK && */e.errorCode() == 13) {
//Its funny, but second resume solves the problem
}
else {
LOG.error(e);
break;
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("VM resumed ");
}
break;
case EventRequest.SUSPEND_EVENT_THREAD:
myFrozenThreads.remove(getThread());
getThread().resume();
if(LOG.isDebugEnabled()) {
LOG.debug("Thread resumed : " + getThread().toString());
}
break;
case EventRequest.SUSPEND_NONE:
if (LOG.isDebugEnabled()) {
LOG.debug("None resumed");
}
break;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Suspends = " + suspends);
}
myDebugProcess.logThreads();
}
};
pushContext(suspendContext);
return suspendContext;
}