Top Description Fields Constructors Methods
org.apache.derby.impl.store.access

pack-priv Class CacheableConglomerate

extends Object
implements Cacheable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.cache.Cacheable
Imports
org.apache.derby.iapi.services.cache.Cacheable, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.conglomerate.Conglomerate, org.apache.derby.iapi.store.raw.ContainerKey

The CacheableConglomerate implements a single item in the cache used by the Conglomerate directory to cache Conglomerates. It is simply a wrapper object for the conglomid and Conglomerate object that is read from the Conglomerate Conglomerate. It is a wrapper rather than extending the conglomerate implementations because we want to cache all conglomerate implementations: (ie. Heap, B2I, ...). References to the Conglomerate objects cached by this wrapper will be handed out to callers. When this this object goes out of cache callers may still have references to the Conglomerate objects, which we are counting on java to garbage collect. The Conglomerate Objects never change after they are created.

Field Summary

Modifier and TypeField and Description
private final RAMAccessManager
private Conglomerate
private Long

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

Returns:

an object reference if the object can take on the identity, null otherwise.
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 and set the identity of the object to represent it.

protected Conglomerate
public Object
getIdentity()

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

Get the identity of this object.

public boolean
isDirty()

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

Returns true if the object is dirty.

public Cacheable

Returns:

an object reference if the object can take on the identity, null otherwise.
setIdentity
(Object
The handle on the cacheable
key
)

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

Set the identity of the object to represent an item that already exists, e.g. an existing container.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

accessManagerback to summary
private final RAMAccessManager accessManager
conglomback to summary
private Conglomerate conglom
conglomidback to summary
private Long conglomid

Constructor Detail

CacheableConglomerateback to summary
pack-priv CacheableConglomerate(RAMAccessManager parent)

Method Detail

cleanback to summary
public void clean(boolean forRemove) throws StandardException

Implements 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 explicit 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

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

True if the object will be removed

Exceptions
StandardException:
Standard Derby error policy.
clearIdentityback to summary
public void clearIdentity()

Implements 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.

createIdentityback to summary
public Cacheable createIdentity(Object key, Object createParameter) throws StandardException

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

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. 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

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

The handle on the cacheable

createParameter:Object

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

Creation details

Returns:Cacheable

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

Exceptions
StandardException:
If forCreate is true and the object cannot be created.
See Also
org.apache.derby.iapi.services.cache.CacheManager#create
getConglomback to summary
protected Conglomerate getConglom()
getIdentityback to summary
public Object getIdentity()

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

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

Returns:Object

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

the object identity

isDirtyback to summary
public boolean isDirty()

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

Returns true if the object is dirty. Will only be called when the object is unkept.
MT - thread safe

Returns:boolean

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

true if the object is dirty

setIdentityback to summary
public Cacheable setIdentity(Object key) throws StandardException

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

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 by cache manager and the cache manager will guarantee only one thread can be calling it.

Parameters
key:Object

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

The handle on the cacheable

Returns:Cacheable

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

Exceptions
StandardException:
Standard Derby Policy
See Also
org.apache.derby.iapi.services.cache.CacheManager#find