Class TDCacheable
java.lang.Object
org.apache.derby.impl.sql.catalog.TDCacheable
- All Implemented Interfaces:
Cacheable
- Direct Known Subclasses:
NameTDCacheable, OIDTDCacheable
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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckConsistency(TableDescriptor uncachedTD, Object identity, HeaderPrintWriter reportInconsistent) Check the consistency of the table descriptor held by this TDCacheable versus an uncached table descriptor.voidclean(boolean forRemove) Clean the object.Get the table descriptor that is associated with this CacheablebooleanisDirty()Returns true of the object is dirty.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Cacheable
clearIdentity, createIdentity, getIdentity, setIdentity
-
Field Details
-
td
-
dd
-
-
Constructor Details
-
TDCacheable
TDCacheable(DataDictionaryImpl dd)
-
-
Method Details
-
clean
public void clean(boolean forRemove) Description copied from interface:CacheableClean 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. -
isDirty
-
getTableDescriptor
Get the table descriptor that is associated with this Cacheable -
checkConsistency
protected boolean checkConsistency(TableDescriptor uncachedTD, 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 toidentity- The identity of the table descriptorreportInconsistent- A HeaderPrintWriter to send complaints to- Returns:
- true if the descriptors are the same, false if they're different
- Throws:
StandardException- Thrown on error
-