Package org.exist.storage.lock

Examples of org.exist.storage.lock.Lock.acquire()


    public Value next() {
        Value nextValue = null;
        final Lock lock = db.getLock();
        try {
            try {
                lock.acquire(Lock.READ_LOCK);
            } catch (final LockException e) {
                LOG.error("Failed to acquire read lock on " + db.getFile().getName());
                //TODO : throw exception here ? -pb
                return null;
            }
View Full Code Here


        final Pattern p = Pattern.compile(regexp);
        final Matcher m = p.matcher("");

        final Lock lock = collectionsDb.getLock();
        try {
            lock.acquire(Lock.READ_LOCK);

            //TODO write a regexp lookup for key data in BTree.query
            //IndexQuery idxQuery = new IndexQuery(IndexQuery.REGEXP, regexp);
            //List<Value> keys = collectionsDb.findKeysByCollectionName(idxQuery);
            final List<Value> keys = collectionsDb.getKeys();
View Full Code Here

    }

    public void freeResourceId(int id) {
        final Lock lock = getLock();
        try {
            lock.acquire(Lock.WRITE_LOCK);

            freeResourceIds.push(id);
        } catch (LockException e) {
            LOG.warn("Failed to acquire lock on " + getFile().getName(), e);
        } finally {
View Full Code Here

    public int getFreeResourceId() {
        int freeDocId = DocumentImpl.UNKNOWN_DOCUMENT_ID;
        final Lock lock = getLock();
        try {
            lock.acquire(Lock.WRITE_LOCK);

            if (!freeResourceIds.isEmpty()) {
                freeDocId = freeResourceIds.pop();
            }
        } catch (final LockException e) {
View Full Code Here

    }

    public void freeCollectionId(int id) {
        final Lock lock = getLock();
        try {
            lock.acquire(Lock.WRITE_LOCK);

            freeCollectionIds.push(id);
        } catch (LockException e) {
            LOG.warn("Failed to acquire lock on " + getFile().getName(), e);
        } finally {
View Full Code Here

    public int getFreeCollectionId() {
        int freeCollectionId = Collection.UNKNOWN_COLLECTION_ID;
        final Lock lock = getLock();
        try {
            lock.acquire(Lock.WRITE_LOCK);

            if (!freeCollectionIds.isEmpty()) {
                freeCollectionId = freeCollectionIds.pop();
            }
        } catch (final LockException e) {
View Full Code Here

        synchronized(collectionsCache) {
            collection = collectionsCache.get(uri);
            if(collection == null) {
                final Lock lock = collectionsDb.getLock();
                try {
                    lock.acquire(Lock.READ_LOCK);

                    final Value key = new CollectionStore.CollectionKey(uri.toString());
                    final VariableByteInput is = collectionsDb.getAsStream(key);
                    if(is == null) {
                        LOG.warn("Could not read collection entry for: " + uri);
View Full Code Here

                System.console().printf("Unkown index: %s\n", id);
                return;
            }
            final Lock lock = btree.getLock();
            try {
                lock.acquire(Lock.WRITE_LOCK);

                System.console().printf("Rebuilding %15s ...", btree.getFile().getName());
                btree.rebuild();
                System.out.println("Done");
            } finally {
View Full Code Here

        synchronized(collectionsCache) {
            collection = collectionsCache.get(uri);
            if(collection == null) {
                final Lock lock = collectionsDb.getLock();
                try {
                    lock.acquire(Lock.READ_LOCK);
                    VariableByteInput is;
                    if(address == BFile.UNKNOWN_ADDRESS) {
                        final Value key = new CollectionStore.CollectionKey(uri.toString());
                        is = collectionsDb.getAsStream(key);
                    } else {
View Full Code Here

        final CollectionCache collectionsCache = pool.getCollectionsCache();
        synchronized(collectionsCache) {
            final Lock lock = collectionsDb.getLock();
            try {
                pool.getProcessMonitor().startJob(ProcessMonitor.ACTION_COPY_COLLECTION, collection.getURI());
                lock.acquire(Lock.WRITE_LOCK);

                final XmldbURI parentName = collection.getParentURI();
                final Collection parent = parentName == null ? collection : getCollection(parentName);

                final CollectionTrigger trigger = new CollectionTriggers(this, parent);
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.