Examples of WriteLock


Examples of org.apache.jackrabbit.core.state.ISMLocking.WriteLock

     * @return write operation helper
     * @throws RepositoryException if the write operation could not be started
     */
    private WriteOperation startWriteOperation() throws RepositoryException {
        boolean success = false;
        WriteLock lock = acquireWriteLock();
        try {
            stateMgr.edit();
            success = true;
            return new WriteOperation(lock);
        } catch (IllegalStateException e) {
            throw new RepositoryException("Unable to start edit operation.", e);
        } finally {
            if (!success) {
                lock.release();
            }
        }
    }
View Full Code Here

Examples of org.apache.zookeeper.recipes.lock.WriteLock

    logger.debug("considert starting "+w);
    if (w.active==false){
      logger.debug(w.name + " is non active");
      return;
    }
    WriteLock l = null;
    try {
      l = new WriteLock(zk, "/ironcount/workloads/" + w.name,null);
      l.lock();
      List<String> children = zk.getChildren("/ironcount/workloads/" + w.name, false);
      if (children.size() <= w.maxWorkers){
        WorkerThread wt = new WorkerThread(this,w);
        this.executor.submit(wt);
        this.workerThreads.put(wt, new Object());
        logger.debug("Started worker thread "+wt+ " "+w);
      }
    } catch (KeeperException ex) {
      throw new RuntimeException(ex);
    }
    catch (InterruptedException ex) {
      throw new RuntimeException(ex);
    } catch (Throwable t){
      t.printStackTrace(System.err);
      logger.error(t);
      throw new RuntimeException (t);
    } finally {
      l.unlock();
    }
  }
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.