Package org.hornetq.core.journal

Examples of org.hornetq.core.journal.SequentialFile


            break;
         }
         String fileName = entry.getValue().getA();
         final long id = entry.getKey();
         long size = entry.getValue().getB();
         SequentialFile seqFile = largeMessagesFactory.createSequentialFile(fileName, 1);
         if (!seqFile.exists())
            continue;
         if (!started)
            return;
         replicator.syncLargeMessageFile(seqFile, size, id);
      }
View Full Code Here


      List<Long> idList = new ArrayList<Long>();
      for (String filename : filenames)
      {
         Long id = getLargeMessageIdFromFilename(filename);
         idList.add(id);
         SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename, 1);
         long size = seqFile.size();
         largeMessages.put(id, new Pair<String, Long>(filename, size));
      }
      replicator.sendLargeMessageIdListMessage(largeMessages);
   }
View Full Code Here

   // Package protected ---------------------------------------------

   // This should be accessed from this package only
   void deleteLargeMessageFile(final LargeServerMessage largeServerMessage) throws HornetQException
   {
      final SequentialFile file = largeServerMessage.getFile();
      if (file == null)
      {
         return;
      }

      if (largeServerMessage.isDurable() && isReplicated())
      {
         readLock();
         try
         {
            if (isReplicated() && replicator.isSynchronizing())
            {
               synchronized (largeMessagesToDelete)
               {
                  largeMessagesToDelete.add(Long.valueOf(largeServerMessage.getMessageID()));
               }
               return;
            }
         }
         finally
         {
            readUnLock();
         }
      }
      Runnable deleteAction = new Runnable()
      {
         public void run()
         {
            try
            {
               readLock();
               try
               {
                  if (replicator != null)
                  {
                     replicator.largeMessageDelete(largeServerMessage.getMessageID());
                  }
                  file.delete();
               }
               finally
               {
                  readUnLock();
               }
View Full Code Here

      if (largeMessage.containsProperty(Message.HDR_ORIG_MESSAGE_ID))
      {
         // for compatibility: couple with old behaviour, copying the old file to avoid message loss
         long originalMessageID = largeMessage.getLongProperty(Message.HDR_ORIG_MESSAGE_ID);

         SequentialFile currentFile = createFileForLargeMessage(largeMessage.getMessageID(), true);

         if (!currentFile.exists())
         {
            SequentialFile linkedFile = createFileForLargeMessage(originalMessageID, true);
            if (linkedFile.exists())
            {
               linkedFile.copyTo(currentFile);
               linkedFile.close();
            }
         }

         currentFile.close();
      }
View Full Code Here

      if (largeMessagesFactory != null)
      {
         List<String> tmpFiles = largeMessagesFactory.listFiles("tmp");
         for (String tmpFile : tmpFiles)
         {
            SequentialFile file = largeMessagesFactory.createSequentialFile(tmpFile, -1);
            file.delete();
         }
      }
   }
View Full Code Here

    */
   private void performCachedLargeMessageDeletes()
   {
      for (Long largeMsgId : largeMessagesToDelete)
      {
         SequentialFile msg = createFileForLargeMessage(largeMsgId, LargeMessageExtension.DURABLE);
         try
         {
            msg.delete();
         }
         catch (Exception e)
         {
            HornetQServerLogger.LOGGER.journalErrorDeletingMessage(e, largeMsgId);
         }
View Full Code Here

            break;
         }
         String fileName = entry.getValue().getA();
         final long id = entry.getKey();
         long size = entry.getValue().getB();
         SequentialFile seqFile = largeMessagesFactory.createSequentialFile(fileName, 1);
         if (!seqFile.exists())
            continue;
         if (!started)
            return;
         replicator.syncLargeMessageFile(seqFile, size, id);
      }
View Full Code Here

      List<Long> idList = new ArrayList<Long>();
      for (String filename : filenames)
      {
         Long id = getLargeMessageIdFromFilename(filename);
         idList.add(id);
         SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename, 1);
         long size = seqFile.size();
         largeMessages.put(id, new Pair<String, Long>(filename, size));
      }
      replicator.sendLargeMessageIdListMessage(largeMessages);
   }
View Full Code Here

   }

   // This should be accessed from this package only
   void deleteLargeMessageFile(final LargeServerMessage largeServerMessage) throws HornetQException
   {
      final SequentialFile file = largeServerMessage.getFile();
      if (file == null)
      {
         return;
      }

      if (largeServerMessage.isDurable() && isReplicated())
      {
         readLock();
         try
         {
            if (isReplicated() && replicator.isSynchronizing())
            {
               synchronized (largeMessagesToDelete)
               {
                  largeMessagesToDelete.add(Long.valueOf(largeServerMessage.getMessageID()));
                  confirmLargeMessage(largeServerMessage);
               }
               return;
            }
         }
         finally
         {
            readUnLock();
         }
      }
      Runnable deleteAction = new Runnable()
      {
         public void run()
         {
            try
            {
               readLock();
               try
               {
                  if (replicator != null)
                  {
                     replicator.largeMessageDelete(largeServerMessage.getMessageID());
                  }
                  file.delete();

                  // The confirm could only be done after the actual delete is done
                  confirmLargeMessage(largeServerMessage);
               }
               finally
View Full Code Here

      if (largeMessage.containsProperty(Message.HDR_ORIG_MESSAGE_ID))
      {
         // for compatibility: couple with old behaviour, copying the old file to avoid message loss
         long originalMessageID = largeMessage.getLongProperty(Message.HDR_ORIG_MESSAGE_ID);

         SequentialFile currentFile = createFileForLargeMessage(largeMessage.getMessageID(), true);

         if (!currentFile.exists())
         {
            SequentialFile linkedFile = createFileForLargeMessage(originalMessageID, true);
            if (linkedFile.exists())
            {
               linkedFile.copyTo(currentFile);
               linkedFile.close();
            }
         }

         currentFile.close();
      }
View Full Code Here

TOP

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

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.