Package java.util.concurrent

Examples of java.util.concurrent.Semaphore.acquire()


        this.idtoSem.put(strid, sem);
        ConcurrentLinkedQueue<DRPCRequest> queue=this.acquire_queue(this.requestQueues, function);
        queue.add(req);
        LOG.debug("Waiting for DRPC request for " +function+ " " +args+ " at " +(System.currentTimeMillis()));
        try {
            sem.acquire();
        } catch (InterruptedException e) {
            LOG.error("acquire fail " ,e);
        }
        LOG.debug("Acquired for DRPC request for " +function+ " " +args+ " at " +(System.currentTimeMillis()));
View Full Code Here


        // even on headless clients
        panel.add(canvas, BorderLayout.CENTER);
        canvas.repaint();

        try {
            waitForReady.acquire();
        } catch (InterruptedException ex) {
            Logger.getLogger(ViewManager.class.getName()).log(Level.SEVERE, null, ex);
        }

        createCameraEntity(ClientContextJME.getWorldManager());
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void testServiceExport() throws Exception {

        final Semaphore sema = new Semaphore(1);
        sema.acquire();
       
        String scope = "(objectClass=abc)";
    
        IMocksControl c = EasyMock.createNiceControl();
       
View Full Code Here

                }
            }
        });

        try {
            done.acquire();
            return out.value;
        } catch (InterruptedException ie) {
            return false;
        }
    }
View Full Code Here

            final int permits = 2;
            final Semaphore semaphore = new Semaphore(permits);

            for (Runnable runnable : runnables) {
                try {
                    semaphore.acquire();
                    final Thread thread = new Thread();
                    thread.setDaemon(true);
                    thread.start();
                } catch (InterruptedException e) {
                    Thread.interrupted();
View Full Code Here

                } catch (InterruptedException e) {
                    Thread.interrupted();
                }
            }
            try {
                semaphore.acquire(permits);
            } catch (InterruptedException e) {
                Thread.interrupted();
            }
        }
    }
View Full Code Here

      int graceperiod = getGracePeriod(b);
      result = findBPCRef(b);
      if (result == null && graceperiod >= 0) {
        if (graceperiod == 0) { // Wait for an unlimited period
          try {
            s.acquire();
          } catch (InterruptedException ix) {}
        } else {
          try {
            s.tryAcquire(graceperiod, TimeUnit.MILLISECONDS);
          } catch (InterruptedException ix) {}
View Full Code Here

                    }
                }
            );
        }

        processedLatch.acquire(children.size());
    }

    private enum ProcessMessageBytesCode
    {
        NORMAL,
View Full Code Here

            cache = new PathChildrenCache(client, "/test", true)
            {
                @Override
                void getDataAndStat(String fullPath) throws Exception
                {
                    semaphore.acquire();
                    counter.incrementAndGet();
                    super.getDataAndStat(fullPath);
                    latch.countDown();
                }
            };
View Full Code Here

            cache.start();
            cache2.start();

            assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test");
            assertEvent(TreeCacheEvent.Type.INITIALIZED);
            semaphore.acquire(2);

            client.create().forPath("/test/one", "hey there".getBytes());
            assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/one");
            Assert.assertEquals(new String(cache.getCurrentData("/test/one").getData()), "hey there");
            semaphore.acquire();
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.