Issue Details (XML | Word | Printable)

Key: DIRMINA-64
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Trustin Lee
Reporter: Vinod Panicker
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
MINA

SocketAcceptor needs to expose setReuseAddress()

Created: 18/Jun/05 07:11 PM   Updated: 05/Jul/05 02:57 PM
Return to search
Component/s: None
Affects Version/s: 0.7.0, 0.7.1, 0.7.2
Fix Version/s: 0.9.0

Time Tracking:
Not Specified

Environment: All

Resolution Date: 05/Jul/05 02:48 PM


 Description  « Hide
The SocketAcceptor currently doesn't expose setReuseAddress() functionality. This is extremely necessary for server implementations. It would be great if a SocketAcceptor could expose a SocketSessionConfig type of class.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Trustin Lee made changes - 29/Jun/05 02:26 AM
Field Original Value New Value
Affects Version/s 0.7 [ 11067 ]
Affects Version/s 0.9 [ 11069 ]
Affects Version/s 0.7.1 [ 11171 ]
Fix Version/s 0.7.3 [ 12310110 ]
Affects Version/s 0.7.2 [ 11180 ]
Trustin Lee added a comment - 01/Jul/05 01:05 PM
Should a 'setReuseAddress() call be invoked to ServerSocketChannel or SocketChannel? If it should be called to SocketChannel, doesn't calling Session.getConfig().setReuseAddress(true) in sessionCreated() work?

Vinod Panicker added a comment - 01/Jul/05 03:47 PM
On the ServerSocketChannel. Taking an example where a server goes down for some reason, and an automated script tries to bring it back up again, the server needs to be able to bind to the same "well-known" port. If it is in TIME_WAIT state, as it most probably will be, the server will not be able to bind to the port unless setReuseAddress is set to true.

The client side implementation is fine.

Trustin Lee added a comment - 01/Jul/05 03:50 PM
Then what do you think about setting ReuseAddress to true by default and not providing any configurations?

Vinod Panicker added a comment - 01/Jul/05 04:13 PM
I'm OK with that w.r.t my current need, but it could cause certain problems due to negligence. eg - two instances of the server might be started by mistake and both would be getting data from the network. And keeping this as default might break someone's current implementation that depends on this being false. I'd suggest not changing default behavior - i.e. the standard JDK approach.

Repository Revision Date User Message
ASF #209223 Tue Jul 05 05:33:13 UTC 2005 trustin Fix for DIRMINA-64

* Added: IoSessionManagerConfig, IoAcceptorConfig and IoConnectorConfig
* Added: IoSessionManager.getConfig()
* Added: SocketAcceptorConfig which implements IoAcceptorConfig so that users can configure ServerSocket parameters.
* Removed: Two IoConnector.connect() methods because you can configure connect timeout using IoConnectorConfig.
* Removed: SocketAcceptor.backlog peroperty because you can configure backlog using SocketAcceptorConfig.
Files Changed
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
ADD /directory/network/trunk/src/java/org/apache/mina/common/BaseIoAcceptorConfig.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketConnector.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramSessionConfig.java
ADD /directory/network/trunk/src/java/org/apache/mina/common/IoSessionManagerConfig.java
ADD /directory/network/trunk/src/java/org/apache/mina/common/IoConnectorConfig.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/common/IoSessionManager.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/common/IoConnector.java
MODIFY /directory/network/trunk/src/examples/org/apache/mina/examples/netcat/Main.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramConnector.java
ADD /directory/network/trunk/src/java/org/apache/mina/common/IoAcceptorConfig.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
MODIFY /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketSessionConfig.java
ADD /directory/network/trunk/src/java/org/apache/mina/common/BaseIoConnectorConfig.java
ADD /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptorConfig.java

Trustin Lee added a comment - 05/Jul/05 02:47 PM
This issue has been resolved in 0.9 stream because the solution is not that simple to apply

Trustin Lee made changes - 05/Jul/05 02:47 PM
Fix Version/s 0.9 [ 11069 ]
Fix Version/s 0.7.3 [ 12310110 ]
Trustin Lee added a comment - 05/Jul/05 02:48 PM
Please close this issue if it is considered fixed.

Trustin Lee made changes - 05/Jul/05 02:48 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Vinod Panicker added a comment - 05/Jul/05 02:57 PM
Meets the requirements. Thanks.

Vinod Panicker made changes - 05/Jul/05 02:57 PM
Status Resolved [ 5 ] Closed [ 6 ]