Package org.apache.curator.framework.recipes.locks

Examples of org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2


  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ZkDistributedSemaphore.class);

  final InterProcessSemaphoreV2 semaphore;

  public ZkDistributedSemaphore(CuratorFramework client, String path, int numberOfLeases) {
    this.semaphore = new InterProcessSemaphoreV2(client, path, numberOfLeases);
  }
View Full Code Here


    {
        try
        {
            CuratorEntry entry = CuratorEntry.mustGetEntry(connectionManager, projection);

            final InterProcessSemaphoreV2 semaphore = new InterProcessSemaphoreV2(entry.getClient(), path, maxLeases);
            final Collection<Lease> leases = semaphore.acquire(acquireQty, maxWaitMs, TimeUnit.MILLISECONDS);
            if ( leases == null )
            {
                return Lists.newArrayList();
            }

            List<LeaseProjection> leaseProjections = Lists.newArrayList();
            for ( final Lease lease : leases )
            {
                Closer closer = new Closer()
                {
                    @Override
                    public void close()
                    {
                        try
                        {
                            semaphore.returnLease(lease);
                        }
                        catch ( Exception e )
                        {
                            log.error("Could not release semaphore leases for path: " + path, e);
                        }
View Full Code Here

  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ZkDistributedSemaphore.class);

  final InterProcessSemaphoreV2 semaphore;

  public ZkDistributedSemaphore(CuratorFramework client, String path, int numberOfLeases) {
    this.semaphore = new InterProcessSemaphoreV2(client, path, numberOfLeases);
  }
View Full Code Here

TOP

Related Classes of org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2

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.