Search in sources :

Example 1 with ActorClock

use of io.zeebe.util.sched.clock.ActorClock in project zeebe by zeebe-io.

the class MetricsFileWriter method dump.

private void dump() {
    final ActorClock clock = ActorClock.current();
    clock.update();
    final int length = metricsManager.dump(writeBuffer, 0, clock.getTimeMillis());
    final ByteBuffer inBuffer = writeBuffer.byteBuffer();
    inBuffer.position(0);
    inBuffer.limit(length);
    try {
        fileChannel.position(0);
        fileChannel.truncate(length);
        while (inBuffer.hasRemaining()) {
            fileChannel.write(inBuffer);
        }
        fileChannel.force(false);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : IOException(java.io.IOException) ActorClock(io.zeebe.util.sched.clock.ActorClock) ByteBuffer(java.nio.ByteBuffer) ExpandableDirectByteBuffer(org.agrona.ExpandableDirectByteBuffer)

Aggregations

ActorClock (io.zeebe.util.sched.clock.ActorClock)1 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 ExpandableDirectByteBuffer (org.agrona.ExpandableDirectByteBuffer)1