@PostConstruct public void init() { Long expiration = dhisConfig.getAnalyticsCacheExpiration(); boolean enabled = expiration > 0 && !SystemUtils.isTestRun(); queryCache = cacheProvider.newCacheBuilder( Grid.class ).forRegion( CACHE_REGION ) .expireAfterWrite( expiration, TimeUnit.SECONDS ).withMaximumSize( enabled ? MAX_CACHE_ENTRIES : 0 ).build(); log.info( String.format( "Analytics server-side cache is enabled: %b with expiration: %d s", enabled, expiration ) ); }
@PostConstruct public void init() { Long expiration = dhisConfig.getAnalyticsCacheExpiration(); boolean enabled = expiration > 0 && !SystemUtils.isTestRun(); queryCache = cacheProvider.newCacheBuilder( Grid.class ).forRegion( CACHE_REGION ) .expireAfterWrite( expiration, TimeUnit.SECONDS ).withMaximumSize( enabled ? MAX_CACHE_ENTRIES : 0 ).build(); log.info( String.format( "Event analytics server-side cache is enabled: %b with expiration: %d s", enabled, expiration ) ); }
@PostConstruct public void init() { IS_APPROVED_CACHE = cacheProvider.newCacheBuilder( Boolean.class ) .forRegion( "isDataApproved" ) .expireAfterAccess( 12, TimeUnit.HOURS ) .withMaximumSize( SystemUtils.isTestRun() ? 0 : 20000 ).build(); }
@PostConstruct public void init() { settingCache = cacheProvider.newCacheBuilder( Serializable.class ).forRegion( "systemSetting" ) .expireAfterAccess( 1, TimeUnit.HOURS ).withMaximumSize( SystemUtils.isTestRun() ? 0 : 400 ).build(); }
@PostConstruct public void init() { userSettingCache = cacheProvider.newCacheBuilder( Serializable.class ).forRegion( "userSetting" ) .expireAfterAccess( 1, TimeUnit.HOURS ).withMaximumSize( SystemUtils.isTestRun() ? 0 : 10000 ).build(); }
public void init() { checkDatabaseConnectivity(); boolean spatialSupport = false; // Check if postgis is installed. If not, fail startup. if ( !SystemUtils.isTestRun() ) { spatialSupport = isSpatialSupport(); if ( !spatialSupport ) { log.error( POSTGIS_MISSING_ERROR ); throw new IllegalStateException( POSTGIS_MISSING_ERROR ); } } String url = config.getProperty( ConfigurationKey.CONNECTION_URL ); String user = config.getProperty( ConfigurationKey.CONNECTION_USERNAME ); String password = config.getProperty( ConfigurationKey.CONNECTION_PASSWORD ); info = new DatabaseInfo(); info.setName( getNameFromConnectionUrl( url ) ); info.setUser( user ); info.setPassword( password ); info.setUrl( url ); info.setSpatialSupport( spatialSupport ); info.setDatabaseVersion( getDatabaseVersion() ); }
private Properties getHibernateProperties() { Properties props = new Properties(); putIfExists( configurationProvider.getProperty( ConfigurationKey.CONNECTION_DIALECT ), Environment.DIALECT, props ); putIfExists( configurationProvider.getProperty( ConfigurationKey.CONNECTION_DRIVER_CLASS ), Environment.DRIVER, props ); putIfExists( configurationProvider.getProperty( ConfigurationKey.CONNECTION_URL ), Environment.URL, props ); putIfExists( configurationProvider.getProperty( ConfigurationKey.CONNECTION_USERNAME ), Environment.USER, props ); putIfExists( configurationProvider.getProperty( ConfigurationKey.CONNECTION_PASSWORD ), Environment.PASS, props ); putIfExists( configurationProvider.getProperty( ConfigurationKey.CONNECTION_POOL_MAX_SIZE ), Environment.C3P0_MAX_SIZE, props ); if ( SystemUtils.isTestRun() ) { putIfExists( configurationProvider.getProperty( ConfigurationKey.CONNECTION_SCHEMA ), Environment.HBM2DDL_AUTO, props ); putIfExists( "false", "hibernate.cache.use_second_level_cache", props ); putIfExists( "false", "hibernate.cache.use_query_cache", props ); } return props; }