On 3/24/07, EricFitchett <[EMAIL PROTECTED]> wrote:
Any luck?
I'm running into the same issue with the following VM:
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)
Running on Ubuntu 6.06, tried under eclipse and with the command line.
Occurs with Mina 1.0.1 and 1.0.2 releases.
I decided to try to pare down my code to the minimum required to duplicate
the problem.
I made a simple class with both a JUnit test case and a main method. The
interesting part is that the JUnit test works (and terminates the process),
but the main method (which calls the same code) leaves the process running.
Also, the mina examples work fine (Tennis, etc), which makes me think I've
got to be doing something wrong - but there's not a lot of code for there to
be a problem in.
Here's my code:
import java.net.InetSocketAddress;
import junit.framework.TestCase;
import org.apache.mina.common.ConnectFuture;
import org.apache.mina.common.IoHandlerAdapter;
import org.apache.mina.transport.socket.nio.SocketConnector;
public final class MinaClientTest extends TestCase {
public static void main(String[] args) {
new MinaClientTest().testClientClose();
}
public void testClientClose() {
SocketConnector connector = new SocketConnector();
ConnectFuture connectFuture = connector.connect(
new InetSocketAddress("www.google.com", 80),
new IoHandlerAdapter() {});
connectFuture.join();
connectFuture.getSession().close().join();
System.out.println("Session closed");
}
}
You will have to set workerTimeout property to smaller value. For example,
connector.setWorkerTimeout(5); // 5 seconds
HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6