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(); } }
VanillaDataCache( @NotNull ChronicleQueueBuilder.VanillaChronicleQueueBuilder builder, @NotNull VanillaDateCache dateCache, int blockBits) { this.fileLifecycleListener = builder.fileLifecycleListener(); this.basePath = builder.path().getAbsolutePath(); this.blockBits = blockBits; this.dateCache = dateCache; this.cache = new VanillaMappedCache<>( builder.dataCacheCapacity(), true, builder.cleanupOnClose() ); }