public class SharedMemoryPipe extends Object implements JslipcPipe, JslipcBinman
ByteBufferQueue
s as a backend for two (uni-directional)
channels. Which buffer/channel is used for reading or writing depends on the
given role
, so the role is needed to distinguish the two
endpoints, but do not have any further semantics. Constructor and Description |
---|
SharedMemoryPipe(File file,
int size,
JslipcRole role)
Creates a pipe with the given parameter in shared memory.
|
SharedMemoryPipe(File file,
JslipcRole role)
Creates a pipe with the given parameter in shared memory.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanUpOnClose()
Attempts to clean up any resources on
Closeable.close() if they are no longer needed. |
void |
close() |
protected ByteBufferQueue |
createQueue(MappedByteBuffer buffer,
int fileSize,
JslipcRole role,
boolean in) |
protected RandomAccessFile |
getFile() |
protected ByteBufferQueue |
getInQueue() |
protected ByteBufferQueue |
getOutQueue() |
WritableBbqChannel |
sink() |
ReadableBbqChannel |
source() |
String |
toString() |
public SharedMemoryPipe(File file, JslipcRole role) throws IOException
server
or yang
. It is just
needed to distinguish the endpoints of the pipe, so one end should have
the role yin, the other yang.IOException
public SharedMemoryPipe(File file, int size, JslipcRole role) throws IOException
server
or yang
. It is just
needed to distinguish the endpoints of the pipe, so one end should have
the role yin, the other yang.file
- size
- role
- IOException
public void cleanUpOnClose()
JslipcBinman
Closeable.close()
if they are no longer needed.cleanUpOnClose
in interface JslipcBinman
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
protected ByteBufferQueue createQueue(MappedByteBuffer buffer, int fileSize, JslipcRole role, boolean in) throws IOException
IOException
protected ByteBufferQueue getInQueue()
protected ByteBufferQueue getOutQueue()
protected RandomAccessFile getFile()
public ReadableBbqChannel source()
source
in interface JslipcPipe
public WritableBbqChannel sink()
sink
in interface JslipcPipe
Copyright © 2014. All Rights Reserved.