/** * Configures the attributes and the event logger and constructs a service. * <p> * @param cacheManager * @return RemoteHttpCacheService */ protected <K, V> RemoteHttpCacheService<K, V> createRemoteHttpCacheService( ICompositeCacheManager cacheManager ) { Properties props = cacheManager.getConfigurationProperties(); ICacheEventLogger cacheEventLogger = configureCacheEventLogger( props ); RemoteHttpCacheServerAttributes attributes = configureRemoteHttpCacheServerAttributes( props ); RemoteHttpCacheService<K, V> service = new RemoteHttpCacheService<K, V>( cacheManager, attributes, cacheEventLogger ); if ( log.isInfoEnabled() ) { log.info( "Created new RemoteHttpCacheService " + service ); } return service; }
/** * Configures the attributes and the event logger and constructs a service. * <p> * @param cacheManager * @return RemoteHttpCacheService */ public static <K extends Serializable, V extends Serializable> RemoteHttpCacheService<K, V> createRemoteHttpCacheService( ICompositeCacheManager cacheManager ) { Properties props = cacheManager.getConfigurationProperties(); ICacheEventLogger cacheEventLogger = configureCacheEventLogger( props ); RemoteHttpCacheServerAttributes attributes = configureRemoteHttpCacheServerAttributes( props ); RemoteHttpCacheService<K, V> service = new RemoteHttpCacheService<K, V>( cacheManager, attributes, cacheEventLogger ); if ( log.isInfoEnabled() ) { log.info( "Created new RemoteHttpCacheService " + service ); } return service; }
/** * Registers the driver and creates a poolAccess class. * <p> * @param cattr * @param compositeCacheManager * @return JDBCDiskCachePoolAccess for testing * @throws SQLException if a database access error occurs */ protected JDBCDiskCachePoolAccess initializePoolAccess( JDBCDiskCacheAttributes cattr, ICompositeCacheManager compositeCacheManager ) throws SQLException { JDBCDiskCachePoolAccess poolAccess1 = null; if ( cattr.getConnectionPoolName() != null ) { JDBCDiskCachePoolAccessManager manager = JDBCDiskCachePoolAccessManager.getInstance(); poolAccess1 = manager.getJDBCDiskCachePoolAccess( cattr.getConnectionPoolName(), compositeCacheManager.getConfigurationProperties() ); } else { poolAccess1 = JDBCDiskCachePoolAccessManager.createPoolAccess( cattr ); } return poolAccess1; }
/** * This factory method should create an instance of the jdbc cache. * <p> * @param rawAttr specific cache configuration attributes * @param compositeCacheManager the global cache manager * @param cacheEventLogger a specific logger for cache events * @param elementSerializer a serializer for cache elements * @return JDBCDiskCache the cache instance * @throws SQLException if the cache instance could not be created */ @Override public <K, V> JDBCDiskCache<K, V> createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager compositeCacheManager, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer ) throws SQLException { JDBCDiskCacheAttributes cattr = (JDBCDiskCacheAttributes) rawAttr; TableState tableState = getTableState( cattr.getTableName() ); DataSourceFactory dsFactory = getDataSourceFactory(cattr, compositeCacheManager.getConfigurationProperties()); JDBCDiskCache<K, V> cache = new JDBCDiskCache<K, V>( cattr, dsFactory, tableState, compositeCacheManager ); cache.setCacheEventLogger( cacheEventLogger ); cache.setElementSerializer( elementSerializer ); // create a shrinker if we need it. createShrinkerWhenNeeded( cattr, cache ); return cache; }
/** * This factory method should create an instance of the mysqlcache. * <p> * @param rawAttr specific cache configuration attributes * @param compositeCacheManager the global cache manager * @param cacheEventLogger a specific logger for cache events * @param elementSerializer a serializer for cache elements * @return MySQLDiskCache the cache instance * @throws SQLException if the cache instance could not be created */ @Override public <K, V> MySQLDiskCache<K, V> createCache( AuxiliaryCacheAttributes rawAttr, ICompositeCacheManager compositeCacheManager, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer ) throws SQLException { MySQLDiskCacheAttributes cattr = (MySQLDiskCacheAttributes) rawAttr; TableState tableState = getTableState( cattr.getTableName() ); DataSourceFactory dsFactory = getDataSourceFactory(cattr, compositeCacheManager.getConfigurationProperties()); MySQLDiskCache<K, V> cache = new MySQLDiskCache<K, V>( cattr, dsFactory, tableState, compositeCacheManager ); cache.setCacheEventLogger( cacheEventLogger ); cache.setElementSerializer( elementSerializer ); // create a shrinker if we need it. createShrinkerWhenNeeded( cattr, cache ); scheduleOptimizations( cattr, tableState, cache.getDataSource() ); return cache; }