Package org.apache.zookeeper.recipes.lock

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

Related Classes of org.apache.zookeeper.recipes.lock.WriteLock

Copyright © 2018 www.massapicom. 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.