org.apache.derby.impl.sql.catalog
Class TDCacheable

java.lang.Object
  extended byorg.apache.derby.impl.sql.catalog.TDCacheable
All Implemented Interfaces:
Cacheable
Direct Known Subclasses:
NameTDCacheable, OIDTDCacheable

abstract class TDCacheable
extends java.lang.Object
implements Cacheable

This class implements a Cacheable for a DataDictionary cache of table descriptors. It is an abstract class - there is more than one cache of table descriptors per data dictionary, and this class provides the implementation that's common to all of them. The lookup key for the cache (the "identity" of the cache item) is provided by the subclass. Another design alternative was to make the table descriptors themselves the cacheable objects. This was rejected because: we would have only one way of caching table descriptors, and we need at least two (by UUID and by name); the contents of a table descriptor would have to be split out into a separate class, so it could be used as the createParameter to the createIdentity() method; the releasing of the Cacheable would have to be done when at the end of compilation by traversing the tree - by creating a separate Cacheable object, we can release the object within the getTableDescriptor() method after getting the table descriptor out of it.


Field Summary
protected  DataDictionaryImpl dd
           
protected  TableDescriptor td
           
 
Constructor Summary
(package private) TDCacheable(DataDictionaryImpl dd)
           
 
Method Summary
protected  boolean checkConsistency(TableDescriptor uncachedTD, java.lang.Object identity, HeaderPrintWriter reportInconsistent)
          Check the consistency of the table descriptor held by this TDCacheable versus an uncached table descriptor.
 void clean(boolean forRemove)
          Clean the object.
 TableDescriptor getTableDescriptor()
          Get the table descriptor that is associated with this Cacheable
 boolean isDirty()
          Returns true of the object is dirty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.services.cache.Cacheable
clearIdentity, createIdentity, getIdentity, setIdentity
 

Field Detail

td

protected TableDescriptor td

dd

protected final DataDictionaryImpl dd
Constructor Detail

TDCacheable

TDCacheable(DataDictionaryImpl dd)
Method Detail

clean

public void clean(boolean forRemove)
Description copied from interface: Cacheable
Clean the object. It is up to the object to ensure synchronization of the isDirty() and clean() method calls.
If forRemove is true then the object is being removed due to an explict remove request, in this case the cache manager will have called this method regardless of the state of the isDirty()
If an exception is thrown the object must be left in the clean state.
MT - thread safe - Can be called at any time by the cache manager, it is the responsibility of the object implementing Cacheable to ensure any users of the object do not conflict with the clean call.

Specified by:
clean in interface Cacheable
See Also:
Cacheable.clean(boolean)

isDirty

public boolean isDirty()
Description copied from interface: Cacheable
Returns true of the object is dirty. May be called when the object is kept or unkept.
MT - thread safe

Specified by:
isDirty in interface Cacheable
See Also:
Cacheable.isDirty()

getTableDescriptor

public TableDescriptor getTableDescriptor()
Get the table descriptor that is associated with this Cacheable


checkConsistency

protected boolean checkConsistency(TableDescriptor uncachedTD,
                                   java.lang.Object identity,
                                   HeaderPrintWriter reportInconsistent)
                            throws StandardException
Check the consistency of the table descriptor held by this TDCacheable versus an uncached table descriptor.

Parameters:
uncachedTD - The uncached descriptor to compare to
identity - The identity of the table descriptor
reportInconsistent - A HeaderPrintWriter to send complaints to
Returns:
true if the descriptors are the same, false if they're different
Throws:
StandardException - Thrown on error

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.