Hi all,
I start HL7Server in a new thread, but I don't know how to stop it.
I write the code like this:

class ServerSubThread
      extends Thread {
    public void run() {          
        startProvidingService();
    }
 }
ServerSubThread sst = new ServerSubThread();

public void startService(){
       sst.start();
}
public void stopService(){
      if (isRunning()) {
             hl7server.stop();
     }
}

public void startProvidingService() {
    ServerSocket ss = null;
    ss = new ServerSocket(this.port);
    ..................................
    hl7server = new HL7Server(ss, ari, safestorage);
    Processor processor = null;
    processor = hl7server.accept(null); 
   hl7server.start(null);              
}

when stopService method is called,it does stop the server,for it can still
receive the connection and response the sendAndReceive method from client . 
Should I end all the thread started by ServerSubThread ? How can I do that ?   
Thanks. Any help is appreciative.
Yu

-----
Just Do It !
-- 
View this message in context: 
http://www.nabble.com/How-can-I-stop-HL7Server---I-start-it-in-a-new-thread%2Cbut-I-can-not-stop-it.-tp24365555p24365555.html
Sent from the hl7api-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have 
the opportunity to enter the BlackBerry Developer Challenge. See full prize 
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to