Package org.jboss.messaging.core.impl

Examples of org.jboss.messaging.core.impl.RotatingID


      this.messageStore = store;

      map = new ConcurrentHashMap();

      txID = new RotatingID(nodeID);
   }
View Full Code Here


         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         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();
View Full Code Here

         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         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();
View Full Code Here

         connFactoryJNDIMapper = new ConnectionFactoryJNDIMapper(this);
         connectionManager = new SimpleConnectionManager();
         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();
View Full Code Here

   {
      final int NUM_ITERS = 1000;

      Set<Long> ids = new HashSet<Long>(NUM_ITERS);

      RotatingID id = new RotatingID(63);

      for (int i = 0; i < NUM_ITERS; i++)
      {
         long l = id.getID();

         if (ids.contains(l))
         {
            fail("Already produced id " + l);
         }
View Full Code Here

  
   public void testNodeIDLimits() throws Exception
   {
      //max id 1023, fine
      int nodeID = 0x03FF;
      new RotatingID(nodeID);
     
      //min id 0, fine
      new RotatingID(0);
     
      //wrong id 1024, exceeding max
      nodeID = 1024;
      try
      {
         new RotatingID(nodeID);
         fail("shouldn't allow values greater than 1023!");
      }
      catch (IllegalArgumentException e)
      {
         //ignore
      }
     
      //negative id
      nodeID = -1;
      try
      {
         new RotatingID(nodeID);
         fail("shouldn't allow negative values!");
      }
      catch (IllegalArgumentException e)
      {
         //ignore
View Full Code Here

   //Because we now use 4th to 42nd bits of time,
   //the max rate of generating id should never be greater than 4096000 ids/sec.
   public void testIDGenSpeed() throws Exception
   {
      RotatingID id = new RotatingID(555);

      long beginTm = System.currentTimeMillis();
     
      final int NUM_IDS = 4096000;
     
      for (int i = 0; i < NUM_IDS; i++)
      {
         id.getID();
      }

      long endTm = System.currentTimeMillis();
     
      long dur = (endTm - beginTm)/1000;
View Full Code Here

   //in order to examine that the node id field is not
   //overlapped with the time field.
   public void testRotatingIDStructure() throws Exception
   {
      final int nodeID = 0x0200;
      RotatingID id = new RotatingID(nodeID);
      final int NUM_ID = 65535;
      Set<Long> ids = new HashSet<Long>(NUM_ID);
      List<Long> idlst = new ArrayList<Long>(NUM_ID);

      long beginTm = System.currentTimeMillis();
     
      try
      {
         Thread.sleep(1000);
      }
      catch (InterruptedException e)
      {
         //ignore
      }
     
      for (int i = 0; i < NUM_ID; i++)
      {
         long mid = id.getID();
         if (ids.contains(mid))
         {
            fail("Already produced id " + mid);
         }
         ids.add(mid);
View Full Code Here

      int nid = rand.nextInt(1024);
      for (int i = 0; i < numNodes; i++)
      {
         int id = (nid+i)%1024;
         log.info("Random node id: " + id);
         pool.execute(new IDGenerator(new RotatingID(id), ids));
      }
     
      pool.shutdown();
      pool.awaitTermination(600, TimeUnit.SECONDS);
     
View Full Code Here

   {
      final int NUM_ITERS = 1000;

      Set<Long> ids = new HashSet<Long>(NUM_ITERS);

      RotatingID id = new RotatingID(63);

      for (int i = 0; i < NUM_ITERS; i++)
      {
         long l = id.getID();

         if (ids.contains(l))
         {
            fail("Already produced id " + l);
         }
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.impl.RotatingID

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.