@Test void testGetBufferedDataSize() throws IOException { bufferConfig.setChunkInitialSize(256 * 1024); try (Buffer buffer = new Buffer(bufferConfig, recordFormatter)) { assertThat(buffer.getBufferedDataSize(), is(0L)); Map<String, Object> map = new HashMap<>(); map.put("name", "komamitsu"); for (int i = 0; i < 10; i++) { buffer.append("foo.bar", new Date().getTime(), map); } assertThat(buffer.getBufferedDataSize(), is(greaterThan(0L))); assertThat(buffer.getBufferedDataSize(), is(lessThan(512L))); buffer.flush(ingester, true); assertThat(buffer.getBufferedDataSize(), is(0L)); } }
public long getBufferedDataSize() { long size = 0; synchronized (retentionBuffers) { for (Map.Entry<String, RetentionBuffer> buffer : retentionBuffers.entrySet()) { if (buffer.getValue() != null && buffer.getValue().getByteBuffer() != null) { size += buffer.getValue().getByteBuffer().position(); } } } for (TaggableBuffer buffer : flushableBuffers) { if (buffer.getByteBuffer() != null) { size += buffer.getByteBuffer().remaining(); } } return size; }
Buffer implements Closeable { public long getBufferedDataSize() { long size = 0; synchronized (retentionBuffers) { for (Map.Entry<String, RetentionBuffer> buffer : retentionBuffers.entrySet()) { if (buffer.getValue() != null && buffer.getValue().getByteBuffer() != null) { size += buffer.getValue().getByteBuffer().position(); } } } for (TaggableBuffer buffer : flushableBuffers) { if (buffer.getByteBuffer() != null) { size += buffer.getByteBuffer().remaining(); } } return size; } }
Buffer implements Closeable { public long getBufferedDataSize() { long size = 0; synchronized (retentionBuffers) { for (Map.Entry<String, RetentionBuffer> buffer : retentionBuffers.entrySet()) { if (buffer.getValue() != null && buffer.getValue().getByteBuffer() != null) { size += buffer.getValue().getByteBuffer().position(); } } } for (TaggableBuffer buffer : flushableBuffers) { if (buffer.getByteBuffer() != null) { size += buffer.getByteBuffer().remaining(); } } return size; } Buffer(RecordFormatter recordFormatter);  Buffer(final Config config, RecordFormatter recordFormatter); }
Buffer implements Closeable { public long getBufferedDataSize() { long size = 0; synchronized (retentionBuffers) { for (Map.Entry<String, RetentionBuffer> buffer : retentionBuffers.entrySet()) { if (buffer.getValue() != null && buffer.getValue().getByteBuffer() != null) { size += buffer.getValue().getByteBuffer().position(); } } } for (TaggableBuffer buffer : flushableBuffers) { if (buffer.getByteBuffer() != null) { size += buffer.getByteBuffer().remaining(); } } return size; } Buffer(RecordFormatter recordFormatter);  Buffer(final Config config, RecordFormatter recordFormatter); void flush(Ingester ingester, boolean force); @Override void close(); float getBufferUsage(); void clearBackupFiles(); long getMaxBufferSize(); String getFileBackupPrefix(); String getFileBackupDir(); void append(String tag, long timestamp, Map<String, Object> data); void append(String tag, EventTime timestamp, Map<String, Object> data); void appendMessagePackMapValue(String tag, long timestamp, byte[] mapValue, int offset, int len); void appendMessagePackMapValue(String tag, EventTime timestamp, byte[] mapValue, int offset, int len); void appendMessagePackMapValue(String tag, long timestamp, ByteBuffer mapValue); void appendMessagePackMapValue(String tag, EventTime timestamp, ByteBuffer mapValue); long getAllocatedSize(); long getBufferedDataSize(); boolean getJvmHeapBufferMode(); String bufferFormatType(); int getChunkInitialSize(); float getChunkExpandRatio(); int getChunkRetentionSize(); int getChunkRetentionTimeMillis(); @Override String toString(); }
Buffer implements Closeable { public long getBufferedDataSize() { long size = 0; synchronized (retentionBuffers) { for (Map.Entry<String, RetentionBuffer> buffer : retentionBuffers.entrySet()) { if (buffer.getValue() != null && buffer.getValue().getByteBuffer() != null) { size += buffer.getValue().getByteBuffer().position(); } } } for (TaggableBuffer buffer : flushableBuffers) { if (buffer.getByteBuffer() != null) { size += buffer.getByteBuffer().remaining(); } } return size; } Buffer(RecordFormatter recordFormatter);  Buffer(final Config config, RecordFormatter recordFormatter); void flush(Ingester ingester, boolean force); @Override void close(); float getBufferUsage(); void clearBackupFiles(); long getMaxBufferSize(); String getFileBackupPrefix(); String getFileBackupDir(); void append(String tag, long timestamp, Map<String, Object> data); void append(String tag, EventTime timestamp, Map<String, Object> data); void appendMessagePackMapValue(String tag, long timestamp, byte[] mapValue, int offset, int len); void appendMessagePackMapValue(String tag, EventTime timestamp, byte[] mapValue, int offset, int len); void appendMessagePackMapValue(String tag, long timestamp, ByteBuffer mapValue); void appendMessagePackMapValue(String tag, EventTime timestamp, ByteBuffer mapValue); long getAllocatedSize(); long getBufferedDataSize(); boolean getJvmHeapBufferMode(); String bufferFormatType(); int getChunkInitialSize(); float getChunkExpandRatio(); int getChunkRetentionSize(); int getChunkRetentionTimeMillis(); @Override String toString();  }