Examples of tryLock()


Examples of java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock.tryLock()

   
    WriteLock writeLock = job.getTrunkLock().writeLock();
   
    try
    {
      if (writeLock.tryLock(10, TimeUnit.MINUTES))
      {
        try
        {
          Map<String, Map<String, Object>> jobResult = job.getJobResult();
          if (jobResult != null)
View Full Code Here

Examples of nallar.tickthreading.util.concurrent.SimpleMutex.tryLock()

  }

  @Override
  public boolean run() {
    SimpleMutex xPlusLock = this.xPlusLock;
    if (xPlusLock == null || xPlusLock.tryLock()) {
      try {
        SimpleMutex xMinusLock = this.xMinusLock;
        if (xMinusLock == null || xMinusLock.tryLock()) {
          try {
            SimpleMutex zPlusLock = this.zPlusLock;
View Full Code Here

Examples of net.sf.ehcache.concurrent.Sync.tryLock()

    private void tryRemoveImmediately(final Object key, final boolean notifyListeners) {
        Sync syncForKey = ((CacheLockProvider)getInternalContext()).getSyncForKey(key);
        boolean writeLocked = false;
        try {
            writeLocked = syncForKey.tryLock(LockType.WRITE, 0);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        } catch (Error e) {
            if (!(e.getClass().getName().equals("com.tc.exception.TCLockUpgradeNotSupportedError"))) {
               throw e;
View Full Code Here

Examples of net.sf.ehcache.transaction.SoftLock.tryLock()

            Object value = element.getObjectValue();
            if (value instanceof SoftLock) {
                SoftLock softLock = (SoftLock) value;
                try {
                    LOG.debug("cache {} key {} soft locked, awaiting unlock...", cache.getName(), key);
                    boolean gotLock = softLock.tryLock(timeLeft);
                    if (gotLock) {
                        softLock.clearTryLock();
                    }
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
View Full Code Here

Examples of org.apache.accumulo.core.zookeeper.ZooLock.tryLock()

  @Override
  public void run() throws Exception {
    String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/testLock";
    ZooSession.getSession().create(zPath, "".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
    ZooLock zl = new ZooLock(zPath);
    boolean gotLock = zl.tryLock(new LockWatcher() {
     
      @Override
      public void lostLock(LockLossReason reason) {
        System.exit(-1);
       
View Full Code Here

Examples of org.apache.accumulo.server.zookeeper.ZooLock.tryLock()

        }
      }
    };
   
    byte[] lockContent = new ServerServices(addressString, Service.TSERV_CLIENT).toString().getBytes(Constants.UTF8);
    if (zlock.tryLock(lw, lockContent)) {
      log.debug("Obtained tablet server lock " + zlock.getLockPath());
    }
    // modify !METADATA
    synchronized (tch) {
      while (!tch.halted) {
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterPerThreadPool.ThreadState.tryLock()

  }

  @Override
  public ThreadState getAndLock(Thread requestingThread, DocumentsWriter documentsWriter) {
    ThreadState threadState = threadBindings.get(requestingThread);
    if (threadState != null && threadState.tryLock()) {
      return threadState;
    }
    ThreadState minThreadState = null;

   
View Full Code Here

Examples of org.eclipse.orion.server.core.resources.FileLocker.tryLock()

    }
    long start = System.currentTimeMillis();
    FileLocker lock = new FileLocker(lockFile);
    int indexed = 0, userCount = 0, activeUserCount = 0;
    try {
      if (!lock.tryLock()) {
        if (logger.isInfoEnabled()) {
          logger.info("Search indexer: another process is currently indexing"); //$NON-NLS-1$
        }
        schedule(IDLE_DELAY);
        return Status.OK_STATUS;
View Full Code Here

Examples of org.h2.store.fs.FileObject.tryLock()

        assertEquals(20000, fo.getFilePointer());
        assertThrows(EOFException.class, fo).readFully(buffer, 0, 1);
        assertEquals(fsBase + "/test", fo.getName().replace('\\', '/'));
        assertEquals("test", fs.getFileName(fo.getName()));
        assertEquals(fsBase, fs.getParent(fo.getName()).replace('\\', '/'));
        fo.tryLock();
        fo.releaseLock();
        assertEquals(10000, fo.length());
        fo.close();
        assertEquals(10000, fs.length(fsBase + "/test"));
        fo = fs.openFileObject(fsBase + "/test", "r");
View Full Code Here

Examples of org.jboss.as.ejb3.tx.OwnableReentrantLock.tryLock()

            if (ROOT_LOGGER.isTraceEnabled()) {
                ROOT_LOGGER.trace("Trying to acquire lock: " + lock + " for stateful component instance: " + instance + " during invocation: " + context);
            }
            // we obtain a lock in this synchronization interceptor because the lock needs to be tied to the synchronization
            // so that it can released on the tx synchronization callbacks
            boolean acquired = lock.tryLock(timeout.getValue(), timeout.getTimeUnit());
            if (!acquired) {
                throw EjbLogger.ROOT_LOGGER.failToObtainLock(context, timeout.getValue(), timeout.getTimeUnit());
            }
            synchronized (threadLock) {
                if (ROOT_LOGGER.isTraceEnabled()) {
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.