Class Process
java.lang.Object
utils.communication.groupConstitution.Process
- All Implemented Interfaces:
ProcessInterface
,Closeable
,AutoCloseable
,AsynchronousChannel
,Channel
- Direct Known Subclasses:
ProcessStatus
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
<A> void
connect
(SocketAddress remote, A attachment, CompletionHandler<Void, ? super A> handler) Asynchronous connect.boolean
isFaulty()
Whether this GroupMember is known/suspected faulty or not.boolean
isOpen()
boolean
isOther()
Whether this GroupMember represents another process or ourselves.boolean
Whether a read operation can be completed successfully.boolean
Whether a write operation can be completed successfully.void
Mark a process as being faultyvoid
markAsFaulty
(boolean isFaulty) Change a process's faultiness.<A> void
safeRead
(ByteBuffer bf, A attachment, CompletionHandler<Integer, ? super A> handler) Asynchronous thread-safe read method.void
safeWrite
(ByteBuffer bf) Blocking thread-safe write method.<A> void
safeWrite
(ByteBuffer bf, A attachment, CompletionHandler<Integer, ? super A> handler) Asynchronous thread-safe write method.
-
Constructor Details
-
Process
public Process() -
Process
-
Process
-
-
Method Details
-
isOther
public boolean isOther()Description copied from interface:ProcessInterface
Whether this GroupMember represents another process or ourselves.- Specified by:
isOther
in interfaceProcessInterface
- Returns:
- True if it is not the calling process, false otherwise
-
isFaulty
public boolean isFaulty()Description copied from interface:ProcessInterface
Whether this GroupMember is known/suspected faulty or not.- Specified by:
isFaulty
in interfaceProcessInterface
- Returns:
- True if at least suspected faulty, false otherwise
-
markAsFaulty
public void markAsFaulty()Description copied from interface:ProcessInterface
Mark a process as being faulty- Specified by:
markAsFaulty
in interfaceProcessInterface
-
markAsFaulty
public void markAsFaulty(boolean isFaulty) Description copied from interface:ProcessInterface
Change a process's faultiness.- Specified by:
markAsFaulty
in interfaceProcessInterface
- Parameters:
isFaulty
- Whether the process is faulty or not.
-
connect
public <A> void connect(SocketAddress remote, A attachment, CompletionHandler<Void, ? super A> handler) Description copied from interface:ProcessInterface
Asynchronous connect.- Specified by:
connect
in interfaceProcessInterface
- Type Parameters:
A
- Type of attachment- Parameters:
remote
- Address of the remote entity to connect to.attachment
- The object to attach to the I/O operationhandler
- The handler for consuming the result
-
safeWrite
public <A> void safeWrite(ByteBuffer bf, A attachment, CompletionHandler<Integer, ? super A> handler) Description copied from interface:ProcessInterface
Asynchronous thread-safe write method. Guarantees no WritePendingException occurs. Does nothing in the case that isOther is false.- Specified by:
safeWrite
in interfaceProcessInterface
- Type Parameters:
A
- Type of attachment- Parameters:
bf
- The buffer from which bytes are to be transferredattachment
- The object to attach to the I/O operationhandler
- The handler for consuming the result
-
safeWrite
Description copied from interface:ProcessInterface
Blocking thread-safe write method. Guarantees no WritePendingException occurs. Does nothing in the case that isOther is false.- Specified by:
safeWrite
in interfaceProcessInterface
- Parameters:
bf
- The buffer from which bytes are to be transferred
-
safeRead
Description copied from interface:ProcessInterface
Asynchronous thread-safe read method. Does nothing in the case that isOther is false.- Specified by:
safeRead
in interfaceProcessInterface
- Type Parameters:
A
- Type of attachment- Parameters:
bf
- The buffer to which bytes are to be transferredattachment
- The object to attach to the I/O operationhandler
- The handler for consuming the result
-
close
- Specified by:
close
in interfaceAsynchronousChannel
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
isOpen
public boolean isOpen() -
isReadable
public boolean isReadable()Description copied from interface:ProcessInterface
Whether a read operation can be completed successfully.- Specified by:
isReadable
in interfaceProcessInterface
- Returns:
- True is a read operation can be completed, false otherwise.
-
isWriteable
public boolean isWriteable()Description copied from interface:ProcessInterface
Whether a write operation can be completed successfully.- Specified by:
isWriteable
in interfaceProcessInterface
- Returns:
- True is a write operation can be completed, false otherwise.
-
getRemoteAddress
- Specified by:
getRemoteAddress
in interfaceProcessInterface
-
shallowClone
-