Package EDU.oswego.cs.dl.util.concurrent

Examples of EDU.oswego.cs.dl.util.concurrent.Sync.acquire()


    public void remove(Object key)
    {
        Sync sync = this.lock.writeLock();
        try
        {
            sync.acquire();
            try
            {
                this.doRemove(key);
                m_sizeInstrument.setValue( doGetSize() );
            }
View Full Code Here


    public boolean containsKey(Object key)
    {
        Sync sync = this.lock.readLock();
        try
        {
            sync.acquire();
            try
            {
                return this.doContainsKey(key);
            }
            finally
View Full Code Here

    public Enumeration keys()
    {
        Sync sync = this.lock.readLock();
        try
        {
            sync.acquire();
            try
            {
                return this.doGetKeys();
            }
            finally
View Full Code Here

    public int size()
    {
        Sync sync = this.lock.readLock();
        try
        {
            sync.acquire();
            try
            {
                return this.doGetSize();
            }
            finally
View Full Code Here

                this.locks.put(file.getAbsolutePath(), lock);
            }
        }
        Sync sync = lock.writeLock();
        try {
            sync.acquire();
            try {
                OutputStream os = new FileOutputStream(file);
                os.write(content);
                os.flush();
                os.close();
View Full Code Here

                this.locks.put(file.getAbsolutePath(), lock);
            }
        }
        Sync sync = lock.readLock();
        try {
            sync.acquire();
            try {
                String content = IOUtils.deserializeString(file);
                return content.getBytes();
            } catch (IOException io) {
                this.getLogger().warn("Exception during reading of content from " + file, io);
View Full Code Here

        // - the current thread does not hold a write lock
        for (;;) {
            Sync signal;
            // make sure writer state does not change
            Sync shared = writerStateRWLock.readLock();
            shared.acquire();
            try {
                if (activeWriter == null
                        || !hasDependency(activeWriter.changes, id)) {
                    readLockMap.addLock(id);
                    return new ReadLockImpl(id);
View Full Code Here

            throws InterruptedException {
        for (;;) {
            Sync signal;
            // we want to become the current writer
            Sync exclusive = writerStateRWLock.writeLock();
            exclusive.acquire();
            try {
                if (activeWriter == null
                        && !readLockMap.hasDependency(changeLog)) {
                    activeWriter = new WriteLockImpl(changeLog);
                    activeWriterThread = Thread.currentThread();
View Full Code Here

        public void release() {
            Sync exclusive = writerStateRWLock.writeLock();
            for (;;) {
                try {
                    exclusive.acquire();
                    break;
                } catch (InterruptedException e) {
                    // try again
                    Thread.interrupted();
                }
View Full Code Here

        public ReadLock downgrade() {
            readLockMap.addLock(null);
            Sync exclusive = writerStateRWLock.writeLock();
            for (;;) {
                try {
                    exclusive.acquire();
                    break;
                } catch (InterruptedException e) {
                    // try again
                    Thread.interrupted();
                }
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.