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; }
public String get(String key, String defaultValue) { String namedKey = "ebean." + serverName + "." + key; String inheritKey = "ebean." + key; String value = GlobalProperties.get(namedKey, null); if (value == null) { value = GlobalProperties.get(inheritKey, null); } if (value == null) { return defaultValue; } else { return value; } }
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; }
public String get(String key, String defaultValue){ String namedKey = "ebean."+serverName+"."+key; String inheritKey = "ebean."+key; String value = GlobalProperties.get(namedKey, null); if (value == null){ value = GlobalProperties.get(inheritKey, null); } if (value == null){ return defaultValue; } else { return value; } }
/** * Constructs the Oracle10DbEncrypt. */ public Oracle10DbEncrypt() { String encryptfunction = GlobalProperties.get("ebean.oracle.encryptfunction", "eb_encrypt"); String decryptfunction = GlobalProperties.get("ebean.oracle.decryptfunction", "eb_decrypt"); this.varcharEncryptFunction = new OraVarcharFunction(encryptfunction, decryptfunction); this.dateEncryptFunction = new OraDateFunction(encryptfunction, decryptfunction); }
/** * Constructs the Oracle10DbEncrypt. */ public Oracle10DbEncrypt() { String encryptfunction = GlobalProperties.get("ebean.oracle.encryptfunction", "eb_encrypt"); String decryptfunction = GlobalProperties.get("ebean.oracle.decryptfunction", "eb_decrypt"); this.varcharEncryptFunction = new OraVarcharFunction(encryptfunction, decryptfunction); this.dateEncryptFunction = new OraDateFunction(encryptfunction, decryptfunction); }
public XmlConfigLoader(ClassLoader classLoader){ if (classLoader == null) { classLoader = getClass().getClassLoader(); } String cn = GlobalProperties.get("ebean.classpathreader", null); if (cn != null){ // use a user defined classPathReader logger.info("Using ["+cn+"] to read the searchable class path"); this.classPathReader = (ClassPathReader)ClassUtil.newInstance(cn, this.getClass()); } else { this.classPathReader = new DefaultClassPathReader(); } this.classPaths = classPathReader.readPath(classLoader); }
public XmlConfigLoader(ClassLoader classLoader){ if (classLoader == null) { classLoader = getClass().getClassLoader(); } String cn = GlobalProperties.get("ebean.classpathreader", null); if (cn != null){ // use a user defined classPathReader logger.info("Using ["+cn+"] to read the searchable class path"); this.classPathReader = (ClassPathReader)ClassUtil.newInstance(cn, this.getClass()); } else { this.classPathReader = new DefaultClassPathReader(); } this.classPaths = classPathReader.readPath(classLoader); }
/** * Create the SqlGenSelect. */ public CQueryBuilder(BackgroundExecutor backgroundExecutor, DatabasePlatform dbPlatform, Binder binder) { this.backgroundExecutor = backgroundExecutor; this.binder = binder; this.tableAliasPlaceHolder = GlobalProperties.get("ebean.tableAliasPlaceHolder", "${ta}"); this.columnAliasPrefix = GlobalProperties.get("ebean.columnAliasPrefix", "c"); this.sqlSelectBuilder = new RawSqlSelectClauseBuilder(dbPlatform, binder); this.sqlLimiter = dbPlatform.getSqlLimiter(); this.rawSqlHandler = new CQueryBuilderRawSql(sqlLimiter, dbPlatform); this.selectCountWithAlias = dbPlatform.isSelectCountWithAlias(); this.dbPlatform = dbPlatform; }
private DataSourceAlertListener createAlertListener() throws DataSourceException { String alertCN = GlobalProperties.get("datasource.alert.class", null); if (alertCN == null){ return new SimpleAlerter(); } else { try { return (DataSourceAlertListener)ClassUtil.newInstance(alertCN, this.getClass()); } catch (Exception ex){ throw new DataSourceException(ex); } } }
/** * Create the SqlGenSelect. */ public CQueryBuilder(BackgroundExecutor backgroundExecutor, DatabasePlatform dbPlatform, Binder binder) { this.backgroundExecutor = backgroundExecutor; this.binder = binder; this.tableAliasPlaceHolder = GlobalProperties.get("ebean.tableAliasPlaceHolder", "${ta}"); this.columnAliasPrefix = GlobalProperties.get("ebean.columnAliasPrefix", "c"); this.sqlSelectBuilder = new RawSqlSelectClauseBuilder(dbPlatform, binder); this.sqlLimiter = dbPlatform.getSqlLimiter(); this.rawSqlHandler = new CQueryBuilderRawSql(sqlLimiter, dbPlatform); this.selectCountWithAlias = dbPlatform.isSelectCountWithAlias(); this.dbPlatform = dbPlatform; }
private FileTransactionLogger initialiseLogger() { synchronized (this) { // double check locking here so logWriter NEEDS to be volatile!! FileTransactionLogger writer = this.logWriter; if (writer != null) { return writer; } String middleName = GlobalProperties.get("ebean.logging.filename", "_txn_"); String logPrefix = serverName + middleName; String threadName = "Ebean-" + serverName + "-TxnLogWriter"; // create the real logger and start it FileTransactionLogger newLogWriter = new FileTransactionLogger(threadName, dir, logPrefix, maxFileSize); // assignment of volatile field this.logWriter = newLogWriter; // start background thread for the writer newLogWriter.start(); logger.info("Transaction logs in: " + dir); return newLogWriter; } }
private DataSourceAlertListener createAlertListener() throws DataSourceException { String alertCN = GlobalProperties.get("datasource.alert.class", null); if (alertCN == null){ return new SimpleAlerter(); } else { try { return (DataSourceAlertListener)ClassUtil.newInstance(alertCN, this.getClass()); } catch (Exception ex){ throw new DataSourceException(ex); } } }
private FileTransactionLogger initialiseLogger() { synchronized (this) { // double check locking here so logWriter NEEDS to be volatile!! FileTransactionLogger writer = this.logWriter; if (writer != null) { return writer; } String middleName = GlobalProperties.get("ebean.logging.filename", "_txn_"); String logPrefix = serverName + middleName; String threadName = "Ebean-" + serverName + "-TxnLogWriter"; // create the real logger and start it FileTransactionLogger newLogWriter = new FileTransactionLogger(threadName, dir, logPrefix, maxFileSize); // assignment of volatile field this.logWriter = newLogWriter; // start background thread for the writer newLogWriter.start(); logger.info("Transaction logs in: " + dir); return newLogWriter; } }
public SocketClusterBroadcast( ){ String localHostPort = GlobalProperties.get("ebean.cluster.local", null); String members = GlobalProperties.get("ebean.cluster.members", null); logger.info("Clustering using Sockets local["+localHostPort+"] members["+members+"]"); this.local = new SocketClient(parseFullName(localHostPort)); this.clientMap = new HashMap<String, SocketClient>(); String[] memArray = StringHelper.delimitedToArray(members, ",", false); for (int i = 0; i < memArray.length; i++) { InetSocketAddress member = parseFullName(memArray[i]); SocketClient client = new SocketClient(member); if (!local.getHostPort().equalsIgnoreCase(client.getHostPort())) { // don't add the local one ... clientMap.put(client.getHostPort(), client); } } this.members = clientMap.values().toArray(new SocketClient[clientMap.size()]); this.listener = new SocketClusterListener(this, local.getPort()); }
public SocketClusterBroadcast( ){ String localHostPort = GlobalProperties.get("ebean.cluster.local", null); String members = GlobalProperties.get("ebean.cluster.members", null); logger.info("Clustering using Sockets local["+localHostPort+"] members["+members+"]"); this.local = new SocketClient(parseFullName(localHostPort)); this.clientMap = new HashMap<String, SocketClient>(); String[] memArray = StringHelper.delimitedToArray(members, ",", false); for (int i = 0; i < memArray.length; i++) { InetSocketAddress member = parseFullName(memArray[i]); SocketClient client = new SocketClient(member); if (!local.getHostPort().equalsIgnoreCase(client.getHostPort())) { // don't add the local one ... clientMap.put(client.getHostPort(), client); } } this.members = clientMap.values().toArray(new SocketClient[clientMap.size()]); this.listener = new SocketClusterListener(this, local.getPort()); }
public DefaultServerFactory() { this.clusterManager = new ClusterManager(); this.jndiDataSourceFactory = new JndiDataSourceLookup(); List<String> packages = getSearchJarsPackages(GlobalProperties.get("ebean.search.packages", null)); List<String> jars = getSearchJarsPackages(GlobalProperties.get("ebean.search.jars", null)); this.bootupClassSearch = new BootupClassPathSearch(null, packages, jars); this.xmlConfigLoader = new XmlConfigLoader(null); this.xmlConfig = xmlConfigLoader.load(); // register so that we can shutdown any Ebean wide // resources such as clustering ShutdownManager.registerServerFactory(this); }
public DefaultServerFactory() { this.clusterManager = new ClusterManager(); this.jndiDataSourceFactory = new JndiDataSourceLookup(); List<String> packages = getSearchJarsPackages(GlobalProperties.get("ebean.search.packages", null)); List<String> jars = getSearchJarsPackages(GlobalProperties.get("ebean.search.jars", null)); this.bootupClassSearch = new BootupClassPathSearch(null, packages, jars); this.xmlConfigLoader = new XmlConfigLoader(null); this.xmlConfig = xmlConfigLoader.load(); // register so that we can shutdown any Ebean wide // resources such as clustering ShutdownManager.registerServerFactory(this); }