public DefaultRelationalQueryEngine(MAdminLogging logControl, Binder binder, String dbTrueValue) { this.binder = binder; this.defaultMaxRows = GlobalProperties.getInt("nativesql.defaultmaxrows",100000); this.dbTrueValue = dbTrueValue == null ? "true" : dbTrueValue; }
public DefaultRelationalQueryEngine(MAdminLogging logControl, Binder binder, String dbTrueValue) { this.binder = binder; this.defaultMaxRows = GlobalProperties.getInt("nativesql.defaultmaxrows",100000); this.dbTrueValue = dbTrueValue == null ? "true" : dbTrueValue; }
public FileTransactionLoggerWrapper(ServerConfig serverConfig) { String evalDir = serverConfig.getLoggingDirectoryWithEval(); this.dir = evalDir != null ? evalDir : "logs"; this.maxFileSize = GlobalProperties.getInt("ebean.logging.maxFileSize", 100 * 1024 * 1024); this.serverName = serverConfig.getName(); }
public FileTransactionLoggerWrapper(ServerConfig serverConfig) { String evalDir = serverConfig.getLoggingDirectoryWithEval(); this.dir = evalDir != null ? evalDir : "logs"; this.maxFileSize = GlobalProperties.getInt("ebean.logging.maxFileSize", 100 * 1024 * 1024); this.serverName = serverConfig.getName(); }
private SpiBackgroundExecutor createBackgroundExecutor(ServerConfig serverConfig, int uniqueServerId) { String namePrefix = "Ebean-" + serverConfig.getName(); // the size of the pool for executing periodic tasks (such as cache // flushing) int schedulePoolSize = GlobalProperties.getInt("backgroundExecutor.schedulePoolsize", 1); // the side of the main pool for immediate background task execution int minPoolSize = GlobalProperties.getInt("backgroundExecutor.minPoolSize", 1); int poolSize = GlobalProperties.getInt("backgroundExecutor.poolsize", 20); int maxPoolSize = GlobalProperties.getInt("backgroundExecutor.maxPoolSize", poolSize); int idleSecs = GlobalProperties.getInt("backgroundExecutor.idlesecs", 60); int shutdownSecs = GlobalProperties.getInt("backgroundExecutor.shutdownSecs", 30); boolean useTrad = GlobalProperties.getBoolean("backgroundExecutor.traditional", true); if (useTrad) { // this pool will use Idle seconds between min and max so I think it is // better // as it will let the thread count float between the min and max ThreadPool pool = ThreadPoolManager.getThreadPool(namePrefix); pool.setMinSize(minPoolSize); pool.setMaxSize(maxPoolSize); pool.setMaxIdleTime(idleSecs * 1000); return new TraditionalBackgroundExecutor(pool, schedulePoolSize, shutdownSecs, namePrefix); } else { return new DefaultBackgroundExecutor(poolSize, schedulePoolSize, idleSecs, shutdownSecs, namePrefix); } }
private static BootupEbeanManager createServerFactory() { // String d___ = // com.avaje.ebean.server.core.DefaultServerFactory.class.getName(); String dflt = "com.avaje.ebeaninternal.server.core.DefaultServerFactory"; String implClassName = GlobalProperties.get("ebean.serverfactory", dflt); int delaySecs = GlobalProperties.getInt("ebean.start.delay", 0); if (delaySecs > 0) { try { // perhaps useful to delay the startup to give time to // attach a debugger when running in a server like tomcat. String m = "Ebean sleeping " + delaySecs + " seconds due to ebean.start.delay"; logger.log(Level.INFO, m); Thread.sleep(delaySecs * 1000); } catch (InterruptedException e) { String m = "Interrupting debug.start.delay of " + delaySecs; logger.log(Level.SEVERE, m, e); } } try { // use a client side implementation? return (BootupEbeanManager) ClassUtil.newInstance(implClassName); } catch (Exception ex) { throw new RuntimeException(ex); } } }
private ThreadPool createThreadPool(String poolName) { int min = GlobalProperties.getInt("threadpool." + poolName + ".min", 0); int max = GlobalProperties.getInt("threadpool." + poolName + ".max", 100); long idle = 1000 * GlobalProperties.getInt("threadpool." + poolName + ".idletime", -1); if (idle < 0) { idle = defaultIdleTime; } boolean isDaemon = true; Integer priority = null; String threadPriority = GlobalProperties.get("threadpool." + poolName + ".priority", null); if (threadPriority != null) { priority = new Integer(threadPriority); } ThreadPool newPool = new ThreadPool(poolName, isDaemon, priority); newPool.setMaxSize(max); newPool.setMinSize(min); newPool.setMaxIdleTime(idle); return newPool; }
private ThreadPool createThreadPool(String poolName) { int min = GlobalProperties.getInt("threadpool." + poolName + ".min", 0); int max = GlobalProperties.getInt("threadpool." + poolName + ".max", 100); long idle = 1000 * GlobalProperties.getInt("threadpool." + poolName + ".idletime", -1); if (idle < 0) { idle = defaultIdleTime; } boolean isDaemon = true; Integer priority = null; String threadPriority = GlobalProperties.get("threadpool." + poolName + ".priority", null); if (threadPriority != null) { priority = new Integer(threadPriority); } ThreadPool newPool = new ThreadPool(poolName, isDaemon, priority); newPool.setMaxSize(max); newPool.setMinSize(min); newPool.setMaxIdleTime(idle); return newPool; }
private static BootupEbeanManager createServerFactory() { // String d___ = com.avaje.ebean.server.core.DefaultServerFactory.class.getName(); String dflt = "com.avaje.ebeaninternal.server.core.DefaultServerFactory"; String implClassName = GlobalProperties.get("ebean.serverfactory", dflt); int delaySecs = GlobalProperties.getInt("ebean.start.delay", 0); if (delaySecs > 0) { try { // perhaps useful to delay the startup to give time to // attach a debugger when running in a server like tomcat. String m = "Ebean sleeping " + delaySecs + " seconds due to ebean.start.delay"; logger.log(Level.INFO, m); Thread.sleep(delaySecs * 1000); } catch (InterruptedException e) { String m = "Interrupting debug.start.delay of " + delaySecs; logger.log(Level.SEVERE, m, e); } } try { // use a client side implementation? return (BootupEbeanManager)ClassUtil.newInstance(implClassName); } catch (Exception ex) { throw new RuntimeException(ex); } } }
private SpiBackgroundExecutor createBackgroundExecutor(ServerConfig serverConfig, int uniqueServerId) { String namePrefix = "Ebean-" + serverConfig.getName(); // the size of the pool for executing periodic tasks (such as cache // flushing) int schedulePoolSize = GlobalProperties.getInt("backgroundExecutor.schedulePoolsize", 1); // the side of the main pool for immediate background task execution int minPoolSize = GlobalProperties.getInt("backgroundExecutor.minPoolSize", 1); int poolSize = GlobalProperties.getInt("backgroundExecutor.poolsize", 20); int maxPoolSize = GlobalProperties.getInt("backgroundExecutor.maxPoolSize", poolSize); int idleSecs = GlobalProperties.getInt("backgroundExecutor.idlesecs", 60); int shutdownSecs = GlobalProperties.getInt("backgroundExecutor.shutdownSecs", 30); boolean useTrad = GlobalProperties.getBoolean("backgroundExecutor.traditional", true); if (useTrad) { // this pool will use Idle seconds between min and max so I think it is // better // as it will let the thread count float between the min and max ThreadPool pool = ThreadPoolManager.getThreadPool(namePrefix); pool.setMinSize(minPoolSize); pool.setMaxSize(maxPoolSize); pool.setMaxIdleTime(idleSecs * 1000); return new TraditionalBackgroundExecutor(pool, schedulePoolSize, shutdownSecs, namePrefix); } else { return new DefaultBackgroundExecutor(poolSize, schedulePoolSize, idleSecs, shutdownSecs, namePrefix); } }
this.maxStackTraceSize = GlobalProperties.getInt(prefix + "maxStackTraceSize", 5); this.leakTimeMinutes = GlobalProperties.getInt(prefix + "leakTimeMinutes", 30); this.maxInactiveTimeSecs = GlobalProperties.getInt(prefix + "maxInactiveTimeSecs", 900); this.minConnections = GlobalProperties.getInt(prefix + "minConnections", 0); this.maxConnections = GlobalProperties.getInt(prefix + "maxConnections", 20); this.pstmtCacheSize = GlobalProperties.getInt(prefix + "pstmtCacheSize", 20); this.cstmtCacheSize = GlobalProperties.getInt(prefix + "cstmtCacheSize", 20); this.waitTimeoutMillis = GlobalProperties.getInt(prefix + "waitTimeout", 1000);
/** * Construct with explicit ConfigProperties. */ public DataSourceManager() { this.alertlistener = createAlertListener(); // perform heart beat every 30 seconds by default this.dbUpFreqInSecs = GlobalProperties.getInt("datasource.heartbeatfreq",30); this.dbDownFreqInSecs = GlobalProperties.getInt("datasource.deadbeatfreq",10); this.dbChecker = new BackgroundRunnable(new Checker(), dbUpFreqInSecs); this.deregisterDriver = GlobalProperties.getBoolean("datasource.deregisterDriver", true); try { BackgroundThread.add(dbChecker); } catch (Exception e) { logger.log(Level.SEVERE, null, e); } }
/** * Construct with explicit ConfigProperties. */ public DataSourceManager() { this.alertlistener = createAlertListener(); // perform heart beat every 30 seconds by default this.dbUpFreqInSecs = GlobalProperties.getInt("datasource.heartbeatfreq",30); this.dbDownFreqInSecs = GlobalProperties.getInt("datasource.deadbeatfreq",10); this.dbChecker = new BackgroundRunnable(new Checker(), dbUpFreqInSecs); this.deregisterDriver = GlobalProperties.getBoolean("datasource.deregisterDriver", true); try { BackgroundThread.add(dbChecker); } catch (Exception e) { logger.log(Level.SEVERE, null, e); } }
/** * Create and return the CacheManager. */ private ServerCacheManager getCacheManager(ServerConfig serverConfig) { ServerCacheManager serverCacheManager = serverConfig.getServerCacheManager(); if (serverCacheManager != null) { return serverCacheManager; } // reasonable default settings are for a cache per bean type ServerCacheOptions beanOptions = new ServerCacheOptions(); beanOptions.setMaxSize(GlobalProperties.getInt("cache.maxSize", 1000)); // maxIdleTime 10 minutes beanOptions.setMaxIdleSecs(GlobalProperties.getInt("cache.maxIdleTime", 60 * 10)); // maxTimeToLive 6 hrs beanOptions.setMaxSecsToLive(GlobalProperties.getInt("cache.maxTimeToLive", 60 * 60 * 6)); // reasonable default settings for the query cache per bean type ServerCacheOptions queryOptions = new ServerCacheOptions(); queryOptions.setMaxSize(GlobalProperties.getInt("querycache.maxSize", 100)); // maxIdleTime 10 minutes queryOptions.setMaxIdleSecs(GlobalProperties.getInt("querycache.maxIdleTime", 60 * 10)); // maxTimeToLive 6 hours queryOptions.setMaxSecsToLive(GlobalProperties.getInt("querycache.maxTimeToLive", 60 * 60 * 6)); ServerCacheFactory cacheFactory = serverConfig.getServerCacheFactory(); if (cacheFactory == null) { cacheFactory = new DefaultServerCacheFactory(); } return new DefaultServerCacheManager(cacheFactory, beanOptions, queryOptions); }
/** * Construct this DmlPersistExecute. */ public DefaultPersistExecute(boolean validate, Binder binder, PstmtBatch pstmtBatch) { this.validate = validate; this.exeOrmUpdate = new ExeOrmUpdate(binder, pstmtBatch); this.exeUpdateSql = new ExeUpdateSql(binder, pstmtBatch); this.exeCallableSql = new ExeCallableSql(binder, pstmtBatch); this.defaultBatchGenKeys = GlobalProperties.getBoolean("batch.getgeneratedkeys", true); this.defaultBatchSize = GlobalProperties.getInt("batch.size", 20); }
/** * Construct this DmlPersistExecute. */ public DefaultPersistExecute(boolean validate, Binder binder, PstmtBatch pstmtBatch) { this.validate = validate; this.exeOrmUpdate = new ExeOrmUpdate(binder, pstmtBatch); this.exeUpdateSql = new ExeUpdateSql(binder, pstmtBatch); this.exeCallableSql = new ExeCallableSql(binder, pstmtBatch); this.defaultBatchGenKeys = GlobalProperties.getBoolean("batch.getgeneratedkeys", true); this.defaultBatchSize = GlobalProperties.getInt("batch.size", 20); }