/** * This constructs an optimizer with the disk cacn properties. * <p> * @param attributes * @param tableState We mark the table status as optimizing when this is happening. * @param dataSource access to the database */ public MySQLTableOptimizer( MySQLDiskCacheAttributes attributes, TableState tableState, DataSource dataSource ) { setTableName( attributes.getTableName() ); this.tableState = tableState; this.dataSource = dataSource; }
/** * This constructs an optimizer with the disk cacn properties. * <p> * @param attributes * @param tableState We mark the table status as optimizing when this is happening. * @param poolAccess access to the database */ public MySQLTableOptimizer( MySQLDiskCacheAttributes attributes, TableState tableState, JDBCDiskCachePoolAccess poolAccess ) { setTableName( attributes.getTableName() ); this.tableState = tableState; this.poolAccess = poolAccess; }
log.info( "Will try to configure optimization for table [" + attributes.getTableName() + "] on schedule [" + attributes.getOptimizationSchedule() + "]" ); log.warn( "Problem creating optimization schedule for table [" + attributes.getTableName() + "]", e ); log.info( "Optimization is not configured for table [" + attributes.getTableName() + "]" );
log.info( "Will try to configure optimization for table [" + attributes.getTableName() + "] on schedule [" + attributes.getOptimizationSchedule() + "]" ); log.warn( "Problem creating optimization schedule for table [" + attributes.getTableName() + "]", e ); log.info( "Optimization is not configured for table [" + attributes.getTableName() + "]" );
/** * This factory method should create an instance of the mysqlcache. * <p> * @param rawAttr * @param compositeCacheManager * @param cacheEventLogger * @param elementSerializer * @return MySQLDiskCache * @throws SQLException if the creation of the cache instance fails */ @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() ); MySQLDiskCache<K, V> cache = new MySQLDiskCache<K, V>( cattr, tableState, compositeCacheManager ); cache.setCacheEventLogger( cacheEventLogger ); cache.setElementSerializer( elementSerializer ); // create a shrinker if we need it. createShrinkerWhenNeeded( cattr, cache ); scheduleOptimizations( cattr, tableState, cache.getPoolAccess() ); 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; }