public class MuxStreamDirectory extends ReadMuxStreamDirectory
| Modifier and Type | Class and Description |
|---|---|
protected class |
MuxStreamDirectory.StreamOut |
protected class |
MuxStreamDirectory.StreamOutWriter |
| Modifier and Type | Field and Description |
|---|---|
static FileAttribute<?> |
DATA_FILE_ATTRIBUTES |
protected Map<Integer,MuxStreamDirectory.StreamOut> |
openStreamWrites |
protected AtomicLong |
openWriteBytes |
protected FileChannel |
openWriteFile |
protected ReentrantLock |
openWritesLock |
protected Map<Integer,MuxStreamDirectory.StreamOut> |
pendingStreamCloses |
closeTime, DEFAULT_MAP_SIZE, deleteFreed, dirDataFile, dirMetaFile, eventListener, fileFormat, MAX_RECORDS_READ, releaseComplete, startFile, streamDirectory, streamDirectoryConfig, streamDirectoryMap, writeMutexFile, writeMutexLock| Constructor and Description |
|---|
MuxStreamDirectory(Path dir,
MuxyEventListener listener) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
acquireWritable() |
OutputStream |
appendStream(MuxStream meta) |
protected int |
bumpCurrentFile() |
protected void |
compactMetaLog()
write out a new meta log from in-memory map.
|
MuxStream |
createStream() |
protected MuxStream |
deleteStream(int streamID) |
MuxStream |
findStream(int streamID) |
Collection<Path> |
getActiveFiles() |
boolean |
isWritingComplete() |
Collection<MuxStream> |
listStreams() |
protected boolean |
maybeTrimOutputBuffers()
Trims memory overhead if the openWritesLock is immediately available.
|
protected int |
reserveStreamID() |
void |
setDeleteFreed(boolean deleteFreed)
automatically delete files no longer referenced by any streams.
|
void |
setMaxBlockSize(int size) |
void |
setMaxFileSize(int size) |
int |
size() |
void |
waitForWriteClosure()
this method MUST be called when an application that performs writes is
done with this class.
|
protected long |
writeStreamsToBlock() |
formatFileName, getFileByID, getFileByID, publishEvent, readMetaLogpublic static final FileAttribute<?> DATA_FILE_ATTRIBUTES
protected final ReentrantLock openWritesLock
protected final Map<Integer,MuxStreamDirectory.StreamOut> openStreamWrites
protected final Map<Integer,MuxStreamDirectory.StreamOut> pendingStreamCloses
protected final AtomicLong openWriteBytes
protected FileChannel openWriteFile
public MuxStreamDirectory(Path dir, MuxyEventListener listener) throws Exception
Exceptionpublic void setDeleteFreed(boolean deleteFreed)
public boolean isWritingComplete()
protected int reserveStreamID()
throws IOException
IOExceptionprotected int bumpCurrentFile()
throws IOException
IOExceptionpublic void setMaxBlockSize(int size)
throws IOException
IOExceptionpublic void setMaxFileSize(int size)
throws IOException
IOExceptionpublic void waitForWriteClosure()
protected void acquireWritable()
throws IOException
IOExceptionprotected void compactMetaLog()
throws IOException
IOExceptionpublic MuxStream createStream() throws IOException
IOExceptionpublic Collection<MuxStream> listStreams() throws IOException
listStreams in class ReadMuxStreamDirectoryIOExceptionpublic int size()
size in class ReadMuxStreamDirectorypublic MuxStream findStream(int streamID) throws IOException
findStream in class ReadMuxStreamDirectoryIOExceptionpublic Collection<Path> getActiveFiles() throws IOException
getActiveFiles in class ReadMuxStreamDirectoryIOExceptionprotected MuxStream deleteStream(int streamID) throws IOException
IOExceptionpublic OutputStream appendStream(MuxStream meta) throws IOException
IOExceptionprotected boolean maybeTrimOutputBuffers()
protected long writeStreamsToBlock()
throws IOException
IOExceptionCopyright © 2018 AddThis. All rights reserved.