[433] in java-interest
NetworkServer
daemon@ATHENA.MIT.EDU (Gregory Zoller - Imonics Developme)
Wed Jun 21 16:58:48 1995
From: Gregory Zoller - Imonics Development <gzoller@imonics.com>
Date: Wed, 21 Jun 1995 16:30:15 -0400
To: java-interest@java.sun.com
Hi All...
I'm trying to find a reliable way to stop a NetworkServer instance.
It'd be very nice if this class had a stop() method that would
terminate NetworkServer's run() method and free the port. :-)
My Applet launches and starts a NetworkServer object. The problem
occurs if someone reloads the page. The previous instance's Thread
is still running, hogging the port.
I've tried subclassing NetworkServer, and adding a stop() method:
public synchronized void stop() {
Thread.currentThread().stop();
}
That didn't work.
Then I tried adding the following to Java's NetworkServer class:
private boolean stopRequest = false;
final public void stop() {
stopRequest = true;
}
// inside run() changed while( true ) to this...
while ( !stopRequest ) {
This all compiled fine. When I ran it and called NetworkServer's
new stop() method, I got this message:
java.lang.IncompatibleClassChangeException net.NetworkServer: method stop()V not found
at AppServer.destroy(AppServer.java:141)
at browser.AppletDisplayItem.destroy(AppletDisplayItem.java:318)
at browser.Document.destroyApplets(Document.java:305)
at browser.WRWindow.destroyApplets(WRWindow.java:223)
at browser.WRWindow.uncacheCurrentDocument(WRWindow.java:513)
at browser.WRWindow.reload(WRWindow.java:405)
at browser.ReloadButton.selected(hotjava.java:512)
at awt.WServer.run(WServer.java:66)
Failed to stop: java.lang.IncompatibleClassChangeException: net.NetworkServer: method stop()V not found
Any ideas?
GregZ
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com