Java Code Examples for com.sun.jdi.request.EventRequest#SUSPEND_ALL

The following examples show how to use com.sun.jdi.request.EventRequest#SUSPEND_ALL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventHandler.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 2
Source File: EventHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 3
Source File: EventHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 4
Source File: EventHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 5
Source File: EventHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 6
Source File: EventHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 7
Source File: EventHandler.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 8
Source File: EventHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 9
Source File: EventHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 10
Source File: EventHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 11
Source File: EventHandler.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 12
Source File: EventHandler.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 13
Source File: EventHandler.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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();
    }
}
 
Example 14
Source File: Operator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @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;
}