|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.server.cluster.StoreManager
public abstract class StoreManager
Base class for distributed stores.
| Field Summary | |
|---|---|
protected LruCache<java.lang.String,ClusterObject> |
_clusterObjects
|
protected long |
_idleCheckInterval
|
protected boolean |
_isAlwaysLoad
|
protected boolean |
_isAlwaysSave
|
protected long |
_loadCount
|
protected long |
_loadFailCount
|
protected long |
_maxIdleTime
|
protected long |
_saveCount
|
protected long |
_saveFailCount
|
protected int |
_selfIndex
|
protected java.util.HashMap<java.lang.String,Store> |
_storeMap
|
protected static java.util.logging.Logger |
log
|
| Constructor Summary | |
|---|---|
protected |
StoreManager()
|
| Method Summary | |
|---|---|
void |
access(Store store,
java.lang.String id)
Updates the object's access time. |
void |
access(java.lang.String uniqueId)
Updates the object's access time. |
abstract void |
accessImpl(java.lang.String uniqueId)
Updates the object's access time in the persistent store. |
void |
classLoaderDestroy(DynamicClassLoader loader)
Handles the case where the environment loader is dropped. |
void |
classLoaderInit(DynamicClassLoader loader)
Handles the case where the environment is activated. |
void |
clearOldObjects()
Cleans old objects. |
Store |
createStore(java.lang.String storeId,
ObjectManager objectManager)
Creates a Store. |
void |
destroy()
Called at end of life. |
void |
environmentStart(EnvironmentClassLoader loader)
Handles the case where the environment is activated. |
void |
environmentStop(EnvironmentClassLoader loader)
Handles the case where the environment loader is stops |
long |
getAccessWindowTime()
Returns the length of time an idle object can remain in the store before being cleaned. |
PersistentStoreMXBean |
getAdmin()
Returns the admin. |
Cluster |
getCluster()
Gets the cluster. |
long |
getIdleCheckTime()
Sets the idle check interval for the alarm. |
long |
getLoadCount()
Returns the total objects loaded. |
long |
getLoadFailCount()
Returns the objects which failed to load. |
long |
getMaxIdleTime()
Returns the length of time an idle object can remain in the store before being cleaned. |
long |
getObjectCount()
Returns the objects in the store |
protected ServerConnector |
getOwningServer(java.lang.String objectId)
Returns the cluster server which owns the object |
int |
getPrimaryIndex(java.lang.String id,
int offset)
Returns the owning index. |
long |
getSaveCount()
Returns the total objects saved. |
long |
getSaveFailCount()
Returns the objects which failed to save. |
int |
getSecondaryIndex(java.lang.String id,
int offset)
Returns the backup index. |
protected int |
getSelfIndex()
Returns the self servers. |
protected ServerConnector[] |
getServerList()
Returns the list of cluster servers. |
Store |
getStore(java.lang.String storeId)
Creates a ClusterObjectManager. |
int |
getTertiaryIndex(java.lang.String id,
int offset)
Returns the backup index. |
void |
handleAlarm(Alarm alarm)
Handles a callback from an alarm, scheduling the timeout. |
boolean |
init()
Called after any factory settings. |
boolean |
isAlwaysLoad()
Set true if the store should always try to load the object. |
boolean |
isAlwaysSave()
Set true if the store should always try to store the object. |
protected boolean |
isPrimary(java.lang.String id)
Returns true if this server is a primary for the given object id. |
protected abstract boolean |
load(ClusterObject clusterObject,
java.lang.Object obj)
Loads object access time. |
void |
remove(ClusterObject obj)
When the object is no longer valid, remove it from the backing store. |
void |
remove(Store store,
java.lang.String objectId)
When the object is no longer valid, remove it from the backing store. |
Store |
removeStore(java.lang.String storeId)
Removes a Store. |
void |
setAlwaysLoad(boolean alwaysLoad)
Set true if the store should always try to load the object. |
void |
setAlwaysSave(boolean alwaysSave)
Set true if the store should always try to store the object. |
void |
setCluster(Cluster cluster)
Sets the cluster. |
void |
setExpireInterval(java.lang.String uniqueId,
long expires)
Sets the timef for the expires interval. |
void |
setMaxIdleTime(Period maxIdleTime)
Sets the length of time an idle object can remain in the store before being cleaned. |
boolean |
start()
Called to start the store. |
protected abstract void |
store(ClusterObject clusterObject,
TempStream tempStream,
long crc)
Save the object to the store. |
void |
store(Store store,
java.lang.String id,
java.lang.Object obj)
Saves the object to the cluster. |
void |
update(java.lang.String storeId,
java.lang.String objectId)
When the object is no longer valid, remove it from the backing store. |
void |
updateIdleCheckInterval(long idleCheckInterval)
Sets the idle check interval for the alarm. |
void |
updateOwner(java.lang.String objectId,
java.lang.String uniqueId)
Updates the owner object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.logging.Logger log
protected int _selfIndex
protected long _maxIdleTime
protected long _idleCheckInterval
protected boolean _isAlwaysLoad
protected boolean _isAlwaysSave
protected java.util.HashMap<java.lang.String,Store> _storeMap
protected LruCache<java.lang.String,ClusterObject> _clusterObjects
protected volatile long _loadCount
protected volatile long _loadFailCount
protected volatile long _saveCount
protected volatile long _saveFailCount
| Constructor Detail |
|---|
protected StoreManager()
| Method Detail |
|---|
public void setCluster(Cluster cluster)
public Cluster getCluster()
public PersistentStoreMXBean getAdmin()
public void setAlwaysLoad(boolean alwaysLoad)
public boolean isAlwaysLoad()
public void setAlwaysSave(boolean alwaysSave)
public boolean isAlwaysSave()
public long getMaxIdleTime()
public void setMaxIdleTime(Period maxIdleTime)
public void updateIdleCheckInterval(long idleCheckInterval)
public long getIdleCheckTime()
public long getAccessWindowTime()
public long getObjectCount()
public long getLoadCount()
public long getLoadFailCount()
public long getSaveCount()
public long getSaveFailCount()
public Store createStore(java.lang.String storeId,
ObjectManager objectManager)
storeId - the persistent domain.public Store removeStore(java.lang.String storeId)
storeId - the persistent domain.public Store getStore(java.lang.String storeId)
storeId - the persistent domain.
public boolean init()
throws java.lang.Exception
java.lang.Exception
public boolean start()
throws java.lang.Exception
java.lang.Exception
public void clearOldObjects()
throws java.lang.Exception
java.lang.Exceptionprotected boolean isPrimary(java.lang.String id)
public int getPrimaryIndex(java.lang.String id,
int offset)
public int getSecondaryIndex(java.lang.String id,
int offset)
public int getTertiaryIndex(java.lang.String id,
int offset)
protected abstract boolean load(ClusterObject clusterObject,
java.lang.Object obj)
throws java.lang.Exception
obj - the object to update.
java.lang.Exception
public void access(java.lang.String uniqueId)
throws java.lang.Exception
storeId - the identifier of the storage groupobj - the object to update.
java.lang.Exception
public void access(Store store,
java.lang.String id)
throws java.lang.Exception
storeId - the identifier of the storage groupobj - the object to update.
java.lang.Exception
public abstract void accessImpl(java.lang.String uniqueId)
throws java.lang.Exception
uniqueId - the identifier of the object.
java.lang.Exception
public void setExpireInterval(java.lang.String uniqueId,
long expires)
throws java.lang.Exception
uniqueId - the identifier of the object.long - the time in ms for the expire
java.lang.Exception
public void update(java.lang.String storeId,
java.lang.String objectId)
throws java.lang.Exception
storeId - the identifier of the storeage groupobjectId - the identifier of the object to remove
java.lang.Exception
public void updateOwner(java.lang.String objectId,
java.lang.String uniqueId)
throws java.lang.Exception
uniqueId - the identifier of the storage group
java.lang.Exception
public void store(Store store,
java.lang.String id,
java.lang.Object obj)
throws java.io.IOException
storeId - the identifier of the storage groupobj - the object to store.
java.io.IOException
protected abstract void store(ClusterObject clusterObject,
TempStream tempStream,
long crc)
throws java.lang.Exception
storeId - the identifier of the storage groupobj - the object to store.
java.lang.Exceptionpublic void handleAlarm(Alarm alarm)
handleAlarm in interface AlarmListener
public void remove(ClusterObject obj)
throws java.lang.Exception
obj - the object to remove
java.lang.Exception
public void remove(Store store,
java.lang.String objectId)
throws java.lang.Exception
store - the identifier of the storeage groupobjectId - the identifier of the object to remove
java.lang.Exceptionprotected int getSelfIndex()
protected ServerConnector[] getServerList()
protected ServerConnector getOwningServer(java.lang.String objectId)
public void environmentStart(EnvironmentClassLoader loader)
environmentStart in interface EnvironmentListenerpublic void environmentStop(EnvironmentClassLoader loader)
environmentStop in interface EnvironmentListenerpublic void classLoaderInit(DynamicClassLoader loader)
classLoaderInit in interface ClassLoaderListenerpublic void classLoaderDestroy(DynamicClassLoader loader)
classLoaderDestroy in interface ClassLoaderListenerpublic void destroy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||