@@ -31,8 +31,9 @@ public interface Listener
3131 * Executed serially in a one thread, but not necessary always the same.
3232 * Position in the byte buffer can be greater than 0,
3333 * limit can be less than capacity.
34+ * @param data the data received from the related socket
3435 */
35- public abstract void onDataReceived ( RetainableByteBuffer data );
36+ public abstract void onDataReceived (RetainableByteBuffer data );
3637
3738 /**
3839 * Called by framework when underlying socket channel
@@ -42,17 +43,17 @@ public interface Listener
4243 }
4344
4445 /**
45- * Returns Collider instance the session is linked with.
46+ * @return Collider instance the session is linked with.
4647 */
4748 public Collider getCollider ();
4849
4950 /**
50- * Returns local socket address of the session.
51+ * @return local socket address of the session.
5152 */
5253 public SocketAddress getLocalAddress ();
5354
5455 /**
55- * Returns remote socket address of the session.
56+ * @return remote socket address of the session.
5657 */
5758 public SocketAddress getRemoteAddress ();
5859
@@ -62,8 +63,9 @@ public interface Listener
6263 * (even it's attributes like a position, limit etc)
6364 * so the buffer can be reused to send the same data
6465 * to the different sessions.
65- * @return >=0 - byte buffer is retained by the framework, will be sent as soon as possible
66- * -1 - the session is closed
66+ * @param data byte buffer with data to send
67+ * @return value greater than 0 if byte buffer is retained by the framework,
68+ * (data will be sent as soon as possible), or less than 0 if the session is closed.
6769 */
6870 public int sendData ( ByteBuffer data );
6971 public int sendData ( RetainableByteBuffer data );
@@ -72,9 +74,10 @@ public interface Listener
7274 * Method makes an attempt to write data synchronously to the underlying socket channel.
7375 * It can happen if it is the single thread calling the <em>sendData</em> or <em>sendDataSync</em>.
7476 * Otherwise data will sent as <em>sendData</em> would be called.
75- * @return 0 - data written to socket, byte buffer can be reused
76- * >0 - byte buffer is retained by the framework, will be sent as soon as possible
77- * -1 - the session is closed
77+ * @param data byte buffer with data to send
78+ * @return 0 if data has been written to the socket and byte buffer can be reused,
79+ * greater than 0 if byte buffer is retained by the framework, will be sent as soon as possible,
80+ * less than 0 if session is closed.
7881 */
7982 public int sendDataSync ( ByteBuffer data );
8083
@@ -87,8 +90,8 @@ public interface Listener
8790 * will be called after all received data will be processed.
8891 * All further <em>sendData</em>, <em>sendDataAsync</em> and
8992 * <em>closeConnection</em> calls will return -1.
90- * @return >0 - amount of data waiting to be sent
91- * <0 - session already closed and has no data to be sent
93+ * @return less than 0 if session already has been closed,
94+ * otherwise amount of data waiting to be sent.
9295 */
9396 public int closeConnection ();
9497
@@ -97,8 +100,10 @@ public interface Listener
97100 * Supposed to be called only from the <tt>onDataReceived()</tt> callback.
98101 * Calling it not from the <tt>onDataReceived</tt> callback will result
99102 * in undefined behaviour.
103+ * @param newListener the new listener to be used for the session
104+ * @return the previous listener was used to the session
100105 */
101- public Listener replaceListener ( Listener newListener );
106+ public Listener replaceListener (Listener newListener );
102107
103- public int accelerate ( ShMem shMem , ByteBuffer message );
108+ public int accelerate (ShMem shMem , ByteBuffer message );
104109}
0 commit comments