/** * Unlocks this workspace info. This is used (and only should be) by * the {@link XASessionImpl} in order to lock all internal resources * during a commit. */ void lockRelease() { xaLock.release(); }
/** * Unlocks this workspace info. This is used (and only should be) by * the {@link XASessionImpl} in order to lock all internal resources * during a commit. */ void lockRelease() { xaLock.release(); }
protected final void unlock() throws InterruptedException { m_mutex.release(); }
private final TokenMutexManager<Integer> myTokenManager = new TokenMutexManager<Integer>(); Mutex mutex = myTokenManager.getMutex(123456); synchronized(mutex) { // your code here } finally { mutex.release(); }
private final TokenMutexManager<String> myTokenManager = new TokenMutexManager<String>(); Mutex mutex = myTokenManager.getMutex("UUID_123456"); synchronized(mutex) { // your code here } finally { mutex.release(); }
/** * Synchronize contents from journal. * * @param startup indicates if the cluster node is syncing on startup * or does a normal sync. * @throws ClusterException if an error occurs */ private void internalSync(boolean startup) throws ClusterException { int count = syncCount.get(); try { syncLock.acquire(); } catch (InterruptedException e) { String msg = "Interrupted while waiting for mutex."; throw new ClusterException(msg); } try { // JCR-1753: Only synchronize if no other thread already did so // while we were waiting to acquire the syncLock. if (count == syncCount.get()) { syncCount.incrementAndGet(); journal.sync(startup); } } catch (JournalException e) { throw new ClusterException(e.getMessage(), e.getCause()); } finally { syncLock.release(); } }
/** * Synchronize contents from journal. * * @param startup indicates if the cluster node is syncing on startup * or does a normal sync. * @throws ClusterException if an error occurs */ private void internalSync(boolean startup) throws ClusterException { int count = syncCount.get(); try { syncLock.acquire(); } catch (InterruptedException e) { String msg = "Interrupted while waiting for mutex."; throw new ClusterException(msg); } try { // JCR-1753: Only synchronize if no other thread already did so // while we were waiting to acquire the syncLock. if (count == syncCount.get()) { syncCount.incrementAndGet(); journal.sync(startup); } } catch (JournalException e) { throw new ClusterException(e.getMessage(), e.getCause()); } finally { syncLock.release(); } }
public final void dispose() { try { m_mutex.acquire(); try { while( m_ready.size() > 0 ) { this.removePoolable( (Poolable)m_ready.remove() ); } } finally { m_mutex.release(); } } catch( Exception e ) { if( getLogger().isWarnEnabled() ) { getLogger().warn( "Caught an exception disposing of pool", e ); } } this.m_disposed = true; } }
public void grow( final int amount ) { try { m_mutex.acquire(); this.internalGrow( amount ); } catch( final InterruptedException ie ) { if( getLogger().isWarnEnabled() ) { getLogger().warn( "Interrupted while waiting on lock", ie ); } } catch( final Exception e ) { if( getLogger().isWarnEnabled() ) { getLogger().warn( "Could not grow the pool properly, an exception was caught", e ); } } finally { m_mutex.release(); } }
public void shrink( final int amount ) { try { m_mutex.acquire(); this.internalShrink( amount ); } catch( final InterruptedException ie ) { if( getLogger().isWarnEnabled() ) { getLogger().warn( "Interrupted while waiting on lock", ie ); } } catch( final Exception e ) { if( getLogger().isWarnEnabled() ) { getLogger().warn( "Could not shrink the pool properly, an exception was caught", e ); } } finally { m_mutex.release(); } } }