com.caucho.server.cluster
Class JdbcStoreManager

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

public class JdbcStoreManager
extends AbstractClusterStoreManager

Storing sessions using a JDBC database as a backing objectStore.


Field Summary
protected  javax.sql.DataSource _dataSource
           
 
Fields inherited from class com.caucho.server.cluster.StoreManager
_clusterObjects, _idleCheckInterval, _isAlwaysLoad, _isAlwaysSave, _loadCount, _loadFailCount, _maxIdleTime, _saveCount, _saveFailCount, _selfIndex, _storeMap
 
Constructor Summary
JdbcStoreManager()
          Create a new JDBC backing objectStore.
 
Method Summary
 void accessImpl(HashKey objectId)
          Updates the object's objectAccess time.
 void clearOldObjects()
          Clears the old objects.
 boolean init()
          Called after any factory settings.
protected  boolean load(ClusterObject clusterObj, java.lang.Object obj)
          Load the session from the jdbc objectStore.
 void remove(ClusterObject obj)
          Removes the named object from the objectStore.
 void setBlobType(java.lang.String blobType)
           
 void setDataSource(javax.sql.DataSource dataSource)
           
 void setTableName(java.lang.String tableName)
           
 boolean start()
          Called to start the objectStore.
protected  void store(ClusterObject obj, TempOutputStream tempStream, byte[] digest, byte[] oldHash)
          Save the object to the jdbc objectStore.
 java.lang.String toString()
           
 
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, accessImpl, classLoaderDestroy, classLoaderInit, create, createStore, destroy, environmentBind, environmentConfigure, environmentStart, environmentStop, getAccessWindowTime, getAdmin, getCluster, getIdleCheckTime, getLoadCount, getLoadFailCount, getMaxIdleTime, getObjectCount, getOwningServer, getSaveCount, getSaveFailCount, getSelfIndex, getServerList, getStore, handleAlarm, invalidate, isAlwaysLoad, isAlwaysSave, isPrimary, remove, removeStore, setAlwaysLoad, setAlwaysSave, setCluster, setExpireInterval, setMaxIdleTime, startUpdate, updateIdleCheckInterval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_dataSource

protected javax.sql.DataSource _dataSource
Constructor Detail

JdbcStoreManager

public JdbcStoreManager()
Create a new JDBC backing objectStore.

Method Detail

setDataSource

public void setDataSource(javax.sql.DataSource dataSource)

setTableName

public void setTableName(java.lang.String tableName)

setBlobType

public void setBlobType(java.lang.String blobType)

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

clearOldObjects

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

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

load

protected boolean load(ClusterObject clusterObj,
                       java.lang.Object obj)
                throws java.lang.Exception
Load the session from the jdbc objectStore.

Specified by:
load in class StoreManager
Parameters:
clusterObj - the cluster object to fill.
obj - the object to updateImpl.
Returns:
true if the loadImpl was valid.
Throws:
java.lang.Exception

store

protected void store(ClusterObject obj,
                     TempOutputStream tempStream,
                     byte[] digest,
                     byte[] oldHash)
              throws java.lang.Exception
Save the object to the jdbc objectStore.

Specified by:
store in class StoreManager
Parameters:
obj - the object to objectStore.
tempStream - the stream containing the object's data
digest - the sha-1 hash of the data
oldHash - the previous hash value for the data
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:
uniqueId - the object id to updateImpl to objectStore.
Throws:
java.lang.Exception

remove

public void remove(ClusterObject obj)
            throws java.lang.Exception
Removes the named object from the objectStore.

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

toString

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