Package org.apache.derby.iapi.services.cache

Examples of org.apache.derby.iapi.services.cache.Cacheable


   */
  private void removePermEntryInCache(PermissionsDescriptor perm)
    throws StandardException
  {
    // Remove cached permissions entry if present
    Cacheable cacheEntry = getPermissionsCache().findCached( perm);
    if (cacheEntry != null)
      getPermissionsCache().remove(cacheEntry);
  }
View Full Code Here


  }

    private Object getPermissions( PermissionsDescriptor key) throws StandardException
    {
        // RESOLVE get a READ COMMITTED (shared) lock on the permission row
        Cacheable entry = getPermissionsCache().find( key);
        if( entry == null)
            return null;
        Object perms = entry.getIdentity();
        getPermissionsCache().release( entry);
        return perms;
    }
View Full Code Here

            getLanguageConnectionFactory().getStatementCache();

        if (statementCache == null)
            return;
        Cacheable cachedItem = statementCache.findCached(statement);
        // No need to do anything if the statement is already removed
        if (cachedItem != null) {
            CachedStatement cs = (CachedStatement) cachedItem;
            if (statement.getPreparedStatement() != cs.getPreparedStatement()) {
                // DERBY-3786: Someone else has removed the statement from
View Full Code Here

        // statement caching disable when in DDL mode
        if (dataDictionaryInWriteMode()) {
            return null;
        }

        Cacheable cachedItem = statementCache.find(statement);

        CachedStatement cs = (CachedStatement) cachedItem;


        GenericPreparedStatement ps = cs.getPreparedStatement();
View Full Code Here

        }
    }

  public Cacheable createIdentity( Object key, Object createParameter ) throws StandardException
  {
        Cacheable cacheable = this;

        //
        // The createParameter arg is unused.
        //
        return cacheable.setIdentity( key );
  }
View Full Code Here

     *
     * @param key the identity of the entry to remove
     */
    private void removeEntry(Object key) {
        CacheEntry entry = cache.remove(key);
        Cacheable c = entry.getCacheable();
        if (c != null && c.getIdentity() != null) {
            // The cacheable should not have an identity when it has been
            // removed.
            c.clearIdentity();
        }
        entry.free();
    }
View Full Code Here

            // sure that it's also removed from the hash table.
            removeEntry(key);
            throw se;
        }

        Cacheable free = entry.getCacheable();

        if (free == null) {
            // We didn't get a reusable cacheable. Create a new one.
            free = holderFactory.newCacheable(this);
        }
View Full Code Here

            return null;
        }

        CacheEntry entry = getEntry(key);

        Cacheable item;
        try {
            item = entry.getCacheable();
            if (item != null) {
                // The object is already cached. Increase the use count and
                // return it.
                entry.keep(true);
                return item;
            } else {
                // The object is not cached. Insert the entry into a free
                // slot and retrieve a reusable Cacheable.
                item = insertIntoFreeSlot(key, entry);
            }
        } finally {
            entry.unlock();
        }

        // Set the identity without holding the lock on the entry. If we
        // hold the lock, we may run into a deadlock if the user code in
        // setIdentity() re-enters the buffer manager.
        Cacheable itemWithIdentity = null;
        try {
            itemWithIdentity = item.setIdentity(key);
        } finally {
            // Always invoke settingIdentityComplete(), also on error,
            // otherwise other threads may wait forever. If setIdentity()
View Full Code Here

            // for it to complete so that we don't return a cacheable that
            // isn't fully initialized.
            entry.waitUntilIdentityIsSet();
            // Return the cacheable. If the entry was removed right before we
            // locked it, getCacheable() returns null and so should we do.
            Cacheable item = entry.getCacheable();
            if (item != null) {
                entry.keep(true);
            }
            return item;
        } finally {
View Full Code Here

            // We can't create the object if it's already in the cache.
            throw StandardException.newException(
                    SQLState.OBJECT_EXISTS_IN_CACHE, name, key);
        }

        Cacheable item;
        try {
            item = insertIntoFreeSlot(key, entry);
        } finally {
            entry.unlock();
        }

        // Create the identity without holding the lock on the entry.
        // Otherwise, we may run into a deadlock if the user code in
        // createIdentity() re-enters the buffer manager.
        Cacheable itemWithIdentity = null;
        try {
            itemWithIdentity = item.createIdentity(key, createParameter);
        } finally {
            // Always invoke settingIdentityComplete(), also on error,
            // otherwise other threads may wait forever. If createIdentity()
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.services.cache.Cacheable

Copyright © 2018 www.massapicom. 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.