Name: diC59631 Date: 06/09/98
works with green threads, hangs with native threads
import java.net.*;
public class NativeThreadsTest
{
ServerSocket server;
public static void main( String[] args )
{
try
{
NativeThreadsTest test = new NativeThreadsTest();
test.startup();
test.shutdown();
}
catch( Exception e )
{
e.printStackTrace();
}
}
void startup() throws Exception
{
server = new ServerSocket( 8000 );
Thread thread = new Thread( new Acceptor( server ) );
thread.start();
}
void shutdown() throws Exception
{
System.out.println( "Shutting down server" );
server.close();
System.out.println( "Ending" );
}
}
----------------------------------------------------------------
import java.net.*;
public class Acceptor implements Runnable
{
ServerSocket server;
public Acceptor( ServerSocket socket )
{
server = socket;
}
public void run()
{
try
{
System.out.println( "Accepting socket info" );
server.accept();
}
catch( Exception e )
{
}
}
}
(Review ID: 33160)
======================================================================
- duplicates
-
JDK-4096914 (hpi) Closing an active file descriptor blocks on Solaris native threads
-
- Closed
-