Hi,
I am using Mina 2.0.0-M1. The following is my pieces of code,
public class ServerConnector extends IoHandlerAdapter{
private SocketConnector connector;
protected IoSession session;
public ServerConnector() {
connector = new NioSocketConnector();
connector.setHandler(this);
}
public void connect(String host, int port) {
ConnectFuture connectFuture = connector.connect(new
InetSocketAddress(host, port));
connectFuture.awaitUninterruptibly(CONNECT_TIMEOUT);
try {
if (connectFuture.isConnected()) {
handleConnectionSucess();
session = connectFuture.getSession();
//send message here
} else {
handleConnectionFailure();
}
} catch (RuntimeIoException e) {
serverListener.onException(e);
}
}
.....
...
}
And
ServerConnetor sc=new ServerConnector();
sc.connector(ip, port);
I have running around 150 concurrent threads and caught exception:
unable to create new native thread
Or exception: failed to create a new instance of
org.apache.mina.transport.socket.nio.NioProcessor
This is a web application running on the Weblogic server 9.2 and java
heap was in 70% free status when exceptions were thrown. Also Weblogic
restarted afterwards.
Regards,
John