com.caucho.server.cluster
Class ClusterStoreManager

java.lang.Object
  extended by com.caucho.server.cluster.StoreManager
      extended by com.caucho.server.cluster.AbstractClusterStoreManager
          extended by com.caucho.server.cluster.ClusterStoreManager
All Implemented Interfaces:
ClassLoaderListener, EnvironmentListener, AlarmListener, java.util.EventListener

public class ClusterStoreManager
extends AbstractClusterStoreManager

The ClusterStoreManager manages a cluster of servers all backing up their sessions to the next server.


Field Summary
 
Fields inherited from class com.caucho.server.cluster.StoreManager
_clusterObjects, _idleCheckInterval, _isAlwaysLoad, _isAlwaysSave, _loadCount, _loadFailCount, _maxIdleTime, _saveCount, _saveFailCount, _selfIndex, _storeMap
 
Constructor Summary
ClusterStoreManager()
           
 
Method Summary
 void accessImpl(ClusterObject object)
          Updates the object's objectAccess time.
 void accessImpl(HashKey objectId)
          Updates the object's objectAccess time.
 void clearOldObjects()
          Clears the old objects.
 void destroy()
          Called at end of life.
 void dumpObjects(int fromServerIndex, long updateTime)
          Callback to dump objects
 PersistentStoreMXBean getAdmin()
          Returns the admin.
 long getObjectCount()
          Returns the objects in the objectStore
 Path getPath()
           
 boolean init()
          Called after any factory settings.
 boolean load(ClusterObject object, java.lang.Object value)
          Loads a distributed object from the backing objectStore
 boolean load(ClusterObject object, java.lang.Object value, ClusterServer server)
           
 byte[] read(HashKey key, WriteStream os)
          Reads from the objectStore.
 void remove(ClusterObject object)
          When the session is no longer valid, objectRemove it from the backing objectStore.
 void remove(HashKey objectId)
          When the object is no longer valid, objectRemove it from the backing objectStore.
 void save(HashKey objectId, HashKey storeId, long expireInterval, java.io.InputStream is, byte[] digest, byte[] oldDigest, int primary, int secondary, int tertiary)
          Updates the objectStore.
 void setDumpDisable(boolean isDisable)
          Disable the dump on startup
 void setJndiName(java.lang.String name)
           
 void setPath(Path path)
           
 void setSaveBackup(boolean isBackup)
          Set true if the data should be stored on a backup server
 void setSaveTriplicate(boolean isTriplicate)
          Set true if the data should be stored in triplicate.
 void setTriplicate(boolean isTriplicate)
          Set true if the data should be stored in triplicate.
 void setVersionDisable(boolean isDisable)
          Disable version checking for startup
 void setWaitForAcknowledge(boolean isWait)
          Set true if the requests to wait for an ack.
 boolean start()
          Called to start the objectStore.
 boolean startUpdate()
          Called to start any invalidate processing
 void store(ClusterObject object, TempOutputStream tempOutputStream, byte[] digest, byte[] oldDigest)
          Stores the object in the backup.
 java.lang.String toString()
           
 void updateAccess(HashKey objectId)
          Updates the object's objectAccess time.
 void updateMetadata(HashKey objectId, HashKey storeId, byte[] dataHash, long expireInterval, int primary, int secondary, int tertiary, boolean isDead)
          Updates the store from the cluster based on a dump.
 
Methods inherited from class com.caucho.server.cluster.AbstractClusterStoreManager
getPrimaryIndex, getPrimaryServer, getSecondaryIndex, getSecondaryServer, getTertiaryIndex, getTertiaryServer, ping, updateOwner
 
Methods inherited from class com.caucho.server.cluster.StoreManager
access, access, classLoaderDestroy, classLoaderInit, create, createStore, environmentBind, environmentConfigure, environmentStart, environmentStop, getAccessWindowTime, getCluster, getIdleCheckTime, getLoadCount, getLoadFailCount, getMaxIdleTime, getOwningServer, getSaveCount, getSaveFailCount, getSelfIndex, getServerList, getStore, handleAlarm, invalidate, isAlwaysLoad, isAlwaysSave, isPrimary, remove, removeStore, setAlwaysLoad, setAlwaysSave, setCluster, setExpireInterval, setMaxIdleTime, updateIdleCheckInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClusterStoreManager

public ClusterStoreManager()
Method Detail

getPath

public Path getPath()

setPath

public void setPath(Path path)

setJndiName

public void setJndiName(java.lang.String name)

setDumpDisable

public void setDumpDisable(boolean isDisable)
Disable the dump on startup


setVersionDisable

public void setVersionDisable(boolean isDisable)
Disable version checking for startup


setSaveBackup

public void setSaveBackup(boolean isBackup)
Set true if the data should be stored on a backup server


setSaveTriplicate

public void setSaveTriplicate(boolean isTriplicate)
Set true if the data should be stored in triplicate.


setTriplicate

public void setTriplicate(boolean isTriplicate)
Set true if the data should be stored in triplicate.


setWaitForAcknowledge

public void setWaitForAcknowledge(boolean isWait)
Set true if the requests to wait for an ack.


getAdmin

public PersistentStoreMXBean getAdmin()
Description copied from class: StoreManager
Returns the admin.

Overrides:
getAdmin in class StoreManager

init

public boolean init()
Description copied from class: StoreManager
Called after any factory settings.

Overrides:
init in class StoreManager

start

public boolean start()
              throws java.lang.Exception
Description copied from class: StoreManager
Called to start the objectStore.

Overrides:
start in class StoreManager
Throws:
java.lang.Exception

startUpdate

public boolean startUpdate()
                    throws java.lang.Exception
Description copied from class: StoreManager
Called to start any invalidate processing

Overrides:
startUpdate in class StoreManager
Throws:
java.lang.Exception

clearOldObjects

public void clearOldObjects()
                     throws java.sql.SQLException
Clears the old objects.

Overrides:
clearOldObjects in class StoreManager
Throws:
java.sql.SQLException

load

public boolean load(ClusterObject object,
                    java.lang.Object value)
             throws java.lang.Exception
Loads a distributed object from the backing objectStore

Specified by:
load in class StoreManager
Parameters:
object - the cluster object to loadImpl
value - the underlying object to loadImpl
Returns:
true if the loadImpl succeeded
Throws:
java.lang.Exception

load

public boolean load(ClusterObject object,
                    java.lang.Object value,
                    ClusterServer server)
             throws java.lang.Exception
Throws:
java.lang.Exception

store

public void store(ClusterObject object,
                  TempOutputStream tempOutputStream,
                  byte[] digest,
                  byte[] oldDigest)
           throws java.lang.Exception
Stores the object in the backup.

Specified by:
store in class StoreManager
Parameters:
object - the object to objectStore.
tempOutputStream - the byte stream to the saved data
digest - the sha-1 hash of the data
oldDigest - the previous hash value for the data
Throws:
java.lang.Exception

updateAccess

public void updateAccess(HashKey objectId)
                  throws java.lang.Exception
Updates the object's objectAccess time.

Parameters:
value - the object to objectStore.
Throws:
java.lang.Exception

accessImpl

public void accessImpl(HashKey objectId)
                throws java.lang.Exception
Updates the object's objectAccess time.

Specified by:
accessImpl in class StoreManager
Parameters:
value - the object to objectStore.
Throws:
java.lang.Exception

accessImpl

public void accessImpl(ClusterObject object)
                throws java.lang.Exception
Updates the object's objectAccess time.

Overrides:
accessImpl in class StoreManager
Parameters:
value - the object to objectStore.
Throws:
java.lang.Exception

remove

public void remove(HashKey objectId)
            throws java.lang.Exception
When the object is no longer valid, objectRemove it from the backing objectStore.

Parameters:
storeId - the identifier of the storeage group
objectId - the identifier of the object to objectRemove
Throws:
java.lang.Exception

remove

public void remove(ClusterObject object)
            throws java.lang.Exception
When the session is no longer valid, objectRemove it from the backing objectStore.

Overrides:
remove in class StoreManager
Parameters:
object - the object to objectRemove
Throws:
java.lang.Exception

getObjectCount

public long getObjectCount()
Description copied from class: StoreManager
Returns the objects in the objectStore

Overrides:
getObjectCount in class StoreManager

save

public void save(HashKey objectId,
                 HashKey storeId,
                 long expireInterval,
                 java.io.InputStream is,
                 byte[] digest,
                 byte[] oldDigest,
                 int primary,
                 int secondary,
                 int tertiary)
          throws java.io.IOException
Updates the objectStore.

Throws:
java.io.IOException

updateMetadata

public void updateMetadata(HashKey objectId,
                           HashKey storeId,
                           byte[] dataHash,
                           long expireInterval,
                           int primary,
                           int secondary,
                           int tertiary,
                           boolean isDead)
Updates the store from the cluster based on a dump.


read

public byte[] read(HashKey key,
                   WriteStream os)
            throws java.io.IOException
Reads from the objectStore.

Throws:
java.io.IOException

dumpObjects

public void dumpObjects(int fromServerIndex,
                        long updateTime)
                 throws java.io.IOException
Callback to dump objects

Throws:
java.io.IOException

destroy

public void destroy()
Description copied from class: StoreManager
Called at end of life.

Overrides:
destroy in class StoreManager

toString

public java.lang.String toString()
Overrides:
toString in class StoreManager