public class CommitLogAllocator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
TICK_CYCLE_TIME
The (theoretical) max milliseconds between loop runs to perform janitorial tasks
|
| Constructor and Description |
|---|
CommitLogAllocator() |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitTermination()
Returns when the allocator thread terminates.
|
long |
bytesUsed() |
void |
enableReserveSegmentCreation()
Throws a flag that enables the behavior of keeping at least one spare segment
available at all times.
|
CommitLogSegment |
fetchSegment()
Fetches an empty segment file.
|
java.util.Collection<CommitLogSegment> |
getActiveSegments() |
boolean |
manages(java.lang.String name) |
void |
recycleSegment(CommitLogSegment segment)
Indicates that a segment is no longer in use and that it should be recycled.
|
void |
recycleSegment(java.io.File file)
Differs from the above because it can work on any file instead of just existing
commit log segments managed by this allocator.
|
void |
resetUnsafe()
Resets all the segments, for testing purposes.
|
void |
shutdown()
Initiates the shutdown process for the allocator thread.
|
public static final int TICK_CYCLE_TIME
public CommitLogSegment fetchSegment()
public void recycleSegment(CommitLogSegment segment)
segment - segment that is no longer in usepublic void recycleSegment(java.io.File file)
file - segment file that is no longer in use.public long bytesUsed()
public boolean manages(java.lang.String name)
name - the filename to checkpublic void enableReserveSegmentCreation()
public void resetUnsafe()
public void shutdown()
public void awaitTermination()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic java.util.Collection<CommitLogSegment> getActiveSegments()
Copyright © 2015 The Apache Software Foundation