Examples of Cacheable


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

            System.out.println("memoryLeakTrace:Cache:" + name + " " + size());
        }
      }
    }

    Cacheable entry = addEntry(item, key, true, createParameter);
 
    if (SanityManager.DEBUG) {
      if (entry != null)
        SanityManager.ASSERT(item.getEntry() == entry);
    }
View Full Code Here

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

  */
  private Cacheable addEntry(CachedItem item, Object key, boolean forCreate, Object createParameter)
    throws StandardException {

    Cacheable entry = null;
        long origEntrySize = 0;
        if( useByteCount)
            origEntrySize = getItemSize( item);

    try
    {
      if (SanityManager.DEBUG) {
        if (SanityManager.DEBUG_ON(ClockFactory.CacheTrace))
        {
        SanityManager.DEBUG(ClockFactory.CacheTrace, name +
                  " item " + item + " take on identity " + key);
        }
      }
     
      // tell the object it needs to create itself
      entry = item.takeOnIdentity(this, holderFactory, key, forCreate, createParameter);
    }
    finally
    {
      boolean  notifyWaiters;
      synchronized (this) {

        Object removed = remove(key);
        if (SanityManager.DEBUG) {
          SanityManager.ASSERT(removed == item);
        }

        if (entry != null) {
          // put the actual key into the hash table, not the one that was passed in
          // for the find or create. This is because the caller may re-use the key
          // for another cache operation, which would corrupt our hashtable
          put(entry.getIdentity(), item);
                    if( useByteCount)
                        currentByteCount += ((SizedCacheable) entry).getSize() - origEntrySize;
          item.setValidState(true);
                    validItemCount++;
          notifyWaiters = true;
View Full Code Here

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

     * @param operator
     */
    public void scan( Matchable filter, Operator operator)
    {
        int itemCount = 1;
        Cacheable entry = null;
        CachedItem item = null;

        // Do not call the operator while holding the synchronization lock.
        // However we cannot access an item's links without holding the synchronization lock,
        // nor can we assume that an item is still in the cache unless we hold the synchronization
View Full Code Here

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

  public Cacheable takeOnIdentity(CacheManager cm, CacheableFactory holderFactory,
    Object key, boolean forCreate, Object createParameter)
    throws StandardException {

    // tell the object it needs to create itself
    Cacheable oldEntry = entry;
    if (oldEntry == null)
      oldEntry = holderFactory.newCacheable(cm);

    if (forCreate) {
      entry = oldEntry.createIdentity(key, createParameter);
    } else {
      entry = oldEntry.setIdentity(key);
    }

    if (entry != null) {
      // item was found or created
      if (SanityManager.DEBUG) {
View Full Code Here

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

    throws StandardException {

    if (statementCache == null)
      return;
      Cacheable cachedItem = statementCache.findCached(statement);
      if (cachedItem != null)
        statementCache.remove(cachedItem);
  }
View Full Code Here

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

    // 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

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

            getLanguageConnectionFactory().getStatementCache();

    if (statementCache == null)
      return;
      Cacheable cachedItem = statementCache.findCached(statement);
      if (cachedItem != null)
        statementCache.remove(cachedItem);
  }
View Full Code Here

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

    // 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

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

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

  }

    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
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.