Examples of TransactionLog


Examples of org.apache.qpid.server.store.TransactionLog

     * implemented by the store, and verifying the behaviour using BDB
     * implementation methods.
     */
    public void testTranRollbackAfterCommit() throws Exception
    {
        TransactionLog log = getVirtualHost().getTransactionLog();

        BDBMessageStore bdbStore = assertBDBStore(log);

        final AMQShortString mockQueueName = new AMQShortString("queueName");
       
        TransactionLogResource mockQueue = new TransactionLogResource()
        {
            public String getResourceName()
            {
                return mockQueueName.asString();
            }
        };
       
        TransactionLog.Transaction txn = log.newTransaction();
       
        txn.enqueueMessage(mockQueue, 30L);
        txn.commitTran();

        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, 31L);
        txn.abortTran();
       
        txn = log.newTransaction();
        txn.enqueueMessage(mockQueue, 32L);
        txn.commitTran();
       
        List<Long> enqueuedIds = bdbStore.getEnqueuedMessages(mockQueueName);
       
View Full Code Here

Examples of org.apache.qpid.server.store.TransactionLog

        _state = TransactionState.ABORTED;
    }

    public static TransactionLog createTestTransactionLog(final MockStoreTransaction storeTransaction)
    {
        return new TransactionLog()
        {
   
            @Override
            public void configureTransactionLog(String name, TransactionLogRecoveryHandler recoveryHandler,
                    Configuration storeConfiguration, LogSubject logSubject) throws Exception
View Full Code Here

Examples of org.exolab.jms.tranlog.TransactionLog

            throws TransactionLogException, ResourceManagerException {
        ExternalXid txid = new ExternalXid(xid);
        switch (state.getOrd()) {
            case TransactionState.OPENED_ORD:
                {
                    TransactionLog log = getCurrentTransactionLog();
                    addTridLogEntry(txid, log);
                    log.logTransactionState(txid, _txExpiryTime * 1000, _rid,
                                            state);

                    // cache the transaction state
                    _activeTransactions.put(txid, new LinkedList());
                }
                break;

            case TransactionState.PREPARED_ORD:
                // cache the transaction state
                LinkedList list = (LinkedList) _activeTransactions.get(txid);
                if (list != null) {
                    list.add(state);
                } else {
                    throw new ResourceManagerException("Trasaction " + txid +
                                                       " is not active.");
                }
                break;

            case TransactionState.CLOSED_ORD:
                {
                    TransactionLog log = getTransactionLog(txid);
                    log.logTransactionState(txid, _txExpiryTime * 1000, _rid,
                                            state);
                    removeTridLogEntry(txid, log);

                    // check whether this log has anymore open transactions
                    synchronized (_cacheLock) {
                        if ((_logToTridCache.get(log) == null) &&
                                (!isCurrentTransactionLog(log))) {
                            log.close();

                            // now check if gc mode is GC_SYNCHRONOUS. If it is
                            // remove the log file
                            if (_gcMode == GC_SYNCHRONOUS) {
                                try {
                                    log.destroy();
                                } catch (TransactionLogException exception) {
                                    exception.printStackTrace();
                                }
                            }
                        }
View Full Code Here

Examples of org.exolab.jms.tranlog.TransactionLog

            // current log file
            copy.remove(_logs.last());

            // process each of the remaining log files
            while (copy.size() > 0) {
                TransactionLog log = (TransactionLog) copy.first();
                copy.remove(log);
                if (log.canGarbageCollect()) {
                    // destroy the log
                    log.destroy();

                    // remove it from the log cache
                    synchronized (_logs) {
                        _logs.remove(log);
                    }
View Full Code Here

Examples of org.exolab.jms.tranlog.TransactionLog

     *
     * @throws ResourceManagerException
     */
    protected TransactionLog createNextTransactionLog()
            throws ResourceManagerException {
        TransactionLog newlog = null;

        synchronized (_logs) {
            try {
                // get the last log number
                long last = 1;
                if (!_logs.isEmpty()) {
                    last
                            = getSequenceNumber(
                                    ((TransactionLog) _logs.last()).getName());
                }

                // now that we have the last log number, increment it and use
                // it to build the name of the next log file.
                String name = _logDirectory
                        + System.getProperty("file.separator") +
                        RM_LOGFILE_PREFIX + Long.toString(++last)
                        + RM_LOGFILE_EXTENSION;

                // create a transaction log and add it to the collection
                newlog = new TransactionLog(name, true);
                _logs.add(newlog);
            } catch (TransactionLogException exception) {
                throw new ResourceManagerException(
                        "Error in createNextTransactionLog " + exception);
            }
View Full Code Here

Examples of org.exolab.jms.tranlog.TransactionLog

            });

            // add the files to the list
            synchronized (_logs) {
                for (int index = 0; index < list.length; index++) {
                    _logs.add(new TransactionLog(list[index].getPath(), false));
                }
            }
        } catch (Exception exception) {
            // replace this with the exception strategy
            exception.printStackTrace();
View Full Code Here

Examples of org.exolab.jms.tranlog.TransactionLog

            throws ResourceManagerException {
        try {
            if (!_logs.isEmpty()) {
                Iterator iter = _logs.iterator();
                while (iter.hasNext()) {
                    TransactionLog log = (TransactionLog) iter.next();
                    HashMap records = log.recover();
                }
            }
        } catch (Exception exception) {
            throw new ResourceManagerException("Error in recover " +
                                               exception.toString());
View Full Code Here

Examples of org.exolab.jms.tranlog.TransactionLog

     * @throws TransactionLogException  - if there is tx log exception
     * @throws ResourceManagerException - if there is a resource problem.
     */
    private TransactionLog getTransactionLog(ExternalXid txid)
            throws TransactionLogException, ResourceManagerException {
        TransactionLog log = (TransactionLog) _tridToLogCache.get(txid);
        if (log == null) {
            log = getCurrentTransactionLog();
            addTridLogEntry(txid, log);
        }

View Full Code Here

Examples of org.exolab.jms.tranlog.TransactionLog

     * @throws ResourceManagerException
     * @throws TransactionLogException
     */
    private TransactionLog getCurrentTransactionLog()
            throws TransactionLogException, ResourceManagerException {
        TransactionLog log = null;

        synchronized (_logs) {
            if (_logs.size() > 0) {
                log = (TransactionLog) _logs.last();
            }

            if ((log == null) ||
                    (log.size() > _logFileSize)) {
                log = createNextTransactionLog();
            }
        }

        return log;
View Full Code Here

Examples of org.infinispan.transaction.TransactionLog

      } else if (componentType.equals(PassivationManager.class)) {
         return (T) new PassivationManagerImpl();
      } else if (componentType.equals(BatchContainer.class)) {
         return (T) new BatchContainer();
      } else if (componentType.equals(TransactionLog.class)) {
         return (T) new TransactionLog();
      } else if (componentType.equals(TransactionCoordinator.class)) {
         return (T) new TransactionCoordinator();
      } else if (componentType.equals(RecoveryAdminOperations.class)) {
         return (T) new RecoveryAdminOperations();
      } else if (componentType.equals(StateTransferLock.class)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.