@Test public void testReserve() throws Exception { BufferManagerImpl bufferManager = new BufferManagerImpl(); bufferManager.setCache(new MemoryStorageManager()); bufferManager.setMaxProcessingKB(1024); bufferManager.setMaxReserveKB(1024); bufferManager.initialize(); bufferManager.setNominalProcessingMemoryMax(512000); assertEquals(512000, bufferManager.reserveBuffers(1024000, BufferReserveMode.NO_WAIT)); assertEquals(1024000, bufferManager.reserveBuffersBlocking(1024000, new long[] {0,0}, true)); assertEquals(0, bufferManager.reserveBuffersBlocking(1024000, new long[] {0,0}, false)); bufferManager.releaseBuffers(512000); assertEquals(24576, bufferManager.reserveBuffers(1024000, BufferReserveMode.NO_WAIT)); }
private void reserve(int count, CommandContext context) { this.reserveBatchBytes.addAndGet(-count); if (context != null) { context.addAndGetReservedBuffers(count); } }
BufferManagerImpl implements BufferManager, ReplicatedObject<String>, SessionKiller { private void reserve(int count, CommandContext context) { this.reserveBatchBytes.addAndGet(-count); if (context != null) { context.addAndGetReservedBuffers(count); } } }
BufferManagerImpl implements BufferManager, ReplicatedObject<String>, SessionKiller { private void reserve(int count, CommandContext context) { this.reserveBatchBytes.addAndGet(-count); if (context != null) { context.addAndGetReservedBuffers(count); } } BufferManagerImpl();  BufferManagerImpl(boolean sharedTimer); }
BufferManagerImpl implements BufferManager, ReplicatedObject<String>, SessionKiller { private void reserve(int count, CommandContext context) { this.reserveBatchBytes.addAndGet(-count); if (context != null) { context.addAndGetReservedBuffers(count); } } BufferManagerImpl();  BufferManagerImpl(boolean sharedTimer); long getBatchesAdded(); long getReadCount(); long getWriteCount(); long getReadAttempts(); @Override int getMaxProcessingSize(); long getReserveBatchBytes(); @Override int getProcessorBatchSize(); void setTargetBytesPerRow(int targetBytesPerRow); void setProcessorBatchSize(int processorBatchSize); @Override TupleBuffer createTupleBuffer(final List elements, String groupName,
            TupleSourceType tupleSourceType); STree createSTree(final List<? extends Expression> elements, String groupName, int keyLength); @Override FileStore createFileStore(String name); @Override long getMaxStorageSpace(); Cache getCache(); void setMaxActivePlans(int maxActivePlans); void setMaxProcessingKB(int maxProcessingKB); void setMaxReserveKB(int maxReserveBatchKB); @Override void initialize(); @Override void releaseOrphanedBuffers(long count); @Override void releaseBuffers(int count); @Override int reserveBuffers(int count, BufferReserveMode mode); @Override int reserveBuffersBlocking(int count, long[] val, boolean force); @Override int getProcessorBatchSize(List<? extends Expression> schema); @Override int getSchemaSize(List<? extends Expression> elements); void shutdown(); @Override void addTupleBuffer(TupleBuffer tb); @Override void distributeTupleBuffer(String uuid, TupleBuffer tb); @Override TupleBuffer getTupleBuffer(String id); void setUseWeakReferences(boolean useWeakReferences); @Override void getState(OutputStream ostream); @Override void getState(String state_id, OutputStream ostream); @Override void setState(InputStream istream); @Override void setState(String state_id, InputStream istream); @Override void setAddress(Serializable address); @Override void droppedMembers(Collection<Serializable> addresses); void setInlineLobs(boolean inlineLobs); int getMaxReserveKB(); void setCache(Cache cache); int getMemoryCacheEntries(); long getActiveBatchBytes(); @Override boolean hasState(String stateId); long getReferenceHits(); @Override void persistLob(Streamable<?> lob, FileStore store,
            byte[] bytes); void invalidCacheGroup(Long gid); @Override void setOptions(Options options); @Override Options getOptions(); void setStorageManager(StorageManager ssm); void setMaxSessionBatchManagerSizeEstimate(
            long maxSessionBatchManagerSizeEstimate); void setMaxBatchManagerSizeEstimate(
            long maxBatchManagerSizeEstimate); void setEnforceMaxBatchManagerSizeEstimate(
            boolean enforceMaxBatchManagerSizeEstimate); @Override boolean killLargestConsumer(); void setSessionService(SessionService sessionService); }
BufferManagerImpl implements BufferManager, ReplicatedObject<String>, SessionKiller { private void reserve(int count, CommandContext context) { this.reserveBatchBytes.addAndGet(-count); if (context != null) { context.addAndGetReservedBuffers(count); } } BufferManagerImpl();  BufferManagerImpl(boolean sharedTimer); long getBatchesAdded(); long getReadCount(); long getWriteCount(); long getReadAttempts(); @Override int getMaxProcessingSize(); long getReserveBatchBytes(); @Override int getProcessorBatchSize(); void setTargetBytesPerRow(int targetBytesPerRow); void setProcessorBatchSize(int processorBatchSize); @Override TupleBuffer createTupleBuffer(final List elements, String groupName,
            TupleSourceType tupleSourceType); STree createSTree(final List<? extends Expression> elements, String groupName, int keyLength); @Override FileStore createFileStore(String name); @Override long getMaxStorageSpace(); Cache getCache(); void setMaxActivePlans(int maxActivePlans); void setMaxProcessingKB(int maxProcessingKB); void setMaxReserveKB(int maxReserveBatchKB); @Override void initialize(); @Override void releaseOrphanedBuffers(long count); @Override void releaseBuffers(int count); @Override int reserveBuffers(int count, BufferReserveMode mode); @Override int reserveBuffersBlocking(int count, long[] val, boolean force); @Override int getProcessorBatchSize(List<? extends Expression> schema); @Override int getSchemaSize(List<? extends Expression> elements); void shutdown(); @Override void addTupleBuffer(TupleBuffer tb); @Override void distributeTupleBuffer(String uuid, TupleBuffer tb); @Override TupleBuffer getTupleBuffer(String id); void setUseWeakReferences(boolean useWeakReferences); @Override void getState(OutputStream ostream); @Override void getState(String state_id, OutputStream ostream); @Override void setState(InputStream istream); @Override void setState(String state_id, InputStream istream); @Override void setAddress(Serializable address); @Override void droppedMembers(Collection<Serializable> addresses); void setInlineLobs(boolean inlineLobs); int getMaxReserveKB(); void setCache(Cache cache); int getMemoryCacheEntries(); long getActiveBatchBytes(); @Override boolean hasState(String stateId); long getReferenceHits(); @Override void persistLob(Streamable<?> lob, FileStore store,
            byte[] bytes); void invalidCacheGroup(Long gid); @Override void setOptions(Options options); @Override Options getOptions(); void setStorageManager(StorageManager ssm); void setMaxSessionBatchManagerSizeEstimate(
            long maxSessionBatchManagerSizeEstimate); void setMaxBatchManagerSizeEstimate(
            long maxBatchManagerSizeEstimate); void setEnforceMaxBatchManagerSizeEstimate(
            boolean enforceMaxBatchManagerSizeEstimate); @Override boolean killLargestConsumer(); void setSessionService(SessionService sessionService);  }