Examples of acquire()


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

        }
        corpusReader.close();

        // Wait until all the documents have been processed
        try {
            documentsRerocessed.acquire(numDocuments);
        } catch (InterruptedException ie) {
            throw new Error("interrupted while waiting for documents to " +
                            "finish reprocessing", ie);
        }       
        LOGGER.fine("finished reprocessing all documents");
View Full Code Here

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

               if (executorService != null)
               {
                  try
                  {
                     taskSepaphore.acquire();
                     executorService.execute(task);
                  }
                  catch (RejectedExecutionException e)
                  {
                     // this may happen because of a race condition between the
View Full Code Here

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

Examples of net.sf.ehcache.concurrent.Mutex.acquire()

     */
    public Element get(final Object key) throws RuntimeException, LockTimeoutException {
        Mutex lock = getLockForKey(key);
        try {
            if (timeoutMillis == 0) {
                lock.acquire();
            } else {
                boolean acquired = lock.attempt(timeoutMillis);
                if (!acquired) {
                    StringBuffer message = new StringBuffer("Lock timeout. Waited more than ")
                            .append(timeoutMillis)
View Full Code Here

Examples of net.sf.ehcache.constructs.concurrent.Mutex.acquire()

            if (element == null) {
                element = super.get(key);
            } else {
                Mutex lock = getLockForKey(key);
                try {
                    lock.acquire();
                    update(key);
                } finally {
                    lock.release();
                }
            }
View Full Code Here

Examples of oracle.toplink.essentials.internal.helper.ConcurrencyManager.acquire()

            if (manager == null) {
                manager = new ConcurrencyManager();
                getLocks().put(seqName, manager);
            }
        }
        manager.acquire();
    }

    protected void releaseLock(String seqName) {
        ConcurrencyManager manager = (ConcurrencyManager)locks.get(seqName);
        manager.release();
View Full Code Here

Examples of org.apache.commons.lang3.concurrent.TimedSemaphore.acquire()

     */
    @Test(expected = IllegalStateException.class)
    public void testPassAfterShutdown() throws InterruptedException {
        TimedSemaphore semaphore = new TimedSemaphore(PERIOD, UNIT, LIMIT);
        semaphore.shutdown();
        semaphore.acquire();
    }

    /**
     * Tests a bigger number of invocations that span multiple periods. The
     * period is set to a very short time. A background thread calls the
View Full Code Here

Examples of org.apache.commons.transaction.locking.GenericLock.acquire()

                      + uri
                      + (owner != null ? " ---> "
                          + owner.toString()
                          + " has it" : ""),
                  LOG_CHANNEL, Logger.DEBUG);
          if (!lock.acquire(txId, 1, true, true, timeout)) {
            throw new ServiceAccessException(this,
                new ConflictException(uri));
          }
          ((HashSet) locks.get()).add(lock);
          getLogger().log("Has lock: " + txId + " locks " + uri,
View Full Code Here

Examples of org.apache.commons.transaction.locking.MultiLevelLock.acquire()

        DeployedLayout layout = getDeployedLayout(tmlLib, ref);
        if (layout == null) {
            MultiLevelLock lock = _lockManager.atomicGetOrCreateLock(ref.toString());
            try {
                try {
                    lock.acquire(Thread.currentThread(), 1,  true, true, Long.MAX_VALUE);
                }
                catch (InterruptedException e) {
                }
               
                layout = getDeployedLayout(tmlLib, ref);
View Full Code Here

Examples of org.apache.curator.framework.recipes.locks.InterProcessMutex.acquire()

    @Override
    public Object lockRoot(int id) {
        try {
            final InterProcessMutex mutex = new InterProcessMutex(client, ROOT_LOCKS + '/' + id);
            mutex.acquire();
            return mutex;
        } catch (Exception ex) {
            throw Throwables.propagate(ex);
        }
    }
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.