Skip to content

Commit

Permalink
Added Java transceiver interface comments (#2373)
Browse files Browse the repository at this point in the history
  • Loading branch information
bentoi authored Jul 2, 2024
1 parent 91db528 commit b082ceb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,13 @@
package com.zeroc.IceInternal;

public interface ReadyCallback {
/**
* Sets the transceiver read or write readiness status. This method is used by a transceiver
* implementation to notify the thread pool that it's ready or not to write or read data.
*
* @param op The transceiver read or write operation
* @param value The status of the operation readiness, true if the transceiver operation is ready,
* false otherwise.
*/
void ready(int op, boolean value);
}
20 changes: 18 additions & 2 deletions java/src/Ice/src/main/java/com/zeroc/IceInternal/Transceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@
package com.zeroc.IceInternal;

public interface Transceiver {
/**
* Returns the selectable channel used by the thread pool's selector to wait for read or write
* readiness.
*
* @return The selectable channel that will be registered with the thread pool's selector or null
* if the transceiver doesn't use a selectable channel.
*/
java.nio.channels.SelectableChannel fd();

/**
* Sets the transceiver ready callback. This method is called by the thread pool to provide a
* callback object that the transceiver can use to notify the thread pool's selector when more
* data is ready to be read or written by this transceiver. A transceiver implementation typically
* uses this callback when it buffers data read from the selectable channel if it doesn't use a
* selectable channel.
*
* @param callback The ready callback provided by the thread pool's selector.
*/
void setReadyCallback(ReadyCallback callback);

int initialize(Buffer readBuffer, Buffer writeBuffer);
Expand All @@ -23,10 +39,10 @@ public interface Transceiver {

/**
* Checks if this transceiver is waiting to be read, typically because it has bytes readily
* available for reading.
* available for reading. The caller must ensure the transceiver is not closed when calling this
* method.
*
* @return true if this transceiver is waiting to be read, false otherwise.
* @remark The caller must ensure the transceiver is not closed when calling this method.
*/
boolean isWaitingToBeRead();

Expand Down

0 comments on commit b082ceb

Please sign in to comment.