public class GridIpcSharedMemorySpace extends Object implements Closeable
| Constructor and Description |
|---|
GridIpcSharedMemorySpace(String tokFileName,
int writerPid,
int readerPid,
int size,
boolean reader,
GridLogger parent)
This will allocate system resources for the space.
|
GridIpcSharedMemorySpace(String tokFileName,
int writerPid,
int readerPid,
int size,
boolean reader,
int shmemId,
GridLogger parent)
This should be called in order to attach to already allocated system resources.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
forceClose()
Forcibly closes the space and frees all system resources.
|
int |
otherPartyPid() |
int |
read(byte[] buf,
int off,
int len,
long timeout)
Blocks until at least 1 byte is read.
|
int |
read(ByteBuffer buf,
int off,
int len,
long timeout)
Blocks until at least 1 byte is read.
|
int |
readerPid() |
int |
semaphoreId() |
int |
sharedMemoryId() |
long |
sharedMemPointer() |
int |
size() |
String |
tokenFileName() |
String |
toString() |
int |
unreadCount() |
void |
write(byte[] buf,
int off,
int len,
long timeout) |
void |
write(ByteBuffer buf,
int off,
int len,
long timeout) |
int |
writerPid() |
public GridIpcSharedMemorySpace(String tokFileName, int writerPid, int readerPid, int size, boolean reader, GridLogger parent) throws GridException
tokFileName - Token filename.writerPid - Writer PID.readerPid - Reader PID.size - Size in bytes.reader - True if reader.parent - Parent logger.GridException - If failed.public GridIpcSharedMemorySpace(String tokFileName, int writerPid, int readerPid, int size, boolean reader, int shmemId, GridLogger parent) throws GridException
tokFileName - Token file name (for proper cleanup).writerPid - Writer PID.readerPid - Reader PID.size - Size.reader - Reader flag.shmemId - Shared memory ID.parent - Logger.GridException - If failed.public void write(byte[] buf,
int off,
int len,
long timeout)
throws GridException,
GridIpcSharedMemoryOperationTimedoutException
buf - Buffer.off - Offset.len - Length.timeout - Operation timeout in milliseconds (0 to wait forever).GridException - If space has been closed.GridIpcSharedMemoryOperationTimedoutException - If operation times out.public void write(ByteBuffer buf, int off, int len, long timeout) throws GridException, GridIpcSharedMemoryOperationTimedoutException
buf - Buffer.off - Offset.len - Length.timeout - Operation timeout in milliseconds (0 to wait forever).GridException - If space has been closed.GridIpcSharedMemoryOperationTimedoutException - If operation times out.public int read(byte[] buf,
int off,
int len,
long timeout)
throws GridException,
GridIpcSharedMemoryOperationTimedoutException
buf - Buffer.off - Offset.len - Length.timeout - Operation timeout in milliseconds (0 to wait forever).GridException - If space has been closed.GridIpcSharedMemoryOperationTimedoutException - If operation times out.public int read(ByteBuffer buf, int off, int len, long timeout) throws GridException, GridIpcSharedMemoryOperationTimedoutException
buf - Buffer.off - Offset.len - Length.timeout - Operation timeout in milliseconds (0 to wait forever).GridException - If space has been closed.GridIpcSharedMemoryOperationTimedoutException - If operation times out.public void close()
close in interface Closeableclose in interface AutoCloseablepublic void forceClose()
This method should be called with caution as it may result to the other-party process crash. It is intended to call when there was an IO error during handshake and other party has not yet attached to the space.
public int sharedMemoryId()
public int semaphoreId()
public int unreadCount()
throws GridException
GridException - If failed.public long sharedMemPointer()
public int readerPid()
public int writerPid()
public int otherPartyPid()
public String tokenFileName()
public int size()
Copyright © 2014. All rights reserved.