public static XidFactory createXidFactory() { XidFactory xidFactory; xidFactory = new XidFactoryImpl(); return xidFactory; }
public boolean matchesGlobalId(byte[] globalTransactionId) { if (globalTransactionId.length != Xid.MAXGTRIDSIZE) { return false; } for (int i = 8; i < globalTransactionId.length; i++) { if (globalTransactionId[i] != baseId[i]) { return false; } } // for recovery, only match old transactions long id = extractLong(globalTransactionId, 0); return (id < start); }
public Xid createXid() { byte[] globalId = (byte[]) baseId.clone(); long id; synchronized (this) { id = count++; } insertLong(id, globalId, 0); return new XidImpl(globalId); }
public void afterPropertiesSet() throws Exception { if (transactionLog == null) { transactionLog = GeronimoDefaults.createTransactionLog(xidFactory, transactionLogDir); createdTransactionLog = true; } if (xidFactory == null) { xidFactory = new XidFactoryImpl(); } }
public Xid createBranch(Xid globalId, int branch) { byte[] branchId = (byte[]) baseId.clone(); branchId[0] = (byte) branch; branchId[1] = (byte) (branch >>> 8); branchId[2] = (byte) (branch >>> 16); branchId[3] = (byte) (branch >>> 24); insertLong(start, branchId, 4); return new XidImpl(globalId, branchId); }
public boolean matchesBranchId(byte[] branchQualifier) { if (branchQualifier.length != Xid.MAXBQUALSIZE) { return false; } long id = extractLong(branchQualifier, 4); if (id >= start) { // newly created branch, not recoverable return false; } for (int i = 12; i < branchQualifier.length; i++) { if (branchQualifier[i] != baseId[i]) { return false; } } return true; }
public TransactionManagerImpl(int defaultTransactionTimeoutSeconds, XidFactory xidFactory, TransactionLog transactionLog) throws XAException { if (defaultTransactionTimeoutSeconds <= 0) { throw new IllegalArgumentException("defaultTransactionTimeoutSeconds must be positive: attempted value: " + defaultTransactionTimeoutSeconds); } this.defaultTransactionTimeoutMilliseconds = defaultTransactionTimeoutSeconds * 1000; if (transactionLog == null) { this.transactionLog = new UnrecoverableLog(); } else { this.transactionLog = transactionLog; } if (xidFactory != null) { this.xidFactory = xidFactory; } else { this.xidFactory = new XidFactoryImpl(DEFAULT_TM_ID); } recovery = new RecoveryImpl(this.transactionLog, this.xidFactory); recovery.recoverLog(); }
public TransactionManagerImpl(int defaultTransactionTimeoutSeconds, XidFactory xidFactory, TransactionLog transactionLog) throws XAException { if (defaultTransactionTimeoutSeconds <= 0) { throw new IllegalArgumentException("defaultTransactionTimeoutSeconds must be positive: attempted value: " + defaultTransactionTimeoutSeconds); } this.defaultTransactionTimeoutMilliseconds = defaultTransactionTimeoutSeconds * 1000; if (transactionLog == null) { this.transactionLog = new UnrecoverableLog(); } else { this.transactionLog = transactionLog; } if (xidFactory != null) { this.xidFactory = xidFactory; } else { this.xidFactory = new XidFactoryImpl(DEFAULT_TM_ID); } recovery = new RecoveryImpl(this.transactionLog, this.xidFactory); recovery.recoverLog(); }
public TransactionManagerImpl(int defaultTransactionTimeoutSeconds, XidFactory xidFactory, TransactionLog transactionLog) throws XAException { if (defaultTransactionTimeoutSeconds <= 0) { throw new IllegalArgumentException("defaultTransactionTimeoutSeconds must be positive: attempted value: " + defaultTransactionTimeoutSeconds); } this.defaultTransactionTimeoutMilliseconds = defaultTransactionTimeoutSeconds * 1000; if (transactionLog == null) { this.transactionLog = new UnrecoverableLog(); } else { this.transactionLog = transactionLog; } if (xidFactory != null) { this.xidFactory = xidFactory; } else { this.xidFactory = new XidFactoryImpl(DEFAULT_TM_ID); } recovery = new RecoveryImpl(this.transactionLog, this.xidFactory); recovery.recoverLog(); }
public TransactionManagerImpl(int defaultTransactionTimeoutSeconds, XidFactory xidFactory, TransactionLog transactionLog) throws XAException { if (defaultTransactionTimeoutSeconds <= 0) { throw new IllegalArgumentException("defaultTransactionTimeoutSeconds must be positive: attempted value: " + defaultTransactionTimeoutSeconds); } this.defaultTransactionTimeoutMilliseconds = defaultTransactionTimeoutSeconds * 1000; if (transactionLog == null) { this.transactionLog = new UnrecoverableLog(); } else { this.transactionLog = transactionLog; } if (xidFactory != null) { this.xidFactory = xidFactory; } else { this.xidFactory = new XidFactoryImpl(DEFAULT_TM_ID); } recovery = new RecoveryImpl(this); recovery.recoverLog(); }
@Inject public void init(GlobalConfiguration globalCfg) { final String bufferClassName = "org.objectweb.howl.log.BlockLogBuffer"; final int bufferSizeKBytes = 1; final boolean checksumEnabled = true; final boolean adler32Checksum = true; final int flushSleepTimeMilliseconds = 50; final String logFileExt = "log"; final String logFileName = "transaction"; final int maxBlocksPerFile = -1; final int maxLogFiles = 2; final int minBuffers = 4; final int maxBuffers = 0; final int threadsWaitingForceThreshold = -1; final String logFileDir = System.getProperty("java.io.tmpdir"); try { transactionLog = new HOWLLog(bufferClassName, bufferSizeKBytes, checksumEnabled, adler32Checksum, flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile, maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold, new XidFactoryImpl(), null); ((HOWLLog) transactionLog).doStart(); } catch (Exception e) { throw new RuntimeException(e); } }
this.config = config; this.localResourceSupport = getLocalResourceSupport(); xidFactory = new XidFactoryImpl(); log = getLog(ctx);
SystemInstance.get().setComponent(XAResourceWrapper.class, new GeronimoXAResourceWrapper()); xidFactory = new XidFactoryImpl(tmId == null ? DEFAULT_TM_ID: tmId); txLog = new HOWLLog(bufferClassName == null ? "org.apache.howl.log.BlockLogBuffer" : bufferClassName, bufferSizeKb == 0 ? DEFAULT_BUFFER_SIZE : bufferSizeKb,
SystemInstance.get().setComponent(XAResourceWrapper.class, new GeronimoTransactionManagerFactory.GeronimoXAResourceWrapper()); xidFactory = new XidFactoryImpl(tmId == null ? new byte[]{71, 84, 77, 73, 68} : tmId); txLog = new HOWLLog(bufferClassName == null ? "org.objectweb.howl.log.BlockLogBuffer" : bufferClassName, bufferSizeKb == 0 ? 32 : bufferSizeKb, checksumEnabled, adler32Checksum, flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile,
XidFactory xidFactory = new XidFactoryImpl(pid.getBytes());
XidFactory xidFactory = new XidFactoryImpl(pid.getBytes());
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,
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,