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 String[] getServers() { return properties.get(PROP_SERVERS, DEFAULT_SERVERS).split(" "); }
public String getPoolName() { return properties.get(PROP_POOL_NAME, DEFAULT_POOL_NAME); }