本文整理汇总了Java中com.sun.jdi.request.EventRequest.SUSPEND_EVENT_THREAD属性的典型用法代码示例。如果您正苦于以下问题:Java EventRequest.SUSPEND_EVENT_THREAD属性的具体用法?Java EventRequest.SUSPEND_EVENT_THREAD怎么用?Java EventRequest.SUSPEND_EVENT_THREAD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.jdi.request.EventRequest
的用法示例。
在下文中一共展示了EventRequest.SUSPEND_EVENT_THREAD属性的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: contextAction
public void contextAction() {
showStatusText(DebuggerBundle.message("status.run.to.cursor"));
cancelRunToCursorBreakpoint();
if (myRunToCursorBreakpoint == null) {
return;
}
if (myIgnoreBreakpoints) {
final BreakpointManager breakpointManager = DebuggerManagerEx.getInstanceEx(myProject).getBreakpointManager();
breakpointManager.disableBreakpoints(DebugProcessImpl.this);
}
applyThreadFilter(getContextThread());
final SuspendContextImpl context = getSuspendContext();
myRunToCursorBreakpoint.SUSPEND_POLICY = context.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD? DebuggerSettings.SUSPEND_THREAD : DebuggerSettings.SUSPEND_ALL;
myRunToCursorBreakpoint.LOG_ENABLED = false;
myRunToCursorBreakpoint.createRequest(context.getDebugProcess());
DebugProcessImpl.this.myRunToCursorBreakpoint = myRunToCursorBreakpoint;
super.contextAction();
}
示例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: unsetPausedIfNeeded
private void unsetPausedIfNeeded(DebuggerContextImpl context) {
SuspendContextImpl suspendContext = context.getSuspendContext();
if (suspendContext != null
&& suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD
&& context.getThreadProxy() != suspendContext.getThread()) {
((XDebugSessionImpl)getSession()).unsetPaused();
}
}
示例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: resumed
@Override
public void resumed(SuspendContextImpl suspendContext) {
SuspendContextImpl context = getProcess().getSuspendManager().getPausedContext();
ThreadReferenceProxyImpl steppingThread = null;
// single thread stepping
if (context != null
&& suspendContext != null
&& suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD
&& isSteppingThrough(suspendContext.getThread())) {
steppingThread = suspendContext.getThread();
}
final DebuggerContextImpl debuggerContext =
context != null ?
DebuggerContextImpl.createDebuggerContext(DebuggerSession.this,
context,
steppingThread != null ? steppingThread : context.getThread(),
null)
: null;
DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
@Override
public void run() {
if (debuggerContext != null) {
getContextManager().setState(debuggerContext, State.PAUSED, Event.CONTEXT, getDescription(debuggerContext));
}
else {
getContextManager().setState(SESSION_EMPTY_CONTEXT, State.RUNNING, Event.CONTEXT, null);
}
}
});
}
示例10: toSuspendPolicy
private SuspendPolicy toSuspendPolicy(int suspendEventRequest) {
switch (suspendEventRequest) {
case EventRequest.SUSPEND_EVENT_THREAD:
return SuspendPolicy.THREAD;
case EventRequest.SUSPEND_NONE:
return SuspendPolicy.NONE;
default:
return SuspendPolicy.ALL;
}
}
示例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: 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;
}
}
示例13: 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;
}
示例14: 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;
}
示例15: getInvokePolicy
private static int getInvokePolicy(SuspendContext suspendContext) {
//return ThreadReference.INVOKE_SINGLE_THREADED;
return suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD ? ObjectReference.INVOKE_SINGLE_THREADED : 0;
}