Examples of newCondition()


Examples of java.util.concurrent.locks.ReentrantLock.newCondition()


    public void testIllegal() throws InterruptedException {

        Lock      lck = new ReentrantLock();
        Condition cnd = lck.newCondition();
        WaitingThread wt = new WaitingThread(cnd, null);

        try {
            lck.lock();
            wt.wakeup();
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()

                    5L, TimeUnit.SECONDS,
                    new LinkedBlockingQueue<Runnable>(),
                    threadFactory) {

                private final ReentrantLock pauseLock = new ReentrantLock();
                private final Condition unpaused = pauseLock.newCondition();
                private boolean isPaused = false;
                private final ReentrantLock executeLock = new ReentrantLock();

                @Override
                public void execute(Runnable command) {
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()

    }
    AtomicBoolean txnFail = new AtomicBoolean(false);
    AtomicInteger callbacksReceived = new AtomicInteger(0);
    AtomicInteger callbacksExpected = new AtomicInteger(0);
    final Lock lock = new ReentrantLock();
    final Condition condition = lock.newCondition();
    if (incrementBuffer != null) {
      incrementBuffer.clear();
    }
    /*
     * Callbacks can be reused per transaction, since they share the same
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()

        pkg.getJavaProject().getElementName(),
        unit.getTypes()[0].getFullyQualifiedName(), ILaunchManager.RUN_MODE);

    ILaunch launch = null;
    final Lock lock = new ReentrantLock();
    final Condition condition = lock.newCondition();
    lock.lock();
    try {
      // Wait for listener to be notified:
      while (listener.getLaunch(configName) == null) {
        condition.await(100, TimeUnit.MILLISECONDS);
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()

    ILaunchConfiguration config2 = launch(configName2,
        pkg.getJavaProject().getElementName(),
        unit2.getTypes()[0].getFullyQualifiedName(), ILaunchManager.RUN_MODE);

    final Lock lock = new ReentrantLock();
    final Condition condition = lock.newCondition();
    lock.lock();
    try {
      while (listener.getLaunch(configName1) == null
          || listener.getLaunch(configName2) == null) {
        condition.await(100, TimeUnit.MILLISECONDS);
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()

        pkg.getJavaProject().getElementName(),
        unit2.getType(className2).getFullyQualifiedName(),
        ILaunchManager.DEBUG_MODE);

    final Lock lock = new ReentrantLock();
    final Condition condition = lock.newCondition();
    lock.lock();
    try {
      // We had two breakpoints set, so we need to resume twice:
      while (suspendResume[0] == null) {
        condition.await(100, TimeUnit.MICROSECONDS);
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()

        workqueue = new AutomaticWorkQueueImpl(UNBOUNDED_MAX_QUEUE_SIZE, INITIAL_SIZE,
                                               UNBOUNDED_HIGH_WATER_MARK,
                                               UNBOUNDED_LOW_WATER_MARK,
                                               DEFAULT_DEQUEUE_TIMEOUT);
        final Lock runLock = new ReentrantLock();
        final Condition runCondition = runLock.newCondition();
        long start = System.currentTimeMillis();
        Runnable doNothing = new Runnable() {
            public void run() {
                runLock.lock();
                try {
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()

        } catch (IllegalArgumentException iax) {
            // expected
        }

        Lock      lck = new ReentrantLock();
        Condition cnd = lck.newCondition();

        WaitingThread wt = new WaitingThread(cnd, null);
        assertEquals("wrong condition", cnd, wt.getCondition());
        assertNull  ("pool from nowhere", wt.getPool());
        assertNull  ("thread from nowhere", wt.getThread());
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()


    public void testAwaitWakeup() throws InterruptedException {

        Lock      lck = new ReentrantLock();
        Condition cnd = lck.newCondition();
        WaitingThread wt = new WaitingThread(cnd, null);

        AwaitThread ath = new AwaitThread(wt, lck, null);
        ath.start();
        Thread.sleep(100); // give extra thread time to block
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantLock.newCondition()


    public void testInterrupt() throws InterruptedException {

        Lock      lck = new ReentrantLock();
        Condition cnd = lck.newCondition();
        WaitingThread wt = new WaitingThread(cnd, null);

        AwaitThread ath = new AwaitThread(wt, lck, null);
        ath.start();
        Thread.sleep(100); // give extra thread time to block
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.