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

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


        // - 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)) {
                    readerCount.incrementAndGet();
                    readLockMap.addLock(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);
                    activeWriterId = getCurrentThreadId();
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

            readerCount.incrementAndGet();
            readLockMap.addLock(null);
            Sync exclusive = writerStateRWLock.writeLock();
            for (;;) {
                try {
                    exclusive.acquire();
                    break;
                } catch (InterruptedException e) {
                    // try again
                    Thread.interrupted();
                }
View Full Code Here

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

    throws IOException, ClassNotFoundException
    {
        Sync sync = this.lock.writeLock();
        try
        {
            sync.acquire();
            try
            {
                final File file = this.fileFromKey(key);
                if (file != null) {
                    return this.deserializeObject(file);
View Full Code Here

    {
        Object value = null;
        Sync sync = this.lock.writeLock();
        try
        {
            sync.acquire();
            try
            {
                value = this.doGet(key);
            }
            finally
View Full Code Here

    throws IOException
    {
        Sync sync = this.lock.writeLock();
        try
        {
            sync.acquire();

            try
            {
                this.doStore(key, value);
                m_sizeInstrument.setValue( doGetSize() );
View Full Code Here

    public void free()
    {
        Sync sync = this.lock.writeLock();
        try
        {
            sync.acquire();

            try
            {
                this.doFree();
                m_sizeInstrument.setValue( doGetSize() );
View Full Code Here

        }

        Sync sync = this.lock.writeLock();
        try
        {
            sync.acquire();
            try
            {
                this.doClear();
                m_sizeInstrument.setValue( 0 );
            }
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.