public Integer[] getWeights() { String[] servers = getServers(); Integer[] weights = new Integer[servers.length]; String weightsValue = properties.get(PROP_WEIGHTS); if (weightsValue == null || "".equals(weightsValue)) { for (int i = 0; i < weights.length; i++) weights[i] = 1; } else { String[] weightsStrings = weightsValue.split(" "); if (weightsStrings.length == servers.length) { for (int i = 0; i < weights.length; i++) weights[i] = new Integer(weightsStrings[i]); } else throw new CacheException("Count of weight number mismatch count of server"); } return weights; }
public ErrorHandler getErrorHandler() { String errorHandlerName = properties.get(PROP_ERROR_HANDLER, DEFAULT_ERROR_HANDLER); ErrorHandler errorHandler; try { errorHandler = (ErrorHandler) Class.forName(errorHandlerName).newInstance(); } catch (ClassNotFoundException e) { throw new CacheException("Unable to find error handler class [" + errorHandlerName + "]", e); } catch (IllegalAccessException e) { throw new CacheException( "Illegally accessed error handler class [" + errorHandlerName + "]", e); } catch (InstantiationException e) { throw new CacheException( "Failed to instantiate error handler class [" + errorHandlerName + "]", e); } return errorHandler; }
public String getDefaultEncoding() { return properties.get(PROP_DEFAULT_ENCODING, DEFAULT_DEFAULT_ENCODING); }
public boolean isCompressEnable() { return properties.getBoolean(PROP_COMPRESS_ENABLE, DEFAULT_COMPRESS_ENABLE); }
public int getSocketConnectTimeout() { return properties.getInt(PROP_SOCKET_CONNECT_TIMEOUT, DEFAULT_SOCKET_CONNECT_TIMEOUT); }
public int getMaintSleep() { return properties.getInt(PROP_MAINT_SLEEP, DEFAULT_MAINT_SLEEP); }
public int getMaxIdle() { return properties.getInt(PROP_MAX_IDLE, DEFAULT_MAX_IDLE); }
public int getMaxConn() { return properties.getInt(PROP_MAX_CONN, DEFAULT_MAX_CONN); }
public int getMinConn() { return properties.getInt(PROP_MIN_CONN, DEFAULT_MIN_CONN); }
public int getInitConn() { return properties.getInt(PROP_INIT_CONN, DEFAULT_INIT_CONN); }
public String[] getServers() { return properties.get(PROP_SERVERS, DEFAULT_SERVERS).split(" "); }
public String getPoolName() { return properties.get(PROP_POOL_NAME, DEFAULT_POOL_NAME); }