com.caucho.server.cluster
Class FileStoreManager

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

public class FileStoreManager
extends StoreManager

Class storing distributed objects based on the filesystem.


Field Summary
 
Fields inherited from class com.caucho.server.cluster.StoreManager
_clusterObjects, _idleCheckInterval, _isAlwaysLoad, _isAlwaysSave, _loadCount, _loadFailCount, _maxIdleTime, _saveCount, _saveFailCount, _selfIndex, _storeMap
 
Constructor Summary
FileStoreManager()
          Create a new file-based persistent objectStore.
 
Method Summary
 void accessImpl(HashKey objectId)
          Updates the object's objectAccess time in the persistent objectStore.
 void addText(java.lang.String value)
           
 void clearOldObjects()
          Clears the files which are too old.
 Path getPath()
           
 boolean init()
          Initialize.
protected  boolean isPrimary(java.lang.String id)
          Returns true if this server is a primary for the given object id.
 boolean load(ClusterObject clusterObj, java.lang.Object obj)
          Loads the session from the filesystem.
 void remove(ClusterObject obj)
          When the session is no longer valid, objectRemove it from the backing objectStore.
 void setExpireInterval(HashKey objectId, long expires)
          Sets the timef for the expires interval.
 void setPath(Path path)
          Sets the file objectStore's path.
 boolean start()
          Start
 void store(ClusterObject obj, TempOutputStream tempStream, byte[] dataHash, byte[] oldDataHash)
          Saves the session to the filesystem.
 
Methods inherited from class com.caucho.server.cluster.StoreManager
access, access, accessImpl, classLoaderDestroy, classLoaderInit, create, createStore, destroy, environmentBind, environmentConfigure, environmentStart, environmentStop, getAccessWindowTime, getAdmin, getCluster, getIdleCheckTime, getLoadCount, getLoadFailCount, getMaxIdleTime, getObjectCount, getOwningServer, getPrimaryIndex, getSaveCount, getSaveFailCount, getSecondaryIndex, getSelfIndex, getServerList, getStore, getTertiaryIndex, handleAlarm, invalidate, isAlwaysLoad, isAlwaysSave, remove, removeStore, setAlwaysLoad, setAlwaysSave, setCluster, setMaxIdleTime, startUpdate, toString, updateIdleCheckInterval, updateOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileStoreManager

public FileStoreManager()
Create a new file-based persistent objectStore.

Method Detail

setPath

public void setPath(Path path)
Sets the file objectStore's path.


addText

public void addText(java.lang.String value)

getPath

public Path getPath()

init

public boolean init()
Initialize.

Overrides:
init in class StoreManager

start

public boolean start()
              throws java.lang.Exception
Start

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

clearOldObjects

public void clearOldObjects()
Clears the files which are too old.

Overrides:
clearOldObjects in class StoreManager

isPrimary

protected boolean isPrimary(java.lang.String id)
Returns true if this server is a primary for the given object id.

Overrides:
isPrimary in class StoreManager

load

public boolean load(ClusterObject clusterObj,
                    java.lang.Object obj)
             throws java.lang.Exception
Loads the session from the filesystem.

Specified by:
load in class StoreManager
Parameters:
clusterObj - the object to fill
obj - the object to updateImpl.
Throws:
java.lang.Exception

store

public void store(ClusterObject obj,
                  TempOutputStream tempStream,
                  byte[] dataHash,
                  byte[] oldDataHash)
           throws java.lang.Exception
Saves the session to the filesystem.

Specified by:
store in class StoreManager
Parameters:
obj - the object to save
tempStream - stream to the serialized object
dataHash - sha-1 hash of the datam
updateCount - how many times the object has been updated
Throws:
java.lang.Exception

accessImpl

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

Specified by:
accessImpl in class StoreManager
Parameters:
uniqueId - the identifier of the object.
Throws:
java.lang.Exception

setExpireInterval

public void setExpireInterval(HashKey objectId,
                              long expires)
                       throws java.lang.Exception
Sets the timef for the expires interval.

Overrides:
setExpireInterval in class StoreManager
Parameters:
uniqueId - the identifier of the object.
long - the time in ms for the expire
Throws:
java.lang.Exception

remove

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

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