com.caucho.server.cluster
Class ClusterStore

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

public class ClusterStore
extends ClusterStoreManager

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


Field Summary
 
Fields inherited from class com.caucho.server.cluster.ClusterStoreManager
log
 
Fields inherited from class com.caucho.server.cluster.StoreManager
_clusterObjects, _idleCheckInterval, _isAlwaysLoad, _isAlwaysSave, _loadCount, _loadFailCount, _maxIdleTime, _saveCount, _saveFailCount, _selfIndex, _storeMap
 
Constructor Summary
ClusterStore()
           
 
Method Summary
 void accessImpl(java.lang.String uniqueId)
          Updates the object's access time.
 void clearOldObjects()
          Clears the old objects.
 void destroy()
          Called at end of life.
 void dumpObjects(WriteStream os, int srun, long updateTime)
           
 PersistentStoreMXBean getAdmin()
          Returns the admin.
 long getObjectCount()
          Returns the objects in the store
 Path getPath()
           
 boolean init()
          Called after any factory settings.
 boolean load(ClusterObject clusterObject, java.lang.Object obj)
          Loads a distributed object from the backing store
 boolean load(ClusterObject clusterObject, java.lang.Object obj, ServerConnector server)
           
 void read(java.lang.String uniqueId, WriteStream os)
          Reads from the store.
 void remove(ClusterObject object)
          When the session is no longer valid, remove it from the backing store.
 void remove(java.lang.String storeId, java.lang.String objectId)
          When the object is no longer valid, remove it from the backing store.
 void setCluster(Cluster cluster)
          Sets the cluster.
 void setJndiName(java.lang.String name)
           
 void setPath(Path path)
           
 void setTriplicate(boolean isTriplicate)
          Set true if the data should be stored in triplicate.
 void setWaitForAcknowledge(boolean isWait)
          Set true if the requests to wait for an ack.
 boolean start()
          Called to start the store.
 void store(ClusterObject object, TempStream tempStream, long crc)
          Stores the object in the backup.
 void storeOnShutdown(DistributedObject object)
          The ring store has already stored the object, so this is unneeded.
 java.lang.String toString()
           
 void update(java.lang.String serverId, java.lang.String uniqueId, ReadStream is, long expireInterval)
          Updates the store.
 void updateAccess(java.lang.String uniqueId)
          Updates the object's access time.
 
Methods inherited from class com.caucho.server.cluster.ClusterStoreManager
getPrimaryIndex, getPrimaryServer, getSecondaryIndex, getSecondaryServer, getTertiaryIndex, getTertiaryServer, ping, updateOwner
 
Methods inherited from class com.caucho.server.cluster.StoreManager
access, access, classLoaderDestroy, classLoaderInit, createStore, environmentStart, environmentStop, getAccessWindowTime, getCluster, getIdleCheckTime, getLoadCount, getLoadFailCount, getMaxIdleTime, getOwningServer, getSaveCount, getSaveFailCount, getSelfIndex, getServerList, getStore, handleAlarm, isAlwaysLoad, isAlwaysSave, isPrimary, remove, removeStore, setAlwaysLoad, setAlwaysSave, setExpireInterval, setMaxIdleTime, store, update, updateIdleCheckInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClusterStore

public ClusterStore()
Method Detail

setCluster

public void setCluster(Cluster cluster)
Description copied from class: StoreManager
Sets the cluster.

Overrides:
setCluster in class StoreManager

getPath

public Path getPath()

setPath

public void setPath(Path path)

setJndiName

public void setJndiName(java.lang.String name)

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()
             throws java.lang.Exception
Description copied from class: StoreManager
Called after any factory settings.

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

start

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

Overrides:
start 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 clusterObject,
                    java.lang.Object obj)
             throws java.lang.Exception
Loads a distributed object from the backing store

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

load

public boolean load(ClusterObject clusterObject,
                    java.lang.Object obj,
                    ServerConnector server)
             throws java.lang.Exception
Throws:
java.lang.Exception

storeOnShutdown

public void storeOnShutdown(DistributedObject object)
                     throws java.lang.Exception
The ring store has already stored the object, so this is unneeded.

Throws:
java.lang.Exception

store

public void store(ClusterObject object,
                  TempStream tempStream,
                  long crc)
           throws java.lang.Exception
Stores the object in the backup.

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

updateAccess

public void updateAccess(java.lang.String uniqueId)
                  throws java.lang.Exception
Updates the object's access time.

Parameters:
obj - the object to store.
Throws:
java.lang.Exception

accessImpl

public void accessImpl(java.lang.String uniqueId)
                throws java.lang.Exception
Updates the object's access time.

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

remove

public void remove(java.lang.String storeId,
                   java.lang.String objectId)
            throws java.lang.Exception
When the object is no longer valid, remove it from the backing store.

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

remove

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

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

getObjectCount

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

Overrides:
getObjectCount in class StoreManager

update

public void update(java.lang.String serverId,
                   java.lang.String uniqueId,
                   ReadStream is,
                   long expireInterval)
            throws java.io.IOException
Updates the store.

Throws:
java.io.IOException

read

public void read(java.lang.String uniqueId,
                 WriteStream os)
          throws java.io.IOException
Reads from the store.

Throws:
java.io.IOException

dumpObjects

public void dumpObjects(WriteStream os,
                        int srun,
                        long updateTime)
                 throws java.io.IOException
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 java.lang.Object