|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ catalog overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.sql.catalog
Class SPSNameCacheable

java.lang.Objectorg.apache.derby.impl.sql.catalog.SPSNameCacheable
- All Implemented Interfaces:
- org.apache.derby.iapi.services.cache.Cacheable
- class SPSNameCacheable
- extends java.lang.Object
- implements org.apache.derby.iapi.services.cache.Cacheable
- extends java.lang.Object
This class implements a Cacheable for a DataDictionary cache of sps descriptors, with the lookup key being the name/schema of the sps. Assumes client passes in a string that includes the schema name.
The cache ensures that the class of the target sps is loaded if the sps is found in cache. This is ensured by calling loadGeneratedClass() on the sps when it is added to the cache. Each subsequent user of the sps cache will do its own load/unload on the class. Because the class manager/loader maintains reference counts on the classes it is handling, the user load/unload will just increment/decrement the use count. Only when the sps is uncached will it be unloaded.
| Field Summary | |
private DataDictionaryImpl |
dd
|
private TableKey |
identity
|
private org.apache.derby.iapi.sql.dictionary.SPSDescriptor |
spsd
|
| Constructor Summary | |
(package private) |
SPSNameCacheable(DataDictionaryImpl dd)
|
| Method Summary | |
private boolean |
checkConsistency(org.apache.derby.iapi.sql.dictionary.SPSDescriptor uncachedSpsd,
java.lang.Object identity,
org.apache.derby.iapi.services.stream.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. |
void |
clearIdentity()
Put the object into the No Identity state. |
org.apache.derby.iapi.services.cache.Cacheable |
createIdentity(java.lang.Object key,
java.lang.Object createParameter)
Create a new item. |
java.lang.Object |
getIdentity()
Get the identity of this object. |
org.apache.derby.iapi.sql.dictionary.SPSDescriptor |
getSPSDescriptor()
Get the sps descriptor that is associated with this Cacheable |
boolean |
isDirty()
Returns true of the object is dirty. |
org.apache.derby.iapi.services.cache.Cacheable |
setIdentity(java.lang.Object key)
Set the identity of the object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
identity
private TableKey identity
spsd
private org.apache.derby.iapi.sql.dictionary.SPSDescriptor spsd
dd
private final DataDictionaryImpl dd
| Constructor Detail |
SPSNameCacheable
SPSNameCacheable(DataDictionaryImpl dd)
| Method Detail |
clearIdentity
public void clearIdentity()
- Description copied from interface:
org.apache.derby.iapi.services.cache.Cacheable - Put the object into the No Identity state.
MT - single thread required - Method must only be called be cache manager and the cache manager will guarantee only one thread can be calling it.- Specified by:
clearIdentityin interfaceorg.apache.derby.iapi.services.cache.Cacheable
getIdentity
public java.lang.Object getIdentity()
- Description copied from interface:
org.apache.derby.iapi.services.cache.Cacheable - Get the identity of this object.
MT - thread safe.- Specified by:
getIdentityin interfaceorg.apache.derby.iapi.services.cache.Cacheable
createIdentity
public org.apache.derby.iapi.services.cache.Cacheable createIdentity(java.lang.Object key, java.lang.Object createParameter)
- Description copied from interface:
org.apache.derby.iapi.services.cache.Cacheable - Create a new item.
Create a new item and set the identity of the object to represent it. The object will be in the No Identity state, ie. it will have just been created or clearIdentity() was just called.
The object must copy the information out of key, not just store a reference to key if the key is not immutable. After this call the expression getIdentity().equals(key) must return true.
If the class of the object needs to change (e.g. to support a different format) then the object should create a new object, call its initParameter() with the parameters the original object was called with, set its identity and return a reference to it. The cache manager will discard the reference to the old object.
If an exception is thrown the object must be left in the no-identity state.
MT - single thread required - Method must only be called be cache manager and the cache manager will guarantee only one thread can be calling it.- Specified by:
createIdentityin interfaceorg.apache.derby.iapi.services.cache.Cacheable
setIdentity
public org.apache.derby.iapi.services.cache.Cacheable setIdentity(java.lang.Object key) throws org.apache.derby.iapi.error.StandardException
- Description copied from interface:
org.apache.derby.iapi.services.cache.Cacheable - Set the identity of the object.
Set the identity of the object to represent an item that already exists, e.g. an existing container. The object will be in the No Identity state, ie. it will have just been created or clearIdentity() was just called.
The object must copy the information out of key, not just store a reference to key. After this call the expression getIdentity().equals(key) must return true.
If the class of the object needs to change (e.g. to support a different format) then the object should create a new object, call its initParameter() with the parameters the original object was called with, set its identity and return a reference to it. The cache manager will discard the reference to the old object.
If an exception is thrown the object must be left in the no-identity state.
MT - single thread required - Method must only be called be cache manager and the cache manager will guarantee only one thread can be calling it.- Specified by:
setIdentityin interfaceorg.apache.derby.iapi.services.cache.Cacheable
clean
public void clean(boolean forRemove)
- Description copied from interface:
org.apache.derby.iapi.services.cache.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:
cleanin interfaceorg.apache.derby.iapi.services.cache.Cacheable
isDirty
public boolean isDirty()
- Description copied from interface:
org.apache.derby.iapi.services.cache.Cacheable - Returns true of the object is dirty.
May be called when the object is kept or unkept.
MT - thread safe- Specified by:
isDirtyin interfaceorg.apache.derby.iapi.services.cache.Cacheable
getSPSDescriptor
public org.apache.derby.iapi.sql.dictionary.SPSDescriptor getSPSDescriptor()
- Get the sps descriptor that is associated with this Cacheable
checkConsistency
private boolean checkConsistency(org.apache.derby.iapi.sql.dictionary.SPSDescriptor uncachedSpsd, java.lang.Object identity, org.apache.derby.iapi.services.stream.HeaderPrintWriter reportInconsistent) throws org.apache.derby.iapi.error.StandardException
- Check the consistency of the table descriptor held by this TDCacheable
versus an uncached table descriptor.
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> sql >> [ catalog overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.impl.sql.catalog.SPSNameCacheable