Search in sources :

Example 1 with ISMLocking

use of org.apache.jackrabbit.core.state.ISMLocking in project jackrabbit by apache.

the class RepositoryImpl method createVersionManager.

/**
     * Creates the version manager.
     *
     * @param vConfig the versioning config
     * @return the newly created version manager
     * @throws RepositoryException if an error occurs
     */
protected InternalVersionManagerImpl createVersionManager(VersioningConfig vConfig, DelegatingObservationDispatcher delegatingDispatcher) throws RepositoryException {
    FileSystem fs = vConfig.getFileSystem();
    PersistenceManager pm = createPersistenceManager(vConfig.getHomeDir(), fs, vConfig.getPersistenceManagerConfig());
    ISMLocking ismLocking = vConfig.getISMLocking();
    return new InternalVersionManagerImpl(pm, fs, context.getNodeTypeRegistry(), delegatingDispatcher, SYSTEM_ROOT_NODE_ID, VERSION_STORAGE_NODE_ID, ACTIVITIES_NODE_ID, context.getItemStateCacheFactory(), ismLocking, context.getNodeIdFactory());
}
Also used : ISMLocking(org.apache.jackrabbit.core.state.ISMLocking) PersistenceManager(org.apache.jackrabbit.core.persistence.PersistenceManager) IterablePersistenceManager(org.apache.jackrabbit.core.persistence.IterablePersistenceManager) FileSystem(org.apache.jackrabbit.core.fs.FileSystem) InternalVersionManagerImpl(org.apache.jackrabbit.core.version.InternalVersionManagerImpl)

Example 2 with ISMLocking

use of org.apache.jackrabbit.core.state.ISMLocking in project jackrabbit by apache.

the class DefaultISMLockingDeadlockTest method test.

public void test() throws InterruptedException {
    final ISMLocking lock = new DefaultISMLocking();
    WriteLock w1 = lock.acquireWriteLock(null);
    ReadLock r1 = w1.downgrade();
    final InterruptedException[] ex = new InterruptedException[1];
    Thread thread = new Thread() {

        public void run() {
            try {
                lock.acquireWriteLock(null).release();
            } catch (InterruptedException e) {
                ex[0] = e;
            }
        }
    };
    thread.start();
    Thread.sleep(100);
    lock.acquireReadLock(null).release();
    r1.release();
    thread.join();
    if (ex[0] != null) {
        throw ex[0];
    }
}
Also used : ISMLocking(org.apache.jackrabbit.core.state.ISMLocking) DefaultISMLocking(org.apache.jackrabbit.core.state.DefaultISMLocking) ReadLock(org.apache.jackrabbit.core.state.ISMLocking.ReadLock) WriteLock(org.apache.jackrabbit.core.state.ISMLocking.WriteLock) DefaultISMLocking(org.apache.jackrabbit.core.state.DefaultISMLocking)

Aggregations

ISMLocking (org.apache.jackrabbit.core.state.ISMLocking)2 FileSystem (org.apache.jackrabbit.core.fs.FileSystem)1 IterablePersistenceManager (org.apache.jackrabbit.core.persistence.IterablePersistenceManager)1 PersistenceManager (org.apache.jackrabbit.core.persistence.PersistenceManager)1 DefaultISMLocking (org.apache.jackrabbit.core.state.DefaultISMLocking)1 ReadLock (org.apache.jackrabbit.core.state.ISMLocking.ReadLock)1 WriteLock (org.apache.jackrabbit.core.state.ISMLocking.WriteLock)1 InternalVersionManagerImpl (org.apache.jackrabbit.core.version.InternalVersionManagerImpl)1