Examples of SoftLock


Examples of org.hibernate.cache.access.SoftLock

          persister.getKeyType(),
          persister.getRole(),
          session.getEntityMode(),
          session.getFactory()
      );
      final SoftLock lock = persister.getCacheAccessStrategy().lockItem( ck, null );
      // the old behavior used key as opposed to getKey()
      afterTransactionProcess = new CacheCleanupProcess( key, persister, lock );
    }
  }
View Full Code Here

Examples of org.hibernate.cache.access.SoftLock

      final LoadEvent event,
      final EntityPersister persister,
      final EntityKey keyToLoad,
      final LoadEventListener.LoadType options,
      final SessionImplementor source) {
    SoftLock lock = null;
    final CacheKey ck;
    if ( persister.hasCache() ) {
      ck = new CacheKey(
          event.getEntityId(),
          persister.getIdentifierType(),
View Full Code Here

Examples of org.hibernate.cache.access.SoftLock

            if (LOG.isTraceEnabled()) LOG.trace("Locking "
                                                + MessageHelper.infoString(persister, entry.getId(), source.getFactory())
                                                + " in mode: " + requestedLockMode);

      final SoftLock lock;
      final CacheKey ck;
      if ( persister.hasCache() ) {
        ck = source.generateCacheKey( entry.getId(), persister.getIdentifierType(), persister.getRootEntityName() );
        lock = persister.getCacheAccessStrategy().lockItem( ck, entry.getVersion() );
      }
View Full Code Here

Examples of org.hibernate.cache.access.SoftLock

      final LoadEvent event,
      final EntityPersister persister,
      final EntityKey keyToLoad,
      final LoadEventListener.LoadType options,
      final SessionImplementor source) {
    SoftLock lock = null;
    final CacheKey ck;
    if ( persister.hasCache() ) {
      ck = source.generateCacheKey(
          event.getEntityId(),
          persister.getIdentifierType(),
View Full Code Here

Examples of org.hibernate.cache.access.SoftLock

    assertTrue( !ccs.put("foo", "foo", before, null, null, false) );

    // update it:

    SoftLock lock = ccs.lock("foo", null);

    assertTrue( ccs.get("foo", after)==null );
    assertTrue( ccs.get("foo", longBefore)==null );

    assertTrue( !ccs.put("foo", "foo", before, null, null, false) );

    Thread.sleep(15);

    long whileLocked = cache.nextTimestamp();

    assertTrue( !ccs.put("foo", "foo", whileLocked, null, null, false) );

    Thread.sleep(15);

    ccs.release("foo", lock);

    assertTrue( ccs.get("foo", after)==null );
    assertTrue( ccs.get("foo", longBefore)==null );

    assertTrue( !ccs.put("foo", "bar", whileLocked, null, null, false) );
    assertTrue( !ccs.put("foo", "bar", after, null, null, false) );

    Thread.sleep(15);

    long longAfter = cache.nextTimestamp();

    assertTrue( ccs.put("foo", "baz", longAfter, null, null, false) );

    assertTrue( ccs.get("foo", after)==null );
    assertTrue( ccs.get("foo", whileLocked)==null );

    Thread.sleep(15);

    long longLongAfter = cache.nextTimestamp();

    assertTrue( ccs.get("foo", longLongAfter).equals("baz") );

    // update it again, with multiple locks:

    SoftLock lock1 = ccs.lock("foo", null);
    SoftLock lock2 = ccs.lock("foo", null);

    assertTrue( ccs.get("foo", longLongAfter)==null );

    Thread.sleep(15);
View Full Code Here

Examples of org.hibernate.cache.access.SoftLock

    }

    public void unlock(final Object key, SoftLock lock) {
        final Value value = cache.get(key);
        if (value != null) {
            final SoftLock currentLock = value.getLock();
            if (currentLock == lock) {
                cache.replace(key, value, value.createUnlockedValue());
            }
        }
    }
View Full Code Here

Examples of org.hibernate.cache.access.SoftLock

      final LoadEvent event,
      final EntityPersister persister,
      final EntityKey keyToLoad,
      final LoadEventListener.LoadType options,
      final SessionImplementor source) {
    SoftLock lock = null;
    final CacheKey ck;
    if ( persister.hasCache() ) {
      ck = new CacheKey(
          event.getEntityId(),
          persister.getIdentifierType(),
View Full Code Here

Examples of org.hibernate.cache.access.SoftLock

      final LoadEvent event,
      final EntityPersister persister,
      final EntityKey keyToLoad,
      final LoadEventListener.LoadType options,
      final SessionImplementor source) {
    SoftLock lock = null;
    final CacheKey ck;
    if ( persister.hasCache() ) {
      ck = new CacheKey(
          event.getEntityId(),
          persister.getIdentifierType(),
View Full Code Here

Examples of org.hibernate.cache.spi.access.SoftLock

      final CacheKey ck = session.generateCacheKey(
          key,
          persister.getKeyType(),
          persister.getRole()
      );
      final SoftLock lock = persister.getCacheAccessStrategy().lockItem( ck, null );
      // the old behavior used key as opposed to getKey()
      afterTransactionProcess = new CacheCleanupProcess( key, persister, lock );
    }
  }
View Full Code Here

Examples of org.hibernate.cache.spi.access.SoftLock

      final LoadEvent event,
      final EntityPersister persister,
      final EntityKey keyToLoad,
      final LoadEventListener.LoadType options,
      final SessionImplementor source) {
    SoftLock lock = null;
    final CacheKey ck;
    if ( persister.hasCache() ) {
      ck = source.generateCacheKey(
          event.getEntityId(),
          persister.getIdentifierType(),
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.