org.infinispan.loaders.jdbc.binary
Class JdbcBinaryCacheStore
java.lang.Object
org.infinispan.loaders.AbstractCacheLoader
org.infinispan.loaders.AbstractCacheStore
org.infinispan.loaders.LockSupportCacheStore
org.infinispan.loaders.bucket.BucketBasedCacheStore
org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore
- All Implemented Interfaces:
- CacheLoader, CacheStore
public class JdbcBinaryCacheStore
- extends BucketBasedCacheStore
BucketBasedCacheStore
implementation that will store all the buckets as rows in database, each row
corresponding to a bucket. This is in contrast to JdbcStringBasedCacheStore
which stores each StoredEntry as a row in the database.
This class has the benefit of being able to store StoredEntries that do not have String keys, at the cost of coarser
grained access granularity, and inherently performance.
All the DB related configurations are described in JdbcBinaryCacheStoreConfig
.
- Author:
- Mircea.Markus@jboss.com
- See Also:
JdbcBinaryCacheStoreConfig
,
JdbcStringBasedCacheStore
Methods inherited from class org.infinispan.loaders.LockSupportCacheStore |
acquireGlobalLock, clear, fromStream, getTotalLockCount, immediateLockForWriting, load, loadAll, lockForReading, lockForWriting, releaseGlobalLock, remove, store, toStream, unlock |
Methods inherited from class org.infinispan.loaders.AbstractCacheStore |
applyModifications, commit, getCacheStoreConfig, getConcurrencyLevel, getMarshaller, prepare, purgeExpired, removeAll, rollback, safeClose, safeClose, supportsMultiThreadedPurge |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JdbcBinaryCacheStore
public JdbcBinaryCacheStore()
init
public void init(CacheLoaderConfig config,
Cache cache,
Marshaller m)
throws CacheLoaderException
- Description copied from interface:
CacheLoader
- Used to initialize a cache loader. Typically invoked by the
CacheLoaderManager
when setting up cache loaders.
- Specified by:
init
in interface CacheLoader
- Overrides:
init
in class LockSupportCacheStore
- Parameters:
config
- the cache loader configuration beancache
- cache associated with this cache loader. Implementations may use this to determine cache name when
selecting where refer to state in storage, for example, a different database table name.m
- marshaller to use when loading state from a stream, if supported by the implementation.
- Throws:
CacheLoaderException
start
public void start()
throws CacheLoaderException
- Specified by:
start
in interface CacheLoader
- Overrides:
start
in class LockSupportCacheStore
- Throws:
CacheLoaderException
stop
public void stop()
throws CacheLoaderException
- Specified by:
stop
in interface CacheLoader
- Overrides:
stop
in class AbstractCacheStore
- Throws:
CacheLoaderException
insertBucket
protected void insertBucket(Bucket bucket)
throws CacheLoaderException
- Specified by:
insertBucket
in class BucketBasedCacheStore
- Throws:
CacheLoaderException
saveBucket
protected void saveBucket(Bucket bucket)
throws CacheLoaderException
- Description copied from class:
BucketBasedCacheStore
- This method assumes that the bucket is already persisted in the database.
- Specified by:
saveBucket
in class BucketBasedCacheStore
- Throws:
CacheLoaderException
- if the bucket is not already present, or something happens while persisting.
loadBucket
protected Bucket loadBucket(String keyHashCode)
throws CacheLoaderException
- Description copied from class:
BucketBasedCacheStore
- Loads the bucket from the store, base on the hashcode.
- Specified by:
loadBucket
in class BucketBasedCacheStore
- Throws:
CacheLoaderException
loadAllLockSafe
public Set<InternalCacheEntry> loadAllLockSafe()
throws CacheLoaderException
- Specified by:
loadAllLockSafe
in class LockSupportCacheStore
- Throws:
CacheLoaderException
fromStreamLockSafe
protected void fromStreamLockSafe(ObjectInput objectInput)
throws CacheLoaderException
- Specified by:
fromStreamLockSafe
in class LockSupportCacheStore
- Throws:
CacheLoaderException
toStreamLockSafe
protected void toStreamLockSafe(ObjectOutput objectOutput)
throws CacheLoaderException
- Specified by:
toStreamLockSafe
in class LockSupportCacheStore
- Throws:
CacheLoaderException
clearLockSafe
protected void clearLockSafe()
throws CacheLoaderException
- Specified by:
clearLockSafe
in class LockSupportCacheStore
- Throws:
CacheLoaderException
purgeInternal
public void purgeInternal()
throws CacheLoaderException
- Specified by:
purgeInternal
in class AbstractCacheStore
- Throws:
CacheLoaderException
getConfigurationClass
public Class<? extends CacheLoaderConfig> getConfigurationClass()
- Returns:
- the type of the
CacheLoaderConfig
bean used to configure this
implementation of CacheLoader
getConnectionFactory
public ConnectionFactory getConnectionFactory()
doConnectionFactoryInitialization
public void doConnectionFactoryInitialization(ConnectionFactory connectionFactory)
throws CacheLoaderException
- Keeps a reference to the connection factory for further use. Also initializes the
TableManipulation
that needs connections. This method should be called when you don't
want the store to manage the connection factory, perhaps because it is using an shared connection factory: see
JdbcMixedCacheStore
for such an example of this.
- Throws:
CacheLoaderException
getTableManipulation
public TableManipulation getTableManipulation()
Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.