The code inside the "ServerSocketStreamSource" need some addtion:

before calling the acceptor...isLCosed() method shall be called.

This will not allow to open a new socket for new connection request on this
server socket.

while ((a.getSocket() == null) && (!theServer.isClosed())) {
.........

Hope thhis make sense.

-Niranjan.

Yu Gu wrote:
> 
> 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 not 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
> 

-- 
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.-tp24365555p25244063.html
Sent from the hl7api-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to