Package com.nokia.dempsy.router.DecentralizedRoutingStrategy

Examples of com.nokia.dempsy.router.DecentralizedRoutingStrategy.DefaultRouterSlotInfo


               ClusterInfoSession originalSession = dempsy.getCluster(new ClusterId("test-app","test-cluster1")).getNodes().get(0).retouRteg().getClusterSession();
               ClusterInfoSessionFactory factory = dempsy.getClusterSessionFactory();

               String path = clusterId.asPath() + "/" + String.valueOf(0);
               session = TestUtils.stealShard(originalSession, factory, path,baseTimeoutMillis);
               DefaultRouterSlotInfo si = (DefaultRouterSlotInfo)session.getData(path, null);
               assertTrue(si.getDestination() instanceof JunkDestination); // checks to see who actually has the slot.

               // we will keep disrupting the session but we should still end up with zero mps.
               for (int i = 0; i < 100; i++)
               {
                  ((DisruptibleSession)originalSession).disrupt();
View Full Code Here


    */
   public static ClusterInfoSession stealShard(final ClusterInfoSession originalSession, final ClusterInfoSessionFactory factory,
         final String shardPath, final long timeoutmillis) throws InterruptedException, ClusterInfoException
   {
      // get the current slot data to use as a template
      final DefaultRouterSlotInfo newSlot = (DefaultRouterSlotInfo)originalSession.getData(shardPath, null);

      final AtomicBoolean stillRunning = new AtomicBoolean(true);
      final AtomicBoolean failed = new AtomicBoolean(false);

      final ClusterInfoSession session = factory.createSession();
     
      Runnable slotGrabber = new Runnable()
      {
         @Override
         public void run()
         {
            try
            {
               Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
               boolean haveSlot = false;
               while (!haveSlot && stillRunning.get())
               {
                  newSlot.setDestination(new JunkDestination());
                  if (session.mkdir(shardPath,newSlot,DirMode.EPHEMERAL) != null)
                     haveSlot = true;
                  Thread.yield();
               }
            }
View Full Code Here

TOP

Related Classes of com.nokia.dempsy.router.DecentralizedRoutingStrategy.DefaultRouterSlotInfo

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.