0

I have a chronicle reader (ExcerptTailer), Code follows,

 ChronicleQueue queue = ChronicleQueueBuilder.single(chroniclePath).storeFileListener(new StoreFileListener() {

        @Override
        public void onReleased(int cycle, File file) {
            if (file != null) {
                try {
                    file.delete();
                } catch (Exception e) {
                }
            }
        }
    }).rollCycle(RollCycles.HOURLY).build();
ExcerptTailer excerptTailer = queueForReader.createTailer();

I implemented the onRealease method for deleting completed file. But my problem is that the file got deleted on calling the queue.close()because of the code inside onRelease method. In this case how can I understand that the file read isn't completed inside onReleased ? Or is there a better way to implement my case?

Devas
  • 1,544
  • 4
  • 23
  • 28
  • queue.close() doesn't delete anything. Are you saying the space wasn't free up until the queue was closed? – Peter Lawrey Jan 08 '18 at 13:32
  • Are you saying queue.close() doesn't call onRelease method? I think my question was not clear just updated. The file got deleted because of my onRelease implementation, I think. – Devas Jan 08 '18 at 18:00
  • Ok, I think I know what you mean. We need to add a way to make it clear then a tailer no longer needs a cycle. – Peter Lawrey Jan 08 '18 at 19:26
  • So, Is it an expected behavior ? (Calling onRelease on queue.close()) – Devas Jan 10 '18 at 12:26

0 Answers0