TransactionProxy txnProxy)
throws IOException
{
super(properties, systemRegistry, txnProxy,
new LoggerWrapper(Logger.getLogger(CLASSNAME)));
PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
String dbEnvClass = wrappedProps.getProperty(
ENVIRONMENT_CLASS_PROPERTY, DEFAULT_ENVIRONMENT_CLASS);
debug = wrappedProps.getBooleanProperty(DEBUG_OUTPUT_PROPERTY, false);
String directory = wrappedProps.getProperty(DIRECTORY_PROPERTY);
if (directory == null) {
String rootDir = properties.getProperty(APP_ROOT);
if (rootDir == null) {
throw new IllegalArgumentException(
"A value for the property " + APP_ROOT +
" must be specified");
}
directory = rootDir + File.separator + DEFAULT_DIRECTORY;
}
/*
* Use an absolute path to avoid problems on Windows.
* -tjb@sun.com (02/16/2007)
*/
directory = new File(directory).getAbsolutePath();
txnTimeout = wrappedProps.getLongProperty(
TXN_TIMEOUT_PROPERTY,
wrappedProps.getLongProperty(
TransactionCoordinator.TXN_TIMEOUT_PROPERTY,
BOUNDED_TIMEOUT_DEFAULT));
long defaultLockTimeout = (txnTimeout < 1)
? DEFAULT_LOCK_TIMEOUT : computeLockTimeout(txnTimeout);
long lockTimeout = wrappedProps.getLongProperty(
LOCK_TIMEOUT_PROPERTY, defaultLockTimeout, 1, Long.MAX_VALUE);
long maxRetry = wrappedProps.getLongProperty(
MAX_RETRY_PROPERTY, DEFAULT_MAX_RETRY, 0, Long.MAX_VALUE);
int numCallbackThreads = wrappedProps.getIntProperty(
NUM_CALLBACK_THREADS_PROPERTY, DEFAULT_NUM_CALLBACK_THREADS, 1,
Integer.MAX_VALUE);
int numKeyMaps = wrappedProps.getIntProperty(
NUM_KEY_MAPS_PROPERTY, DEFAULT_NUM_KEY_MAPS, 1, Integer.MAX_VALUE);
int requestedServerPort = wrappedProps.getIntProperty(
SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 0, 65535);
int requestedUpdateQueuePort = wrappedProps.getIntProperty(
UPDATE_QUEUE_PORT_PROPERTY, DEFAULT_UPDATE_QUEUE_PORT, 0, 65535);
long retryWait = wrappedProps.getLongProperty(
RETRY_WAIT_PROPERTY, DEFAULT_RETRY_WAIT, 0, Long.MAX_VALUE);
if (logger.isLoggable(CONFIG)) {
logger.log(
CONFIG,
"Creating CachingDataStoreServerImpl with properties:" +
"\n " + ENVIRONMENT_CLASS_PROPERTY + "=" + dbEnvClass +
"\n " + DEBUG_OUTPUT_PROPERTY + "=" + debug +
"\n " + DIRECTORY_PROPERTY + "=" + directory +
"\n " + LOCK_TIMEOUT_PROPERTY + "=" + lockTimeout +
"\n " + MAX_RETRY_PROPERTY + "=" + maxRetry +
"\n " + NUM_CALLBACK_THREADS_PROPERTY + "=" +
numCallbackThreads +
"\n " + NUM_KEY_MAPS_PROPERTY + "=" + numKeyMaps +
"\n " + RETRY_WAIT_PROPERTY + "=" + retryWait +
"\n " + SERVER_PORT_PROPERTY + "=" + requestedServerPort +
"\n " + TXN_TIMEOUT_PROPERTY + "=" + txnTimeout +
"\n " + UPDATE_QUEUE_PORT_PROPERTY + "=" +
requestedUpdateQueuePort);
}
try {
File directoryFile = new File(directory);
if (!directoryFile.exists()) {
logger.log(INFO, "Creating database directory: " + directory);
if (!directoryFile.mkdirs()) {
throw new DataStoreException(
"Unable to create database directory: " + directory);
}
}
env = wrappedProps.getClassInstanceProperty(
ENVIRONMENT_CLASS_PROPERTY, DEFAULT_ENVIRONMENT_CLASS,
DbEnvironment.class,
new Class<?>[] {
String.class, Properties.class,
ComponentRegistry.class, TransactionProxy.class },