use of org.apache.geronimo.transaction.log.UnrecoverableLog in project aries by apache.
the class TransactionManagerService method createTransactionLog.
static TransactionLog createTransactionLog(Dictionary properties, XidFactory xidFactory) throws ConfigurationException {
TransactionLog result = null;
if (getBool(properties, RECOVERABLE, DEFAULT_RECOVERABLE)) {
String bufferClassName = getString(properties, HOWL_BUFFER_CLASS_NAME, "org.objectweb.howl.log.BlockLogBuffer");
int bufferSizeKBytes = getInt(properties, HOWL_BUFFER_SIZE, 4);
if (bufferSizeKBytes < 1 || bufferSizeKBytes > 32) {
throw new ConfigurationException(HOWL_BUFFER_SIZE, "The buffer size must be between one and thirty-two.");
}
boolean checksumEnabled = getBool(properties, HOWL_CHECKSUM_ENABLED, true);
boolean adler32Checksum = getBool(properties, HOWL_ADLER32_CHECKSUM, true);
int flushSleepTimeMilliseconds = getInt(properties, HOWL_FLUSH_SLEEP_TIME, 50);
String logFileExt = getString(properties, HOWL_LOG_FILE_EXT, "log");
String logFileName = getString(properties, HOWL_LOG_FILE_NAME, "transaction");
int maxBlocksPerFile = getInt(properties, HOWL_MAX_BLOCKS_PER_FILE, -1);
int maxLogFiles = getInt(properties, HOWL_MAX_LOG_FILES, 2);
int minBuffers = getInt(properties, HOWL_MIN_BUFFERS, 4);
if (minBuffers < 0) {
throw new ConfigurationException(HOWL_MIN_BUFFERS, "The minimum number of buffers must be greater than zero.");
}
int maxBuffers = getInt(properties, HOWL_MAX_BUFFERS, 0);
if (maxBuffers > 0 && minBuffers < maxBuffers) {
throw new ConfigurationException(HOWL_MAX_BUFFERS, "The maximum number of buffers must be greater than the minimum number of buffers.");
}
int threadsWaitingForceThreshold = getInt(properties, HOWL_THREADS_WAITING_FORCE_THRESHOLD, -1);
boolean flushPartialBuffers = getBool(properties, HOWL_FLUSH_PARTIAL_BUFFERS, true);
String logFileDir = getString(properties, HOWL_LOG_FILE_DIR, null);
if (logFileDir == null || logFileDir.length() == 0 || !new File(logFileDir).isAbsolute()) {
throw new ConfigurationException(HOWL_LOG_FILE_DIR, "The log file directory must be set to an absolute directory.");
}
try {
result = new HOWLLog(bufferClassName, bufferSizeKBytes, checksumEnabled, adler32Checksum, flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile, maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold, flushPartialBuffers, xidFactory, null);
((HOWLLog) result).doStart();
} catch (Exception e) {
// This should not really happen as we've checked properties earlier
throw new ConfigurationException(null, e.getMessage(), e);
}
} else {
result = new UnrecoverableLog();
}
return result;
}
Aggregations