Package com.foreach.common.concurrent.locks.distributed

Examples of com.foreach.common.concurrent.locks.distributed.DistributedLock


      ExecutorService fixedThreadPool = Executors.newFixedThreadPool( 50 );

      List<Executor> executors = new ArrayList<>( LOCKS_PER_BATCH * EXECUTORS_PER_LOCK );

      for ( int i = 0; i < LOCKS_PER_BATCH; i++ ) {
        DistributedLock lock = distributedLockRepository.getLock( "batch-lock-" + i );

        for ( int j = 0; j < EXECUTORS_PER_LOCK; j++ ) {
          executors.add( new Executor( lock, 10 ) );
        }
      }
View Full Code Here


  public BootstrapLockManager( AcrossContextInfo contextInfo ) {
    this.contextInfo = contextInfo;
  }

  public void ensureLocked() {
    DistributedLock lock = loadLock();

    if ( !lock.isHeldByCurrentThread() ) {
      LOG.debug( "Acquiring Across bootstrap lock, owner id: {}", lock.getOwnerId() );

      long lockStartTime = System.currentTimeMillis();
      lock.lock();

      LOG.info( "Across bootstrap lock acquired by {} in {} ms", lock.getOwnerId(),
                System.currentTimeMillis() - lockStartTime );
    }
  }
View Full Code Here

TOP

Related Classes of com.foreach.common.concurrent.locks.distributed.DistributedLock

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.