com.neeve.ods
Class StoreObjectBase

java.lang.Object
  extended by com.neeve.ods.StoreObjectBase
All Implemented Interfaces:
IStoreObject, com.neeve.util.UtlReferenceTracker.HasReferenceTracker

public abstract class StoreObjectBase
extends Object
implements IStoreObject

A base class for store object implementations.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.neeve.ods.IStoreObject
IStoreObject.EncodingType
 
Method Summary
 void acquire()
          Implementation of IStoreObject.acquire()
 int dispose()
          Default implementation of IStoreObject.dispose() This is the default implementation of the dispose method.
 com.eaio.uuid.UUID ensureId()
          Instructs the object to generate a UUID if not already generated.
 IStoreBinding getBinding()
          Get the store binding associated with an object.
 long getCheckpointVersion()
          Get an object's checkpoint version.
 com.eaio.uuid.UUID getId()
          Implementation of IStoreObject.getId()
 int getOwnershipCount()
          Implementation of MessageView.getOwnershipCount()
 long getStableTransactionId()
          Gets the transactionId considered stabilized by the application.
 long getTransactionId()
          Get the application transaction id.
 com.neeve.util.UtlReferenceTracker referenceTracker()
          Implementation of MessageView.getOwnershipCount()
 IStoreObject setBinding(IStoreBinding binding)
          Set the store binding associated with an object.
 void setCheckpointVersion(long version)
          Update checkpoint version of an object
 void setId(com.eaio.uuid.UUID id)
          Set an object'd id.
 IStoreObject setStableTransactionId(long id)
          Set the the transactionId considered stabilized by the application.
 IStoreObject setTransactionId(long txnid)
          Set the application transaction id.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.neeve.ods.IStoreObject
deserialize, deserializeMetadata, deserializeMetadata, getContentEncodingType, getOfid, getType, serialize, serializeMetadata, setFieldValue
 

Method Detail

setId

public final void setId(com.eaio.uuid.UUID id)
Description copied from interface: IStoreObject
Set an object'd id. Each ODS store object is universally identified by a UUID. This method sets an object's id.

Note: This method may copy the uuid into a preallocated uuid instance in the interest of reducing garbage collection, so the caller should not rely on the instance subsequently returned from IStoreObject.getId() to be the same instance, just an equivalent one.

Specified by:
setId in interface IStoreObject

ensureId

public final com.eaio.uuid.UUID ensureId()
Description copied from interface: IStoreObject
Instructs the object to generate a UUID if not already generated. After this call a call to IStoreObject.getId() must return a non null value;

NOTE:
If this object is pooled, the validity of the returned UUID is only valid while the object remains undisposed (see IStoreObject.dispose(). Once the object is returned to its pool the UUID may be wiped and reused. Consequently, callers that plan to use the returned id beyond this objects lifespan should either make a copy of it, or aquire this object to prevent it from be returned to its pool.

Specified by:
ensureId in interface IStoreObject
Returns:
the object's id.

getId

public final com.eaio.uuid.UUID getId()
Implementation of IStoreObject.getId()

Specified by:
getId in interface IStoreObject

setTransactionId

public final IStoreObject setTransactionId(long txnid)
Description copied from interface: IStoreObject
Set the application transaction id.

Specified by:
setTransactionId in interface IStoreObject
Parameters:
txnid - The transaction id to set

getTransactionId

public final long getTransactionId()
Description copied from interface: IStoreObject
Get the application transaction id.

Specified by:
getTransactionId in interface IStoreObject

setStableTransactionId

public final IStoreObject setStableTransactionId(long id)
Description copied from interface: IStoreObject
Set the the transactionId considered stabilized by the application.

Specified by:
setStableTransactionId in interface IStoreObject
Parameters:
id - The stable transaction id to set

getStableTransactionId

public final long getStableTransactionId()
Description copied from interface: IStoreObject
Gets the transactionId considered stabilized by the application.

Specified by:
getStableTransactionId in interface IStoreObject
Returns:
the stable application transaction id.

setBinding

public final IStoreObject setBinding(IStoreBinding binding)
Description copied from interface: IStoreObject
Set the store binding associated with an object.

Specified by:
setBinding in interface IStoreObject
Returns:
Returns this object for invocation chaining.

An object can be stored by one and only one store binding at any point in time. This method sets the binding associated with an object. The binding invokes this method when an object is put and removed from the store.


getBinding

public final IStoreBinding getBinding()
Description copied from interface: IStoreObject
Get the store binding associated with an object.

Specified by:
getBinding in interface IStoreObject

getOwnershipCount

public final int getOwnershipCount()
Implementation of MessageView.getOwnershipCount()

Specified by:
getOwnershipCount in interface IStoreObject

acquire

public final void acquire()
Implementation of IStoreObject.acquire()

Specified by:
acquire in interface IStoreObject

dispose

public int dispose()
Default implementation of IStoreObject.dispose()

This is the default implementation of the dispose method. The implementation just decrements the ownership count. Implementations that implement view object pooling or other such functionality should override this method but invoke this method to decrement the object reference count.

Specified by:
dispose in interface IStoreObject
Returns:
The reference count after the dispose completed.

referenceTracker

public final com.neeve.util.UtlReferenceTracker referenceTracker()
Implementation of MessageView.getOwnershipCount()

Specified by:
referenceTracker in interface com.neeve.util.UtlReferenceTracker.HasReferenceTracker

setCheckpointVersion

public final void setCheckpointVersion(long version)
Description copied from interface: IStoreObject
Update checkpoint version of an object

Specified by:
setCheckpointVersion in interface IStoreObject
Parameters:
version - The new checkpoint version.
See Also:

Note: May only be called by an {@link IStoreBinding} to update the checkpoint version of the object.


getCheckpointVersion

public final long getCheckpointVersion()
Description copied from interface: IStoreObject
Get an object's checkpoint version.

When an IStoreObject is added to a store or mutated its checkpoint modification counter is set to its IStoreBinding's next checkpoint number. This field can be used to perform 'change data capture' or CDC on stores that are checkpointed to see if a node has changed since a given store checkpoint.

When an object is removed for a store the store must set the checkpoint version of the object back to -1.

Specified by:
getCheckpointVersion in interface IStoreObject
Returns:
The last checkpoint modification for the node.


Copyright © 2015 Neeve Research, LLC. All Rights Reserved.