File tree Expand file tree Collapse file tree
src/main/java/com/mashape/unirest/http Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,14 +96,14 @@ public static void shutdown() throws IOException {
9696 syncClient .close ();
9797
9898 SyncIdleConnectionMonitorThread syncIdleConnectionMonitorThread = (SyncIdleConnectionMonitorThread ) Options .getOption (Option .SYNC_MONITOR );
99- syncIdleConnectionMonitorThread .shutdown ();
99+ syncIdleConnectionMonitorThread .interrupt ();
100100
101101 // Closing the async client (if running)
102102 CloseableHttpAsyncClient asyncClient = (CloseableHttpAsyncClient ) Options .getOption (Option .ASYNCHTTPCLIENT );
103103 if (asyncClient .isRunning ()) {
104104 asyncClient .close ();
105105 AsyncIdleConnectionMonitorThread asyncIdleConnectionMonitorThread = (AsyncIdleConnectionMonitorThread ) Options .getOption (Option .ASYNC_MONITOR );
106- asyncIdleConnectionMonitorThread .shutdown ();
106+ asyncIdleConnectionMonitorThread .interrupt ();
107107 }
108108
109109 }
Original file line number Diff line number Diff line change 77public class AsyncIdleConnectionMonitorThread extends Thread {
88
99 private final PoolingNHttpClientConnectionManager connMgr ;
10- private volatile boolean shutdown ;
1110
1211 public AsyncIdleConnectionMonitorThread (PoolingNHttpClientConnectionManager connMgr ) {
1312 super ();
@@ -18,7 +17,7 @@ public AsyncIdleConnectionMonitorThread(PoolingNHttpClientConnectionManager conn
1817 @ Override
1918 public void run () {
2019 try {
21- while (!shutdown ) {
20+ while (!Thread . currentThread (). isInterrupted () ) {
2221 synchronized (this ) {
2322 wait (5000 );
2423 // Close expired connections
@@ -33,11 +32,4 @@ public void run() {
3332 }
3433 }
3534
36- public void shutdown () {
37- shutdown = true ;
38- synchronized (this ) {
39- notifyAll ();
40- }
41- }
42-
4335}
Original file line number Diff line number Diff line change 77public class SyncIdleConnectionMonitorThread extends Thread {
88
99 private final HttpClientConnectionManager connMgr ;
10- private volatile boolean shutdown ;
1110
1211 public SyncIdleConnectionMonitorThread (HttpClientConnectionManager connMgr ) {
1312 super ();
@@ -18,7 +17,7 @@ public SyncIdleConnectionMonitorThread(HttpClientConnectionManager connMgr) {
1817 @ Override
1918 public void run () {
2019 try {
21- while (!shutdown ) {
20+ while (!Thread . currentThread (). isInterrupted () ) {
2221 synchronized (this ) {
2322 wait (5000 );
2423 // Close expired connections
@@ -33,11 +32,4 @@ public void run() {
3332 }
3433 }
3534
36- public void shutdown () {
37- shutdown = true ;
38- synchronized (this ) {
39- notifyAll ();
40- }
41- }
42-
4335}
You can’t perform that action at this time.
0 commit comments