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());
}
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];
}
}
Aggregations