Package org.jboss.messaging.core.impl.tx

Examples of org.jboss.messaging.core.impl.tx.TransactionRepository


         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         messageIDMgr = new RotatingID(serverPeerID);
         txRepository =
            new TransactionRepository(persistenceManager, messageStore, serverPeerID);
         messageCounterManager = new MessageCounterManager(messageCounterSamplePeriod);

         clusterNotifier = new DefaultClusterNotifier();
         clusterNotifier.registerListener(connectionManager);
         clusterNotifier.registerListener(connFactoryJNDIMapper);
View Full Code Here


   {
      doSetup(batch, useBinaryStream, trailingByte, 100);

      Channel channel = new SimpleChannel(0, ms);

      TransactionRepository txRep = new TransactionRepository(pm, ms, 0);
      txRep.start();

      log.debug("transaction log started");

      Message[] messages = createMessages(10);

      Message m1 = messages[0];
      Message m2 = messages[1];
      Message m3 = messages[2];
      Message m4 = messages[3];
      Message m5 = messages[4];

      Transaction tx = null;
      if (xa)
      {
         tx = txRep.createTransaction(new MockXid());
      }
      else
      {
         tx = txRep.createTransaction();
      }

      if (xa)
      {
        assertEquals(1,txRep.getNumberOfRegisteredTransactions());
      }
      else
      {
        assertEquals(0,txRep.getNumberOfRegisteredTransactions());
      }

      MessageReference ref1 = ms.reference(m1);
      MessageReference ref2 = ms.reference(m2);
      MessageReference ref3 = ms.reference(m3);
      MessageReference ref4 = ms.reference(m4);
      MessageReference ref5 = ms.reference(m5);

      log.debug("adding references non-transactionally");

      // Add first two refs non transactionally
      pm.addReference(channel.getChannelID(), ref1, null);
      pm.addReference(channel.getChannelID(), ref2, null);

      //check they're there
      List refs = getReferenceIds(channel.getChannelID());
      assertNotNull(refs);
      assertEquals(2, refs.size());
      assertTrue(refs.contains(new Long(ref1.getMessage().getMessageID())));
      assertTrue(refs.contains(new Long(ref2.getMessage().getMessageID())));

      List msgs = getMessageIds();
      assertNotNull(msgs);
      assertEquals(2, msgs.size());
      assertTrue(msgs.contains(new Long(ref1.getMessage().getMessageID())));
      assertTrue(msgs.contains(new Long(ref2.getMessage().getMessageID())));

      log.debug("ref1 and ref2 are there");

      //Add the next 3 refs transactionally
      pm.addReference(channel.getChannelID(), ref3, tx);
      pm.addReference(channel.getChannelID(), ref4, tx);
      pm.addReference(channel.getChannelID(), ref5, tx);

      //Remove the other 2 transactionally
      pm.removeReference(channel.getChannelID(), ref1, tx);
      pm.removeReference(channel.getChannelID(), ref2, tx);

      //Check the changes aren't visible
      refs = getReferenceIds(channel.getChannelID());
      assertNotNull(refs);
      assertEquals(2, refs.size());
      assertTrue(refs.contains(new Long(ref1.getMessage().getMessageID())));
      assertTrue(refs.contains(new Long(ref2.getMessage().getMessageID())));

      msgs = getMessageIds();
      assertNotNull(msgs);
      assertEquals(2, msgs.size());
      assertTrue(msgs.contains(new Long(ref1.getMessage().getMessageID())));
      assertTrue(msgs.contains(new Long(ref2.getMessage().getMessageID())));

      //commit transaction
      tx.commit();

      assertEquals("numberOfRegisteredTransactions",0,txRep.getNumberOfRegisteredTransactions());

      //check we can see only the last 3 refs
      refs = getReferenceIds(channel.getChannelID());
      assertNotNull(refs);
      assertEquals(3, refs.size());
View Full Code Here

   {
      doSetup(batch, useBinaryStream, trailingByte, 100);

      Channel channel = new SimpleChannel(0, ms);

      TransactionRepository txRep = new TransactionRepository(pm, ms, 0);
      txRep.start();

      Message[] messages = createMessages(10);

      Message m1 = messages[0];
      Message m2 = messages[1];
      Message m3 = messages[2];
      Message m4 = messages[3];
      Message m5 = messages[4];


      Transaction tx = null;
      if (xa)
      {
         tx = txRep.createTransaction(new MockXid());
      }
      else
      {
         tx = txRep.createTransaction();
      }

      MessageReference ref1 = ms.reference(m1);
      MessageReference ref2 = ms.reference(m2);
      MessageReference ref3 = ms.reference(m3);
View Full Code Here

         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         messageIDMgr = new RotatingID(serverPeerID);
         txRepository =
            new TransactionRepository(persistenceManager, messageStore, serverPeerID);
         messageCounterManager = new MessageCounterManager(messageCounterSamplePeriod);

         clusterNotifier = new DefaultClusterNotifier();
         clusterNotifier.registerListener(connectionManager);
         clusterNotifier.registerListener(connFactoryJNDIMapper);
View Full Code Here

         MessageStore ms = serverPeer.getMessageStore();
        
         PersistenceManager pm = serverPeer.getPersistenceManagerInstance();
        
         TransactionRepository tr = serverPeer.getTxRepository();
        
         IDManager idManager = serverPeer.getChannelIDManager();
        
         int nodeId = serverPeer.getServerPeerID();
        
View Full Code Here

         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         messageIDMgr = new RotatingID(serverPeerID);
         txRepository =
            new TransactionRepository(persistenceManager, messageStore, serverPeerID);
         messageCounterManager = new MessageCounterManager(messageCounterSamplePeriod);

         clusterNotifier = new DefaultClusterNotifier();
         clusterNotifier.registerListener(connectionManager);
         clusterNotifier.registerListener(connFactoryJNDIMapper);
View Full Code Here

         connectionManager = new SimpleConnectionManager();        
         connectorManager = new SimpleConnectorManager();
         memoryManager = new SimpleMemoryManager();
         messageStore = new SimpleMessageStore();
         txRepository =
            new TransactionRepository(persistenceManager, messageStore, transactionIDManager);
         messageCounterManager = new MessageCounterManager(messageCounterSamplePeriod);
               
         clusterNotifier = new DefaultClusterNotifier();     
         clusterNotifier.registerListener(connectionManager);
         clusterNotifier.registerListener(connFactoryJNDIMapper);
View Full Code Here

      idm.start();
     
      ms = new SimpleMessageStore();
      ms.start();
     
      tr = new TransactionRepository(pm, ms, idm);
      tr.start();
     
   }
View Full Code Here

      transactionIDManager.start();

      ms = new SimpleMessageStore();
      ms.start();

      tr = new TransactionRepository(pm, ms, transactionIDManager);
      tr.start();

      channelIDManager = new IDManager("CHANNEL_ID", 10, pm);
      channelIDManager.start();
View Full Code Here

      idm.start();
     
      ms = new SimpleMessageStore();
      ms.start();
     
      tr = new TransactionRepository(pm, ms, idm);
      tr.start();         
     
      ms.clear();
   }
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.impl.tx.TransactionRepository

Copyright © 2018 www.massapicom. 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.