Package java.util.concurrent.locks

Examples of java.util.concurrent.locks.ReentrantLock


            lock.unlock();
        }
    }

    public void clear() {
        final ReentrantLock lock = this.lock;
        lock.lock();
        try {
            for (InternalQueue<E> intQueue : queues) {
                intQueue.clear();
            }
            count = 0;
        } finally {
            lock.unlock();
        }               
    }
View Full Code Here


        }               
    }

    @SuppressWarnings({"SuspiciousToArrayCall"})
    public <T> T[] toArray(T[] a) {
        final ReentrantLock lock = this.lock;
        lock.lock();
        try {
            List<E> list = new ArrayList<E>();
            for (InternalQueue<E> internalQueue : queues) {
                list.addAll(internalQueue);
            }
            return list.toArray(a);
        } finally {
            lock.unlock();
        }
    }
View Full Code Here

            lock.unlock();
        }
    }

    public Object[] toArray() {
        final ReentrantLock lock = this.lock;
        lock.lock();
        try {
            List<E> list = new ArrayList<E>();
            for (InternalQueue<E> internalQueue : queues) {
                list.addAll(internalQueue);
            }
            return list.toArray();
        } finally {
            lock.unlock();
        }
    }
View Full Code Here

    VmPipeSession(IoService service,
                      IoServiceListenerSupport serviceListeners,
                      VmPipeAddress localAddress, IoHandler handler, VmPipe remoteEntry) {
        this.service = service;
        this.serviceListeners = serviceListeners;
        lock = new ReentrantLock();
        this.localAddress = localAddress;
        remoteAddress = serviceAddress = remoteEntry.getAddress();
        this.handler = handler;
        filterChain = new VmPipeFilterChain(this);
        receivedMessageQueue = new LinkedBlockingQueue<Object>();
View Full Code Here

    //private volatile int nowaitCnt;
   
    public SharedInputBuffer(int buffersize,
                             final ByteBufferAllocator allocator) {
        super(buffersize, allocator);
        this.lock = new ReentrantLock();
        this.condition = this.lock.newCondition();
        //if the buffer become 3/4 empty, we'll turn on the input
        //events again to hopefully get more data before the next
        //the buffer fully empties and we have to wait to read
        this.requestInputSize = buffersize * 3 / 4;
View Full Code Here

    private ClientConnectionRequest connRequest;
    private ConnectionReleaseTrigger releaseTrigger;
   
    public HttpRequestBase() {
        super();
        this.abortLock = new ReentrantLock();
    }
View Full Code Here

    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        HttpRequestBase clone = (HttpRequestBase) super.clone();
        clone.abortLock = new ReentrantLock();
        clone.aborted = false;
        clone.releaseTrigger = null;
        clone.connRequest = null;
        clone.headergroup = (HeaderGroup) CloneUtils.clone(this.headergroup);
        clone.params = (HttpParams) CloneUtils.clone(this.params);
View Full Code Here

        expect(appDataRepository.getApplicationData(VALID_USER_ID, VALID_APPLICATION_ID)).andReturn(applicationData);
        Capture<ApplicationData> capturedApplicationData = new Capture<ApplicationData>();
        expect(appDataRepository.save(capture(capturedApplicationData))).andReturn(null);
        replay(appDataRepository);

        ReentrantLock lock = new ReentrantLock();
        expect(lockService.borrowLock(anyObject(String.class), anyObject(String.class))).andReturn(lock);
        lockService.returnLock(lock);
        replay(lockService);

        appDataService.deletePersonData(userId, groupId, VALID_APPLICATION_ID, fieldsToDelete, securityToken);
View Full Code Here

        replay(personService);

        expect(appDataRepository.getApplicationData(VALID_USER_ID, VALID_APPLICATION_ID)).andReturn(applicationData);
        replay(appDataRepository);

        ReentrantLock lock = new ReentrantLock();
        expect(lockService.borrowLock(anyObject(String.class), anyObject(String.class))).andReturn(lock);
        lockService.returnLock(lock);
        replay(lockService);

        Future<Void> result = appDataService.deletePersonData(userId, groupId, VALID_APPLICATION_ID, null, securityToken);
View Full Code Here

        expect(appDataRepository.getApplicationData(VALID_USER_ID, VALID_APPLICATION_ID)).andReturn(applicationData);
        Capture<ApplicationData> capturedApplicationData = new Capture<ApplicationData>();
        expect(appDataRepository.save(capture(capturedApplicationData))).andReturn(null);
        replay(appDataRepository);

        ReentrantLock lock = new ReentrantLock();
        expect(lockService.borrowLock(anyObject(String.class), anyObject(String.class))).andReturn(lock);
        lockService.returnLock(lock);
        replay(lockService);

        appDataService.updatePersonData(userId, groupId, VALID_APPLICATION_ID, fields, values, securityToken);
View Full Code Here

TOP

Related Classes of java.util.concurrent.locks.ReentrantLock

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.