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

pack-priv Class SPSNameCacheable

extends Object
implements Cacheable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.cache.Cacheable
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.cache.Cacheable, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.dictionary.SPSDescriptor

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

Modifier and TypeField and Description
private final DataDictionaryImpl
private TableKey
private SPSDescriptor

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
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 void
clearIdentity()

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

Put the object into the No Identity state.

public Cacheable
createIdentity(Object
The handle on the cacheable
key
,
Object
Creation details
createParameter
)

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

Create a new item.

public Object
getIdentity()

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

Get the identity of this object.

public SPSDescriptor
getSPSDescriptor()

Get the sps 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.

public Cacheable
setIdentity(Object
The handle on the cacheable
key
)

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

Set the identity of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ddback to summary
private final DataDictionaryImpl dd
identityback to summary
private TableKey identity
spsdback to summary
private SPSDescriptor spsd

Constructor Detail

SPSNameCacheableback to summary
pack-priv SPSNameCacheable(DataDictionaryImpl dd)

Method Detail

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
clearIdentityback to summary
public void clearIdentity()

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

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

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.

See Also
Cacheable#clearIdentity
createIdentityback to summary
public Cacheable createIdentity(Object key, Object createParameter)

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

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

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.

Parameters
key:Object

The handle on the cacheable

createParameter:Object

Creation details

Returns:Cacheable

an object reference if the object can take on the identity, null otherwise.

See Also
Cacheable#createIdentity
getIdentityback to summary
public Object getIdentity()

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

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

Get the identity of this object.
MT - thread safe.

Returns:Object

the object identity

See Also
Cacheable#getIdentity
getSPSDescriptorback to summary
public SPSDescriptor getSPSDescriptor()

Get the sps 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
setIdentityback to summary
public Cacheable setIdentity(Object key) throws StandardException

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

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

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.

Parameters
key:Object

The handle on the cacheable

Returns:Cacheable

an object reference if the object can take on the identity, null otherwise.

Exceptions
StandardException:
Thrown on error
See Also
Cacheable#setIdentity