public StoreFileListener storeFileListener() { return storeFileListener == null ? (cycle, file) -> { if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "File released " + file); } : storeFileListener; }
@Override public synchronized void release(@NotNull CommonStore store) { store.release(); long refCount = store.refCount(); assert refCount >= 0; if (refCount == 0) { for (Map.Entry<RollDetails, WeakReference<WireStore>> entry : stores.entrySet()) { WeakReference<WireStore> ref = entry.getValue(); if (ref != null && ref.get() == store) { stores.remove(entry.getKey()); storeFileListener.onReleased(entry.getKey().cycle(), store.file()); return; } } if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "Store was not registered: " + store.file()); } }
averageMove = OS.pageSize(); lastPos = pos; if (Jvm.isDebugEnabled(getClass())) { String message = getFile(bytes) + " - Reset pretoucher to pos " + pos + " as the underlying MappedBytes changed."; debug(message); if (pretouch < count) { minHeadRoom += 256 << 10; if (Jvm.isDebugEnabled(getClass())) debug("pretouch for only " + pretouch + " of " + count + " min: " + (minHeadRoom >> 20) + " MB."); if (Jvm.isDebugEnabled(getClass())) { String message = getFile(bytes) + ": Advanced " + (pos - lastTouchedPos) / 1024 + " KB, " + "avg " + averageMove / 1024 + " KB " +
if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "Attempt to find " + Long.toHexString(position), e);
/** * used by the pretoucher to acquire the next cycle file, but does NOT do the roll. If configured, * we acquire the cycle file early */ private void assignCurrentCycle() { final int qCycle = queue.cycle(pretouchTimeProvider); if (qCycle != currentCycle) { releaseResources(); queue.writeLock().lock(); try { currentCycleWireStore = queue.storeForCycle(qCycle, queue.epoch(), true); } finally { queue.writeLock().unlock(); } currentCycleMappedBytes = currentCycleWireStore.bytes(); currentCycle = qCycle; if (chunkListener != null) currentCycleMappedBytes.setNewChunkListener(chunkListener); cycleChangedListener.accept(qCycle); if (EARLY_ACQUIRE_NEXT_CYCLE) if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "Pretoucher ROLLING early to next file=" + currentCycleWireStore.file()); } }
private static void logNewChunk(String filename, int chunk, long delayMicros) { if (!Jvm.isDebugEnabled(MappedFile.class)) return; // avoid a GC while trying to memory map. String message = BytesInternal.acquireStringBuilder() .append("Allocation of ").append(chunk) .append(" chunk in ").append(filename) .append(" took ").append(delayMicros / 1e3).append(" ms.") .toString(); Jvm.debug().on(MappedFile.class, message); }
public StoreFileListener storeFileListener() { return storeFileListener == null ? (cycle, file) -> { if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "File released " + file); } : storeFileListener; }
@Override public synchronized void release(@NotNull CommonStore store) { store.release(); long refCount = store.refCount(); assert refCount >= 0; if (refCount == 0) { for (Map.Entry<RollDetails, WeakReference<WireStore>> entry : stores.entrySet()) { WeakReference<WireStore> ref = entry.getValue(); if (ref != null && ref.get() == store) { stores.remove(entry.getKey()); storeFileListener.onReleased(entry.getKey().cycle(), store.file()); return; } } if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "Store was not registered: " + store.file()); } }
averageMove = OS.pageSize(); lastPos = pos; if (Jvm.isDebugEnabled(getClass())) { String message = getFile(bytes) + " - Reset pretoucher to pos " + pos + " as the underlying MappedBytes changed."; debug(message); if (pretouch < count) { minHeadRoom += 256 << 10; if (Jvm.isDebugEnabled(getClass())) debug("pretouch for only " + pretouch + " of " + count + " min: " + (minHeadRoom >> 20) + " MB."); if (Jvm.isDebugEnabled(getClass())) { String message = getFile(bytes) + ": Advanced " + (pos - lastTouchedPos) / 1024 + " KB, " + "avg " + averageMove / 1024 + " KB " +
if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "Attempt to find " + Long.toHexString(position), e);
/** * used by the pretoucher to acquire the next cycle file, but does NOT do the roll. If configured, * we acquire the cycle file early */ private void assignCurrentCycle() { final int qCycle = queue.cycle(pretouchTimeProvider); if (qCycle != currentCycle) { releaseResources(); queue.writeLock().lock(); try { currentCycleWireStore = queue.storeForCycle(qCycle, queue.epoch(), true); } finally { queue.writeLock().unlock(); } currentCycleMappedBytes = currentCycleWireStore.bytes(); currentCycle = qCycle; if (chunkListener != null) currentCycleMappedBytes.setNewChunkListener(chunkListener); cycleChangedListener.accept(qCycle); if (EARLY_ACQUIRE_NEXT_CYCLE) if (Jvm.isDebugEnabled(getClass())) Jvm.debug().on(getClass(), "Pretoucher ROLLING early to next file=" + currentCycleWireStore.file()); } }