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

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


   {
      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

      pm.start();

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

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

      ms.clear();
   }
View Full Code Here

      pm.start();

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

      tr = new TransactionRepository(pm, ms, 0);

      tr.start();

      MessagingQueue queue2 = new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 10, false, 300000);
View Full Code Here

      pm.start();

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

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

      MessagingQueue queue2 = new MessagingQueue(1, "queue1", 1, ms, pm, false, -1, null, 100, 20, 10, false, 300000);

      queue2.load();
View Full Code Here

      pm.start();

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

      tr = new TransactionRepository(pm, ms, 0);

      tr.start();

      MessagingQueue queue2 =
         new MessagingQueue(1, "queue1", 1, ms, pm, true, -1, null, 100, 20, 20, false, 300000);
View Full Code Here

      pm.start();

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

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

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

      pm.start();

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

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

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

/*  253 */       this.connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
/*  254 */       this.connectionManager = new SimpleConnectionManager();
/*  255 */       this.connectorManager = new SimpleConnectorManager();
/*  256 */       this.memoryManager = new SimpleMemoryManager();
/*  257 */       this.messageStore = new SimpleMessageStore();
/*  258 */       this.txRepository = new TransactionRepository(this.persistenceManager, this.messageStore, this.transactionIDManager);
/*      */
/*  260 */       this.messageCounterManager = new MessageCounterManager(this.messageCounterSamplePeriod);
/*      */
/*  262 */       this.clusterNotifier = new DefaultClusterNotifier();
/*  263 */       this.clusterNotifier.registerListener(this.connectionManager);
View Full Code Here

/*     */
/* 351 */       MessageStore ms = serverPeer.getMessageStore();
/*     */
/* 353 */       PersistenceManager pm = serverPeer.getPersistenceManagerInstance();
/*     */
/* 355 */       TransactionRepository tr = serverPeer.getTxRepository();
/*     */
/* 357 */       IDManager idManager = serverPeer.getChannelIDManager();
/*     */
/* 359 */       int nodeId = serverPeer.getServerPeerID();
/*     */
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.