/** * Updates value of the {@link #evictionOccupancyPercentage}. */ @PropertyUpdate(properties = { "buffer.bytesMaintenancePercentage", }) protected void updateBytesMaintenancePercentage() { this.flagsSetOnBytes = bufferProperties.getFlagsSetOnBytes(this.maxSize.get()); }
/** * Updates the buffer size and to it related properties. */ @PropertyUpdate(properties = { "buffer.minOldSpaceOccupancy", "buffer.maxOldSpaceOccupancy", "buffer.minOldSpaceOccupancyActiveTillOldGenSize", "buffer.maxOldSpaceOccupancyActiveFromOldGenSize" }) protected void updateBufferSizeAndRelated() { this.maxSize.set(bufferProperties.getInitialBufferSize()); this.objectSizes.setObjectSecurityExpansionRate(bufferProperties.getObjectSecurityExpansionRate(maxSize.get())); this.flagsSetOnBytes = bufferProperties.getFlagsSetOnBytes(this.maxSize.get()); }
/** * Is executed after dependency injection is done to perform any initialization. * * @throws Exception * if an error occurs during {@link PostConstruct} */ @PostConstruct public void postConstruct() throws Exception { this.maxSize = new AtomicLong(bufferProperties.getInitialBufferSize()); this.evictionOccupancyPercentage = new AtomicInteger(Float.floatToIntBits(bufferProperties.getEvictionOccupancyPercentage())); this.objectSizes.setObjectSecurityExpansionRate(bufferProperties.getObjectSecurityExpansionRate(maxSize.get())); this.first = new AtomicReference<IBufferElement<E>>(emptyBufferElement); this.last = new AtomicReference<IBufferElement<E>>(emptyBufferElement); this.lastAnalyzed = new AtomicReference<IBufferElement<E>>(emptyBufferElement); this.lastIndexed = new AtomicReference<IBufferElement<E>>(emptyBufferElement); this.indexingTreeCleaningExecutorService = Executors.newFixedThreadPool(bufferProperties.getIndexingTreeCleaningThreads()); this.flagsSetOnBytes = bufferProperties.getFlagsSetOnBytes(this.maxSize.get()); // initialize processors this.analyzeProcessor = new AnalyzeBufferElementProcessor<>(this, lastAnalyzed, analyzeLock, nothingToAnalyze); this.indexProcessor = new IndexBufferElementProcessor<>(this, lastIndexed, indexingLock, nothingToIndex); if (log.isInfoEnabled()) { log.info("|-Using buffer with maximum size " + NumberFormat.getInstance().format(maxSize) + " bytes..."); log.info("|-Indexing tree maintenance on " + NumberFormat.getInstance().format(flagsSetOnBytes) + " bytes added/removed..."); log.info("|-Using object expansion rate of " + NumberFormat.getInstance().format(objectSizes.getObjectSecurityExpansionRate() * 100) + "%"); } }
when(bufferProperties.getEvictionOccupancyPercentage()).thenReturn(0.5f); when(bufferProperties.getEvictionFragmentSizePercentage()).thenReturn(0.35f); when(bufferProperties.getFlagsSetOnBytes(anyLong())).thenReturn(flagsSetOnBytes); when(bufferProperties.getIndexingWaitTime()).thenReturn(10L); when(indexingTree.getComponentSize(objectSizes)).thenReturn(10L);