Package java.util.concurrent.locks

Examples of java.util.concurrent.locks.Lock.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



    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


    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


    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

          }
        }
      });

      Lock startLock = new ReentrantLock();
      Condition startCondition = startLock.newCondition();
      AtomicBoolean startedServing = new AtomicBoolean();
      startMetaStoreThreads(conf, startLock, startCondition, startedServing);
      startMetaStore(cli.port, ShimLoader.getHadoopThriftAuthBridge(), conf, startLock,
          startCondition, startedServing);
    } catch (Throwable t) {
View Full Code Here

        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

          }
        }
      });

      Lock startLock = new ReentrantLock();
      Condition startCondition = startLock.newCondition();
      MetaStoreThread.BooleanPointer startedServing = new MetaStoreThread.BooleanPointer();
      startMetaStoreThreads(conf, startLock, startCondition, startedServing);
      startMetaStore(cli.port, ShimLoader.getHadoopThriftAuthBridge(), conf, startLock,
          startCondition, startedServing);
    } catch (Throwable t) {
View Full Code Here

          }
        }
      });

      Lock startLock = new ReentrantLock();
      Condition startCondition = startLock.newCondition();
      MetaStoreThread.BooleanPointer startedServing = new MetaStoreThread.BooleanPointer();
      startMetaStoreThreads(conf, startLock, startCondition, startedServing);
      startMetaStore(cli.port, ShimLoader.getHadoopThriftAuthBridge(), conf, startLock,
          startCondition, startedServing);
    } catch (Throwable t) {
View Full Code Here

    public void testInBandBytestreamManager() throws IOException {
        MockServer mockServer = new MockServer();
        final Lock lock = new ReentrantLock();
        final XmppSession xmppSession1 = new TestXmppSession(ROMEO, mockServer);
        final XmppSession xmppSession2 = new TestXmppSession(JULIET, mockServer);
        final Condition condition = lock.newCondition();
        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        new Thread() {
            @Override
            public void run() {
View Full Code Here

        fieldReply.getValues().addAll(offeredStreamMethods);
        dataForm.getFields().add(fieldReply);
        StreamInitiation siResponse = new StreamInitiation(new FeatureNegotiation(dataForm));

        final Lock lock = new ReentrantLock();
        final Condition byteStreamOpened = lock.newCondition();
        final ByteStreamSession[] byteStreamSessions = new ByteStreamSession[1];

        final List<Exception> negotiationExceptions = new ArrayList<>();
        // Before we reply with the chosen stream method, we
        // register a byte stream listener, because we expect the initiator to open a byte stream with us.
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.