@Override public long nextTimestamp() { return regionFactory.nextTimestamp(); }
@Override public long nextTimestamp() { return regionFactory.nextTimestamp(); }
@Override public long nextTimestamp() { return regionFactory.nextTimestamp(); }
public AbstractCacheTransactionSynchronization(RegionFactory regionFactory) { // prime the timestamp for any non-transactional access - until (if) we // later join a new txn this.lastTransactionCompletionTimestamp = regionFactory.nextTimestamp(); this.regionFactory = regionFactory; }
@Override public final void transactionJoined() { // reset the timestamp this.lastTransactionCompletionTimestamp = regionFactory.nextTimestamp(); processTransactionJoin(); }
@SuppressWarnings("WeakerAccess") protected void decrementLock(SharedSessionContractImplementor session, Object key, SoftLockImpl lock) { lock.unlock( getRegion().getRegionFactory().nextTimestamp() ); getStorageAccess().putIntoCache( key, lock, session ); }
@Override public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value, Object version) { try { writeLock().lock(); Lockable item = (Lockable) getStorageAccess().getFromCache( key, session ); if ( item == null ) { getStorageAccess().putIntoCache( key, new Item( value, version, getRegion().getRegionFactory().nextTimestamp() ), session ); return true; } else { return false; } } finally { writeLock().unlock(); } }
@Override public boolean afterInsert(SharedSessionContractImplementor session, Object key, Object value) { try { writeLock().lock(); Lockable item = (Lockable) getStorageAccess().getFromCache( key, session ); if ( item == null ) { getStorageAccess().putIntoCache( key, new Item( value, null, getRegion().getRegionFactory().nextTimestamp() ), session ); return true; } else { return false; } } finally { writeLock().unlock(); } }
@SuppressWarnings("WeakerAccess") protected void handleLockExpiry(SharedSessionContractImplementor session, Object key, Lockable lock) { SecondLevelCacheLogger.INSTANCE.softLockedCacheExpired( getRegion().getName(), key ); log.info( "Cached entry expired : " + key ); // create new lock that times out immediately long ts = getRegion().getRegionFactory().nextTimestamp() + getRegion().getRegionFactory().getTimeout(); SoftLockImpl newLock = new SoftLockImpl( ts, uuid, nextLockId.getAndIncrement(), null ); //newLock.unlock( ts ); newLock.unlock( ts - getRegion().getRegionFactory().getTimeout() ); getStorageAccess().putIntoCache( key, newLock, session ); }
@Override public SoftLock lockItem(SharedSessionContractImplementor session, Object key, Object version) { try { writeLock.lock(); long timeout = getRegion().getRegionFactory().nextTimestamp() + getRegion().getRegionFactory().getTimeout(); log.debugf( "Locking cache item [region=`%s` (%s)] : `%s` (timeout=%s, version=%s)", getRegion().getName(), getAccessType(), key, timeout, version ); Lockable item = (Lockable) getStorageAccess().getFromCache( key, session ); final SoftLockImpl lock = ( item == null ) ? new SoftLockImpl( timeout, uuid, nextLockId(), version ) : item.lock( timeout, uuid, nextLockId() ); getStorageAccess().putIntoCache( key, lock, session ); return lock; } finally { writeLock.unlock(); } }
getStorageAccess().putIntoCache( key, new Item( value, null, getRegion().getRegionFactory().nextTimestamp() ), session );
getStorageAccess().putIntoCache( key, new Item( value, currentVersion, getRegion().getRegionFactory().nextTimestamp() ), session );
@Override public void invalidate( String[] spaces, SharedSessionContractImplementor session) { final boolean stats = session.getFactory().getStatistics().isStatisticsEnabled(); final Long ts = session.getFactory().getCache().getRegionFactory().nextTimestamp(); for (Serializable space : spaces) { if ( DEBUG_ENABLED ) { log.debugf( "Invalidating space [%s], timestamp: %s", space, ts ); } try { session.getEventListenerManager().cachePutStart(); timestampsRegion.putIntoCache( space, ts, session ); } finally { session.getEventListenerManager().cachePutEnd(); if ( stats ) { session.getFactory().getStatistics().updateTimestampsCachePut(); } } } }
@Override public void preInvalidate( String[] spaces, SharedSessionContractImplementor session) { final SessionFactoryImplementor factory = session.getFactory(); final RegionFactory regionFactory = factory.getCache().getRegionFactory(); final boolean stats = factory.getStatistics().isStatisticsEnabled(); final Long ts = regionFactory.nextTimestamp() + regionFactory.getTimeout(); for ( Serializable space : spaces ) { if ( DEBUG_ENABLED ) { log.debugf( "Pre-invalidating space [%s], timestamp: %s", space, ts ); } try { session.getEventListenerManager().cachePutStart(); //put() has nowait semantics, is this really appropriate? //note that it needs to be async replication, never local or sync timestampsRegion.putIntoCache( space, ts, session ); } finally { session.getEventListenerManager().cachePutEnd(); } if ( stats ) { factory.getStatistics().updateTimestampsCachePut(); } } }
public AbstractCacheTransactionSynchronization(RegionFactory regionFactory) { // prime the timestamp for any non-transactional access - until (if) we // later join a new txn this.lastTransactionCompletionTimestamp = regionFactory.nextTimestamp(); this.regionFactory = regionFactory; }
@Override public final void transactionJoined() { // reset the timestamp this.lastTransactionCompletionTimestamp = regionFactory.nextTimestamp(); processTransactionJoin(); }
@Override public Session openSession() { return new SessionImpl( connection, sessionFactory, getTransactionCoordinator(), autoJoinTransactions, sessionFactory.settings.getRegionFactory().nextTimestamp(), interceptor, flushBeforeCompletion, autoClose, connectionReleaseMode, tenantIdentifier ); }
@Override public Session openSession() { return new SessionImpl( connection, sessionFactory, getTransactionCoordinator(), autoJoinTransactions, sessionFactory.settings.getRegionFactory().nextTimestamp(), interceptor, flushBeforeCompletion, autoClose, connectionReleaseMode, tenantIdentifier ); }
@SuppressWarnings("WeakerAccess") protected void decrementLock(SharedSessionContractImplementor session, Object key, SoftLockImpl lock) { lock.unlock( getRegion().getRegionFactory().nextTimestamp() ); getStorageAccess().putIntoCache( key, lock, session ); }
@SuppressWarnings("WeakerAccess") protected void handleLockExpiry(SharedSessionContractImplementor session, Object key, Lockable lock) { SecondLevelCacheLogger.INSTANCE.softLockedCacheExpired( getRegion().getName(), key ); log.info( "Cached entry expired : " + key ); // create new lock that times out immediately long ts = getRegion().getRegionFactory().nextTimestamp() + getRegion().getRegionFactory().getTimeout(); SoftLockImpl newLock = new SoftLockImpl( ts, uuid, nextLockId.getAndIncrement(), null ); //newLock.unlock( ts ); newLock.unlock( ts - getRegion().getRegionFactory().getTimeout() ); getStorageAccess().putIntoCache( key, newLock, session ); }