Skip to content

Commit 3a6cbf2

Browse files
committed
Add some comments.
1 parent 3775c29 commit 3a6cbf2

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/main/java/org/jsl/collider/Acceptor.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,32 @@
2222
import java.net.InetSocketAddress;
2323

2424
/**
25-
* {@code Acceptor} is used to accepot inbound socket connections.
25+
* {@code Acceptor} is used to accept inbound socket connections.
2626
* See {@link Collider} for details.
2727
*/
2828

2929
public abstract class Acceptor extends SessionEmitter
3030
{
31+
/**
32+
* Initialize acceptor to listen on any available port.
33+
* The port number can be obtained later in the onAcceptorStarted()
34+
*/
3135
public Acceptor()
3236
{
33-
this(new InetSocketAddress(0));
37+
super(new InetSocketAddress(0));
3438
}
3539

36-
public Acceptor(InetSocketAddress addr)
40+
/**
41+
* Initialize acceptor to listen on the particular port.
42+
* @param listenPort
43+
*/
44+
public Acceptor(int listenPort)
3745
{
38-
super(addr);
46+
super(new InetSocketAddress(listenPort));
3947
}
4048

4149
/**
42-
* Called by the framework to create <tt>Session.Listener</tt> instance
50+
* Called by the Collider runtime to create <tt>Session.Listener</tt> instance
4351
* to be linked with the session and underlying socket. METHOD IS NOT [MT] SAFE,
4452
* can be executed concurrently in a number of threads.
4553
* Connection and underlying socket will be closed if returns <tt>null</tt>,
@@ -48,7 +56,7 @@ public Acceptor(InetSocketAddress addr)
4856
public abstract Session.Listener createSessionListener(Session session);
4957

5058
/**
51-
* Called by framework right before the acceptor is ready to accept connections.
59+
* Called by the Collider runtime right before the acceptor is ready to accept connections.
5260
* It is still safe to remove the <tt>Acceptor</tt> instance from the collider
5361
* within this method, no one connection will be accepted then.
5462
* @param collider the collider instance to work in

0 commit comments

Comments
 (0)