com.caucho.server.cluster
Class FileStore

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

public class FileStore
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, log
 
Constructor Summary
FileStore()
          Create a new file-based persistent store.
 
Method Summary
 void accessImpl(java.lang.String uniqueId)
          Updates the object's access time in the persistent store.
 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, remove it from the backing store.
 void setExpireInterval(java.lang.String uniqueId, long expires)
          Sets the timef for the expires interval.
 void setPath(Path path)
          Sets the file store's path.
 boolean start()
          Start
 void store(ClusterObject obj, TempStream tempStream, long crc)
          Saves the session to the filesystem.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.server.cluster.StoreManager
access, access, classLoaderDestroy, classLoaderInit, createStore, destroy, environmentStart, environmentStop, getAccessWindowTime, getAdmin, getCluster, getIdleCheckTime, getLoadCount, getLoadFailCount, getMaxIdleTime, getObjectCount, getOwningServer, getPrimaryIndex, getSaveCount, getSaveFailCount, getSecondaryIndex, getSelfIndex, getServerList, getStore, getTertiaryIndex, handleAlarm, isAlwaysLoad, isAlwaysSave, remove, removeStore, setAlwaysLoad, setAlwaysSave, setCluster, setMaxIdleTime, store, update, updateIdleCheckInterval, updateOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileStore

public FileStore()
Create a new file-based persistent store.

Method Detail

setPath

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


addText

public void addText(java.lang.String value)

getPath

public Path getPath()

init

public boolean init()
             throws java.lang.Exception
Initialize.

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

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 update.
Throws:
java.lang.Exception

store

public void store(ClusterObject obj,
                  TempStream tempStream,
                  long crc)
           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
crc - digest of the serialized stream
updateCount - how many times the object has been updated
Throws:
java.lang.Exception

accessImpl

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

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

setExpireInterval

public void setExpireInterval(java.lang.String uniqueId,
                              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, remove it from the backing store.

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

toString

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