@@ -31,7 +31,8 @@ public void run() {
3131 this .remoteAddress = ASAPEncounterHelper .getRemoteAddress (socket );
3232 System .out .println ("socket created" );
3333 if (this .waitForConnectionThread != null ) {
34- this .waitForConnectionThread .interrupt ();
34+ //this.waitForConnectionThread.interrupt();
35+ this .waitForConnectionThread .notify ();
3536 }
3637 } catch (IOException e ) {
3738 e .printStackTrace ();
@@ -45,7 +46,8 @@ public InputStream getInputStream() throws IOException {
4546 }
4647 this .waitForConnectionThread = Thread .currentThread ();
4748 try {
48- Thread .sleep (Long .MAX_VALUE );
49+ //Thread.sleep(Long.MAX_VALUE);
50+ this .waitForConnectionThread .wait ();
4951 } catch (InterruptedException e ) {
5052 // great - do it again
5153 return this .getInputStream ();
@@ -62,7 +64,8 @@ public OutputStream getOutputStream() throws IOException {
6264 }
6365 this .waitForConnectionThread = Thread .currentThread ();
6466 try {
65- Thread .sleep (Long .MAX_VALUE );
67+ //Thread.sleep(Long.MAX_VALUE);
68+ this .waitForConnectionThread .wait ();
6669 } catch (InterruptedException e ) {
6770 // great - do it again
6871 return this .getOutputStream ();
@@ -79,7 +82,8 @@ public String getRemoteAddress() throws IOException {
7982 }
8083 this .waitForConnectionThread = Thread .currentThread ();
8184 try {
82- Thread .sleep (Long .MAX_VALUE );
85+ //Thread.sleep(Long.MAX_VALUE);
86+ this .waitForConnectionThread .wait ();
8387 } catch (InterruptedException e ) {
8488 // great - do it again
8589 }
0 commit comments