Search in sources :

Example 1 with XidFactoryImpl

use of org.apache.geronimo.transaction.manager.XidFactoryImpl in project tomee by apache.

the class GeronimoTransactionManagerFactory method create.

public static // Deprecated, use defaultTransactionTimeout
GeronimoTransactionManager create(// Deprecated, use defaultTransactionTimeout
Integer defaultTransactionTimeoutSeconds, final Duration defaultTransactionTimeout, final boolean txRecovery, final byte[] tmId, final String bufferClassName, final int bufferSizeKb, final boolean checksumEnabled, final boolean adler32Checksum, // Deprecated, use flushSleepTime
Integer flushSleepTimeMilliseconds, final Duration flushSleepTime, final String logFileDir, final String logFileExt, final String logFileName, final int maxBlocksPerFile, final int maxBuffers, final int maxLogFiles, final int minBuffers, final int threadsWaitingForceThreshold) throws Exception {
    if (flushSleepTime.getUnit() == null) {
        flushSleepTime.setUnit(TimeUnit.MILLISECONDS);
    }
    if (flushSleepTimeMilliseconds == null) {
        flushSleepTimeMilliseconds = (int) TimeUnit.MILLISECONDS.convert(flushSleepTime.getTime(), flushSleepTime.getUnit());
    }
    if (defaultTransactionTimeout.getUnit() == null) {
        defaultTransactionTimeout.setUnit(TimeUnit.SECONDS);
    }
    if (defaultTransactionTimeoutSeconds == null) {
        defaultTransactionTimeoutSeconds = (int) TimeUnit.SECONDS.convert(defaultTransactionTimeout.getTime(), defaultTransactionTimeout.getUnit());
    }
    XidFactory xidFactory = null;
    TransactionLog txLog = null;
    if (txRecovery) {
        SystemInstance.get().setComponent(XAResourceWrapper.class, new GeronimoXAResourceWrapper());
        xidFactory = new XidFactoryImpl(tmId == null ? DEFAULT_TM_ID : tmId);
        txLog = new HOWLLog(bufferClassName == null ? "org.objectweb.howl.log.BlockLogBuffer" : bufferClassName, bufferSizeKb == 0 ? DEFAULT_BUFFER_SIZE : bufferSizeKb, checksumEnabled, adler32Checksum, flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile, maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold, xidFactory, SystemInstance.get().getBase().getDirectory("."));
        ((HOWLLog) txLog).doStart();
    }
    final GeronimoTransactionManager geronimoTransactionManager = new DestroyableTransactionManager(defaultTransactionTimeoutSeconds, xidFactory, txLog);
    final ObjectNameBuilder jmxName = new ObjectNameBuilder("openejb.management").set("j2eeType", "TransactionManager");
    LocalMBeanServer.registerDynamicWrapperSilently(new TransactionManagerMBean(geronimoTransactionManager, defaultTransactionTimeout, txLog), jmxName.build());
    return geronimoTransactionManager;
}
Also used : ObjectNameBuilder(org.apache.openejb.monitoring.ObjectNameBuilder) TransactionLog(org.apache.geronimo.transaction.manager.TransactionLog) XidFactoryImpl(org.apache.geronimo.transaction.manager.XidFactoryImpl) HOWLLog(org.apache.geronimo.transaction.log.HOWLLog) GeronimoTransactionManager(org.apache.geronimo.transaction.manager.GeronimoTransactionManager) XidFactory(org.apache.geronimo.transaction.manager.XidFactory)

Aggregations

HOWLLog (org.apache.geronimo.transaction.log.HOWLLog)1 GeronimoTransactionManager (org.apache.geronimo.transaction.manager.GeronimoTransactionManager)1 TransactionLog (org.apache.geronimo.transaction.manager.TransactionLog)1 XidFactory (org.apache.geronimo.transaction.manager.XidFactory)1 XidFactoryImpl (org.apache.geronimo.transaction.manager.XidFactoryImpl)1 ObjectNameBuilder (org.apache.openejb.monitoring.ObjectNameBuilder)1