Package org.hornetq.core.journal

Examples of org.hornetq.core.journal.IOAsyncTask


      final List<String> msgsResult = new ArrayList<String>();

      final CountDownLatch latch = new CountDownLatch(1);

      ctx.executeOnCompletion(new IOAsyncTask()
      {
         public void onError(final int errorCode, final String errorMessage)
         {
            lastError.set(errorCode);
            msgsResult.add(errorMessage);
            latch.countDown();
         }

         public void done()
         {
         }
      });

      Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));

      Assert.assertEquals(5, lastError.get());

      Assert.assertEquals(1, msgsResult.size());

      Assert.assertEquals(msg, msgsResult.get(0));

      final CountDownLatch latch2 = new CountDownLatch(1);

      // Adding the Task after the exception should still throw an exception
      ctx.executeOnCompletion(new IOAsyncTask()
      {
         public void onError(final int errorCode, final String errorMessage)
         {
            lastError.set(errorCode);
            msgsResult.add(errorMessage);
            latch2.countDown();
         }

         public void done()
         {
         }
      });

      Assert.assertTrue(latch2.await(5, TimeUnit.SECONDS));

      Assert.assertEquals(2, msgsResult.size());

      Assert.assertEquals(msg, msgsResult.get(0));

      Assert.assertEquals(msg, msgsResult.get(1));

      final CountDownLatch latch3 = new CountDownLatch(1);

      ctx.executeOnCompletion(new IOAsyncTask()
      {
         public void onError(final int errorCode, final String errorMessage)
         {
         }
View Full Code Here


    * @return
    */
   private void blockOnReplication(final StorageManager storage, final ReplicationManagerImpl manager) throws Exception
   {
      final CountDownLatch latch = new CountDownLatch(1);
      storage.afterCompleteOperations(new IOAsyncTask()
      {

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

         Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);

         replicatedJournal.appendPrepareRecord(1, new FakeData(), false);

         final CountDownLatch latch = new CountDownLatch(1);
         storage.afterCompleteOperations(new IOAsyncTask()
         {

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

            if (i % 2 == 0)
            {
               replicatedJournal.appendPrepareRecord(i, new FakeData(), false);
            }

            ctx.executeOnCompletion(new IOAsyncTask()
            {

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

      if (persistent)
      {
         store.storeCursorAcknowledge(cursorId, position);
      }

      store.afterCompleteOperations(new IOAsyncTask()
      {

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

      queue.acknowledge(tx, reference);

      tx.commit();

      storageManager.afterCompleteOperations(new IOAsyncTask()
      {

         public void onError(final int errorCode, final String errorMessage)
         {
            Redistributor.log.warn("IO Error during redistribution, errorCode = " + errorCode +
View Full Code Here

                  // This one will stay here forever
                  storage.storeMessage(message);

                  storage.commit(tx);

                  ctx.executeOnCompletion(new IOAsyncTask()
                  {
                     public void onError(int errorCode, String errorMessage)
                     {
                     }
View Full Code Here

      if (state != JournalImpl.STATE_LOADED)
      {
         throw new IllegalStateException("The journal is not loaded " + state);
      }

      final IOAsyncTask callback;

      int size = encoder.getEncodeSize();

      // We take into account the fileID used on the Header
      if (size > fileSize - currentFile.getFile().calculateBlockStart(JournalImpl.SIZE_HEADER))
View Full Code Here

      {
         OperationContextImpl impl = new OperationContextImpl(executor);
         final CountDownLatch latch1 = new CountDownLatch(1);
         final CountDownLatch latch2 = new CountDownLatch(1);
        
         impl.executeOnCompletion(new IOAsyncTask()
         {
           
            public void onError(int errorCode, String errorMessage)
            {
            }
           
            public void done()
            {
               latch1.countDown();
            }
         });
        
         assertTrue(latch1.await(10, TimeUnit.SECONDS));
        
         for (int i = 0 ; i < 10; i++) impl.storeLineUp();
         for (int i = 0 ; i < 3; i++) impl.pageSyncLineUp();

         impl.executeOnCompletion(new IOAsyncTask()
         {
           
            public void onError(int errorCode, String errorMessage)
            {
            }
View Full Code Here

      failures.set(0);

      final AtomicInteger operations = new AtomicInteger(0);

      // We should be up to date with lineUps and executions. this should now just finish processing
      context.executeOnCompletion(new IOAsyncTask()
      {

         public void done()
         {
            operations.incrementAndGet();
View Full Code Here

TOP

Related Classes of org.hornetq.core.journal.IOAsyncTask

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.