Examples of ReentrantReadWriteLock


Examples of java.util.concurrent.locks.ReentrantReadWriteLock

  public FilePool(Configuration conf, Path input) throws IOException {
    root = null;
    this.conf = conf;
    this.path = input;
    this.fs = path.getFileSystem(conf);
    updateLock = new ReentrantReadWriteLock();
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

   */
  public ResizablePersistentIntBuffer(File f, int size) throws IOException {
    this.filename = f;
    isNew = !f.exists();
    this.raf = new RandomAccessFile(f, "rw");
    this.lock = new ReentrantReadWriteLock();
    this.size = size;
    buffer = new int[size];
    long expectedLength = ((long)size)*4;
    long realLength = raf.length();
    if(realLength > expectedLength)
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

  protected final int length;

  protected transient ReadWriteLock lock = new ReentrantReadWriteLock();
 
  public void init() {
    lock = new ReentrantReadWriteLock();
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

     *              will be towards newer values
     * @param clock the clock used to timestamp samples and track rescaling
     */
    public ExponentiallyDecayingReservoir(int size, double alpha, Clock clock) {
        this.values = new ConcurrentSkipListMap<Double, WeightedSample>();
        this.lock = new ReentrantReadWriteLock();
        this.alpha = alpha;
        this.size = size;
        this.clock = clock;
        this.count = new AtomicLong(0);
        this.startTime = currentTimeInSeconds();
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    for(int i = 0; i < NUM_TESTS; i++){
     
      new Thread(new Runnable(){
       
       
        private final ReadWriteLock rwl = new ReentrantReadWriteLock();

        @Override
        public void run() {
          Random rand= new Random();
          int min = 700, max = 10000;
          int randomNum = rand.nextInt(max - min + 1) + min;
        // try and throw threads of sequential access 
           try {
            Thread.sleep(randomNum);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
         
          Lock rl = rwl.writeLock();
          rl.lock();
          atom.incrementAndGet();
          rl.unlock();
         
          Lock wl = rwl.readLock();
          wl.lock();
          System.out.println("threadId "+threadId +"lockOblect state "+atom.get());
         
          wl.unlock();
          threadId++;
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    /**
     * {@inheritDoc}
     */
    public ReadWriteLock getRWLock()
    {
        return new ReentrantReadWriteLock();
    }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    this.user = user;
    this.appId = appId;
    this.credentials = credentials;
    this.aclsManager = context.getApplicationACLsManager();
    this.context = context;
    ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
    readLock = lock.readLock();
    writeLock = lock.writeLock();
    stateMachine = stateMachineFactory.make(this);
  }
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    this.committer = committer;
    this.newApiCommitter = newApiCommitter;

    this.taskAttemptListener = taskAttemptListener;
    this.eventHandler = eventHandler;
    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    this.readLock = readWriteLock.readLock();
    this.writeLock = readWriteLock.writeLock();

    this.jobCredentials = jobCredentials;
    this.jobTokenSecretManager = jobTokenSecretManager;

    this.aclsManager = new JobACLsManager(conf);
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

    // Initialize reportedStatus
    reportedStatus = new TaskAttemptStatus();
    initTaskAttemptStatus(reportedStatus);

    ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    readLock = readWriteLock.readLock();
    writeLock = readWriteLock.writeLock();

    this.credentials = credentials;
    this.jobToken = jobToken;
    this.eventHandler = eventHandler;
    this.jobFile = jobFile;
View Full Code Here

Examples of java.util.concurrent.locks.ReentrantReadWriteLock

        else
        {
            if ( rwLock == null )
            {
                // Create a ReadWrite lock from scratch
                rwLock = new ReentrantReadWriteLock();
            }
        }
    }
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.