|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.apama.correlator.memstore.AbstractStore
public abstract class AbstractStore
A named distributed 'store' instance, which is a factory for tables and typically encapsulates a connection to a single distributed cluster.
Not required to be thread-safe (this is handled by the owner object instead).
Constructor Summary | |
---|---|
AbstractStore(java.lang.String storeName)
Create a store. |
Method Summary | |
---|---|
void |
addClusterMembershipListener(ClusterMembershipListener listener)
Adds a new cluster membership listener callback. |
void |
close()
Disposes of all resources associated with this store, including shutting down background threads, terminating network connections, etc. |
abstract AbstractTable |
createTable(java.lang.String tableName,
java.lang.String[] schemaTypes,
java.lang.String[] schemaNames)
Creates a new table instance. |
void |
fireClusterMembersChanged(int newSize,
java.lang.String membershipDisplayInfo)
Notifies listeners that the membership of the cluster has changed. |
java.lang.String |
getName()
Returns the unique id representing this store, which is also the name by which it is referenced from EPL. |
abstract int |
getTotalClusterMembers()
Returns the total number of cluster members in this store. |
abstract void |
init()
Initialization method that is called by distributed MemoryStore just after construction. |
AbstractTable |
registerCloseHandlerForTable(AbstractTable table)
Utility method that registers a newly created AbstractTable instance with AbstractStore so that its close method is automatically called during the store's close method. |
void |
removeClusterMembershipListener(ClusterMembershipListener listener)
Removes an existing cluster membership listener callback. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractStore(java.lang.String storeName)
storeName
- the name of the store, as returned from getNameMethod Detail |
---|
public abstract void init() throws java.lang.Exception
This is always called after the createStore method on AbstractStoreFactory has been called.
Any exception thrown from this will cause the AbstractStore.close method to be called, so this is the most convenient place to put code such as registering callbacks that must be disposed of via the close method if an exception is thrown during initialization. Also post-construction operations such as adding callback listeners that reference the store object would not be safe to do from a constructor itself since the store is not fully constructed until after the constructor has returned.
This method is guaranteed to be called by distributed MemoryStore before createTable or any other method on this object.
If an exception is thrown by this method, then close()
will be called and then the prepare store
operation will fail.
java.lang.Exception
public abstract AbstractTable createTable(java.lang.String tableName, java.lang.String[] schemaTypes, java.lang.String[] schemaNames) throws DistMemStoreProviderException
Implementors may assume that the specified table name has not been created previously by this store.
tableName
- the unique name of the table to create within this storeschemaTypes
- the schemaTypes for that tables columnsschemaNames
- the column names represented in the table and in sync with the schemaTypes
DistMemStoreProviderException
public AbstractTable registerCloseHandlerForTable(AbstractTable table)
This method should usually be called at the end of an implementation of createTable(java.lang.String, java.lang.String[], java.lang.String[])
.
table
- the table whose close method is to be linked to this stores's close method
public void close()
Note that subclasses which override this method must call super.close() in their implementation.
public final java.lang.String getName()
public abstract int getTotalClusterMembers()
public final void fireClusterMembersChanged(int newSize, java.lang.String membershipDisplayInfo)
Subclasses are responsible for invoking this method at least once during startup to ensure an initial message is logged, and should also invoke it on subsequent membership changes.
This method will also write an INFO log message indicating the new size (and optionally, also a provider-specific string with information such as the list of new members).
newSize
- number of connected members now in the clustermembershipDisplayInfo
- an optional provider-specific display string with additional information about the old and/or new members, or nullpublic final void addClusterMembershipListener(ClusterMembershipListener listener)
This method exists for use by distributed MemoryStore, and in most cases does not need to be called by a driver implementation.
listener
- Object implementing the ClusterMembershipListener interface.public final void removeClusterMembershipListener(ClusterMembershipListener listener)
This method exists for use by distributed MemoryStore, and in most cases does not need to be called by a driver implementation.
listener
- Previously added callback object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |