Package org.hornetq.core.persistence

Examples of org.hornetq.core.persistence.OperationContext


   {
      if (!enabled)
         return;
      boolean runItNow = false;

      OperationContext repliToken = OperationContextImpl.getContext(executorFactory);
      if (lineUp)
      {
         repliToken.replicationLineUp();
      }

      synchronized (replicationLock)
      {
         if (enabled)
         {
            pendingTokens.add(repliToken);
            replicatingChannel.send(packet);
         }
         else
         {
            // Already replicating channel failed, so just play the action now
            runItNow = true;
         }
      }

      // Execute outside lock

      if (runItNow)
      {
         repliToken.replicationDone();
      }
   }
View Full Code Here


    *            response. If your packets are triggering this exception, it may be because the
    *            packets were not sent with {@link #sendReplicatePacket(Packet)}.
    */
   private void replicated()
   {
      OperationContext ctx = pendingTokens.poll();

      if (ctx == null)
      {
         throw new IllegalStateException("Missing replication token on the queue.");
      }

      ctx.replicationDone();
   }
View Full Code Here

      return name;
   }

   public Response propose(final Proposal proposal) throws Exception
   {
      OperationContext originalCtx = storageManager.getContext();

      try
      {
         // the waitCompletion cannot be done inside an ordered executor or we would starve when the thread pool is full
         storageManager.setContext(storageManager.newSingleThreadContext());
View Full Code Here

   /**
    *
    */
   protected void asyncAppendCommit()
   {
      final OperationContext ctx = storageManager.getContext();
      storageManager.afterCompleteOperations(new IOAsyncTask()
      {
         public void onError(int errorCode, String errorMessage)
         {
            HornetQServerLogger.LOGGER.error("Error=" + errorCode + ", message=" + errorMessage);
         }

         public void done()
         {
            OperationContext originalCtx = storageManager.getContext();
            try
            {
               storageManager.setContext(ctx);
               storageManager.commit(id, false);
            }
View Full Code Here

         server.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true, false);

         final CountDownLatch pageUp = new CountDownLatch(0);
         final CountDownLatch pageDone = new CountDownLatch(1);

         OperationContext ctx = new OperationContext()
         {

            public void onError(int errorCode, String errorMessage)
            {
            }
View Full Code Here

         server.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true, false);

         final CountDownLatch pageUp = new CountDownLatch(0);
         final CountDownLatch pageDone = new CountDownLatch(1);

         OperationContext ctx = new OperationContext()
         {

            public void onError(int errorCode, String errorMessage)
            {
            }
View Full Code Here

         sync();
      }

      void sync() throws Exception
      {
         OperationContext originalTX = OperationContextImpl.getContext();

         try
         {
            // We only want to sync paging here, no need to wait for any other events
            OperationContextImpl.clearContext();

            for (PagingStore store : storesToSync)
            {
               store.sync();
            }

            // We can't perform a commit/sync on the journal before we can assure page files are synced or we may get
            // out of sync
            OperationContext ctx = OperationContextImpl.getContext();

            if (ctx != null)
            {
               // if null it means there were no operations done before, hence no need to wait any completions
               ctx.waitCompletion();
            }
         }
         finally
         {
            OperationContextImpl.setContext(originalTX);
View Full Code Here

      setStarted(false);
   }

   public void waitContextCompletion()
   {
      OperationContext formerCtx = storageManager.getContext();

      try
      {
         try
         {
View Full Code Here

      }
   }

   public void close(final boolean failed)
   {
      OperationContext formerCtx = storageManager.getContext();

      try
      {
         storageManager.setContext(sessionContext);
View Full Code Here

   /**
    *
    */
   protected void asyncAppendCommit()
   {
      final OperationContext ctx = storageManager.getContext();
      storageManager.afterCompleteOperations(new IOAsyncTask()
      {
         public void onError(int errorCode, String errorMessage)
         {
         }
        
         public void done()
         {
            OperationContext originalCtx = storageManager.getContext();
            try
            {
               storageManager.setContext(ctx);
               storageManager.commit(id, false);
            }
View Full Code Here

TOP

Related Classes of org.hornetq.core.persistence.OperationContext

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.