jvz / nio-logger

Playground for exploring the Java NIO API in a logging system
Apache License 2.0
0 stars 0 forks source link

Fix overly eager async file channel appender #1

Open jvz opened 7 years ago

jvz commented 7 years ago

First, this needs to implement Buffered<ByteBuffer> so it can perform buffered IO in the first place. Next, update the layout encoding to the third form. Maximum memory limits should be set for IO transfers, and the number of transfers should be kept track of. Could reuse ByteBuffers via callbacks (what a fun finite state machine you can make here). Possible options of what to do when memory limit is approached (block, drop, error, etc.). This should also be able to clean up the Phaser usage to an AtomicLong or similar for waiting on close.

jvz commented 7 years ago

Was shown this class as an example buffer pool: https://github.com/cloudfoundry/cf-java-client/blob/master/cloudfoundry-util/src/main/java/org/cloudfoundry/util/ByteArrayPool.java