com.caucho.server.cluster
Class JdbcStore

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

public class JdbcStore
extends ClusterStoreManager

Storing sessions using a JDBC database as a backing store.


Field Summary
protected  javax.sql.DataSource _dataSource
           
 
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
JdbcStore()
          Create a new JDBC backing store.
 
Method Summary
 void accessImpl(java.lang.String uniqueId)
          Updates the object's access 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 store.
 void remove(ClusterObject obj)
          Removes the named object from the store.
 void setBlobType(java.lang.String blobType)
           
 void setDataSource(javax.sql.DataSource dataSource)
           
 void setTableName(java.lang.String tableName)
           
 boolean start()
          Called to start the store.
protected  void store(ClusterObject obj, TempStream tempStream, long crc)
          Save the object to the jdbc store.
 java.lang.String toString()
           
 
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, destroy, environmentStart, environmentStop, getAccessWindowTime, getAdmin, getCluster, getIdleCheckTime, getLoadCount, getLoadFailCount, getMaxIdleTime, getObjectCount, getOwningServer, getSaveCount, getSaveFailCount, getSelfIndex, getServerList, getStore, handleAlarm, isAlwaysLoad, isAlwaysSave, isPrimary, remove, removeStore, setAlwaysLoad, setAlwaysSave, setCluster, setExpireInterval, setMaxIdleTime, store, update, 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

JdbcStore

public JdbcStore()
Create a new JDBC backing store.

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()
             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

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

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

store

protected void store(ClusterObject obj,
                     TempStream tempStream,
                     long crc)
              throws java.lang.Exception
Save the object to the jdbc store.

Specified by:
store in class StoreManager
Parameters:
obj - the object to store.
tempStream - the stream containing the object's data
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:
uniqueId - the object id to update to store.
Throws:
java.lang.Exception

remove

public void remove(ClusterObject obj)
            throws java.lang.Exception
Removes the named object from the 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