Top Description Fields Constructors Methods
org.apache.derby.impl.sql.catalog

pack-priv abstract Class TDCacheable

extends Object
implements Cacheable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.cache.Cacheable
Known Direct Subclasses
org.apache.derby.impl.sql.catalog.NameTDCacheable, org.apache.derby.impl.sql.catalog.OIDTDCacheable
Imports
org.apache.derby.iapi.services.cache.Cacheable, .CacheManager, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.stream.HeaderPrintWriter, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.sql.dictionary.TableDescriptor

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

Modifier and TypeField and Description
protected final DataDictionaryImpl
protected TableDescriptor

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected boolean

Returns:

true if the descriptors are the same, false if they're different
checkConsistency
(TableDescriptor
The uncached descriptor to compare to
uncachedTD
,
Object
The identity of the table descriptor
identity
,
HeaderPrintWriter
A HeaderPrintWriter to send complaints to
reportInconsistent
)

Check the consistency of the table descriptor held by this TDCacheable versus an uncached table descriptor.

public void
clean(boolean
True if the object will be removed
forRemove
)

Implements org.apache.derby.iapi.services.cache.Cacheable.clean.

Clean the object.

public TableDescriptor
getTableDescriptor()

Get the table descriptor that is associated with this Cacheable

public boolean
isDirty()

Implements org.apache.derby.iapi.services.cache.Cacheable.isDirty.

Returns true if the object is dirty.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ddback to summary
protected final DataDictionaryImpl dd
tdback to summary
protected TableDescriptor td

Constructor Detail

TDCacheableback to summary
pack-priv TDCacheable(DataDictionaryImpl dd)

Method Detail

checkConsistencyback to summary
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:TableDescriptor

The uncached descriptor to compare to

identity:Object

The identity of the table descriptor

reportInconsistent:HeaderPrintWriter

A HeaderPrintWriter to send complaints to

Returns:boolean

true if the descriptors are the same, false if they're different

Exceptions
StandardException:
Thrown on error
cleanback to summary
public void clean(boolean forRemove)

Implements org.apache.derby.iapi.services.cache.Cacheable.clean.

Doc from org.apache.derby.iapi.services.cache.Cacheable.clean.

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.

Parameters
forRemove:boolean

True if the object will be removed

See Also
Cacheable#clean
getTableDescriptorback to summary
public TableDescriptor getTableDescriptor()

Get the table descriptor that is associated with this Cacheable

isDirtyback to summary
public boolean isDirty()

Implements org.apache.derby.iapi.services.cache.Cacheable.isDirty.

Doc from org.apache.derby.iapi.services.cache.Cacheable.isDirty.

Returns true if the object is dirty. May be called when the object is kept or unkept.
MT - thread safe

Returns:boolean

true if the object is dirty

See Also
Cacheable#isDirty