this.chronicle = ChronicleQueueBuilder.vanilla(pathToChronicle).cycleLength((int)this.queueRollingInterval).cycleFormat(this.cycleFormat).build(); this.queueConsumer = new DefaultStreamingMessageQueueConsumer(this.getId(), this.chronicle.createTailer(), this.queueWaitStrategy); this.queueProducer = new DefaultStreamingMessageQueueProducer(this.getId(), this.chronicle.createAppender(), this.queueWaitStrategy);
VanillaChronicle(ChronicleQueueBuilder.VanillaChronicleQueueBuilder builder) { this.builder = builder.clone(); this.lifecycleListener = this.builder.fileLifecycleListener(); this.marshallersCache = new ThreadLocal<>(); this.tailerCache = new ThreadLocal<>(); this.appenderCache = new ThreadLocal<>(); this.name = builder.path().getName(); this.dateCache = new VanillaDateCache( builder.path(), builder.cycleFormat(), builder.cycleLength(), builder.cycleTimeZone()); this.indexBlockSizeBits = Maths.intLog2(builder.indexBlockSize()); this.indexBlockSizeMask = -1 >>> -indexBlockSizeBits; this.indexBlockLongsBits = indexBlockSizeBits - 3; this.indexBlockLongsMask = indexBlockSizeMask >>> 3; this.indexCache = new VanillaIndexCache(this.builder, dateCache, indexBlockSizeBits, builder.fileLifecycleListener()); this.dataBlockSizeBits = Maths.intLog2(builder.dataBlockSize()); this.dataBlockSizeMask = -1 >>> -dataBlockSizeBits; this.dataCache = new VanillaDataCache(this.builder, dateCache, dataBlockSizeBits); this.entriesForCycleBits = Maths.intLog2(this.builder.entriesPerCycle()); this.entriesForCycleMask = -1L >>> -entriesForCycleBits; if (!VanillaChronicleUtils.exists(builder.path())) { builder.path().mkdirs(); } }
public VanillaChronicleQueueBuilder cycle(VanillaChronicle.Cycle cycle) { cycleFormat(cycle.format()); cycleLength(cycle.length(), false); entriesPerCycle(cycle.entries()); return this; }