| 1 |
/* |
| 2 |
* Copyright (c) 2016-present, RxJava Contributors. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in |
| 5 |
* compliance with the License. You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software distributed under the License is |
| 10 |
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See |
| 11 |
* the License for the specific language governing permissions and limitations under the License. |
| 12 |
*/ |
| 13 |
|
| 14 |
package io.reactivex.rxjava3.schedulers; |
| 15 |
|
| 16 |
import static org.junit.Assert.*; |
| 17 |
|
| 18 |
import java.lang.management.*; |
| 19 |
import java.util.List; |
| 20 |
import java.util.concurrent.*; |
| 21 |
import java.util.concurrent.atomic.*; |
| 22 |
|
| 23 |
import org.junit.Test; |
| 24 |
|
| 25 |
import io.reactivex.rxjava3.core.Scheduler; |
| 26 |
import io.reactivex.rxjava3.core.Scheduler.Worker; |
| 27 |
import io.reactivex.rxjava3.disposables.Disposable; |
| 28 |
import io.reactivex.rxjava3.internal.disposables.*; |
| 29 |
import io.reactivex.rxjava3.internal.functions.Functions; |
| 30 |
import io.reactivex.rxjava3.internal.schedulers.*; |
| 31 |
import io.reactivex.rxjava3.plugins.RxJavaPlugins; |
| 32 |
import io.reactivex.rxjava3.testsupport.TestHelper; |
| 33 |
|
| 34 |
public class ExecutorSchedulerTest extends AbstractSchedulerConcurrencyTests { |
| 35 |
|
| 36 |
static final Executor executor = Executors.newFixedThreadPool(2, new RxThreadFactory("TestCustomPool")); |
| 37 |
|
| 38 |
@Override |
| 39 |
protected Scheduler getScheduler() { |
| 40 |
return Schedulers.from(executor); |
| 41 |
} |
| 42 |
|
| 43 |
@Test |
| 44 |
public final void handledErrorIsNotDeliveredToThreadHandler() throws InterruptedException { |
| 45 |
SchedulerTestHelper.handledErrorIsNotDeliveredToThreadHandler(getScheduler()); |
| 46 |
} |
| 47 |
|
| 48 |
public static void cancelledRetention(Scheduler.Worker w, boolean periodic) throws InterruptedException { |
| 49 |
System.out.println("Wait before GC"); |
| 50 |
Thread.sleep(1000); |
| 51 |
|
| 52 |
System.out.println("GC"); |
| 53 |
System.gc(); |
| 54 |
|
| 55 |
Thread.sleep(1000); |
| 56 |
|
| 57 |
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean(); |
| 58 |
long initial = memoryMXBean.getHeapMemoryUsage().getUsed(); |
| 59 |
|
| 60 |
System.out.printf("Starting: %.3f MB%n", initial / 1024.0 / 1024.0); |
| 61 |
|
| 62 |
int n = 100 * 1000; |
| 63 |
if (periodic) { |
| 64 |
final CountDownLatch cdl = new CountDownLatch(n); |
| 65 |
final Runnable action = new Runnable() { |
| 66 |
@Override |
| 67 |
public void run() { |
| 68 |
cdl.countDown(); |
| 69 |
} |
| 70 |
}; |
| 71 |
for (int i = 0; i < n; i++) { |
| 72 |
if (i % 50000 == 0) { |
| 73 |
System.out.println(" -> still scheduling: " + i); |
| 74 |
} |
| 75 |
w.schedulePeriodically(action, 0, 1, TimeUnit.DAYS); |
| 76 |
} |
| 77 |
|
| 78 |
System.out.println("Waiting for the first round to finish..."); |
| 79 |
cdl.await(); |
| 80 |
} else { |
| 81 |
for (int i = 0; i < n; i++) { |
| 82 |
if (i % 50000 == 0) { |
| 83 |
System.out.println(" -> still scheduling: " + i); |
| 84 |
} |
| 85 |
w.schedule(Functions.EMPTY_RUNNABLE, 1, TimeUnit.DAYS); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
long after = memoryMXBean.getHeapMemoryUsage().getUsed(); |
| 90 |
System.out.printf("Peak: %.3f MB%n", after / 1024.0 / 1024.0); |
| 91 |
|
| 92 |
w.dispose(); |
| 93 |
|
| 94 |
System.out.println("Wait before second GC"); |
| 95 |
System.out.println("JDK 6 purge is N log N because it removes and shifts one by one"); |
| 96 |
int t = (int)(n * Math.log(n) / 100) + 1000; |
| 97 |
int sleepStep = 100; |
| 98 |
while (t > 0) { |
| 99 |
System.out.printf(" >> Waiting for purge: %.2f s remaining%n", t / 1000d); |
| 100 |
|
| 101 |
System.gc(); |
| 102 |
|
| 103 |
long finish = memoryMXBean.getHeapMemoryUsage().getUsed(); |
| 104 |
System.out.printf("After: %.3f MB%n", finish / 1024.0 / 1024.0); |
| 105 |
if (finish <= initial * 5) { |
| 106 |
break; |
| 107 |
} |
| 108 |
|
| 109 |
Thread.sleep(sleepStep); |
| 110 |
t -= sleepStep; |
| 111 |
} |
| 112 |
|
| 113 |
System.out.println("Second GC"); |
| 114 |
System.gc(); |
| 115 |
|
| 116 |
t = 2000; |
| 117 |
long finish = memoryMXBean.getHeapMemoryUsage().getUsed(); |
| 118 |
|
| 119 |
while (t > 0) { |
| 120 |
System.out.printf("After: %.3f MB%n", finish / 1024.0 / 1024.0); |
| 121 |
|
| 122 |
if (finish <= initial * 5) { |
| 123 |
return; |
| 124 |
} |
| 125 |
Thread.sleep(sleepStep); |
| 126 |
t -= sleepStep; |
| 127 |
finish = memoryMXBean.getHeapMemoryUsage().getUsed(); |
| 128 |
} |
| 129 |
|
| 130 |
fail(String.format("Tasks retained: %.3f -> %.3f -> %.3f", initial / 1024 / 1024.0, after / 1024 / 1024.0, finish / 1024 / 1024d)); |
| 131 |
} |
| 132 |
|
| 133 |
@Test |
| 134 |
public void cancelledTaskRetention() throws InterruptedException { |
| 135 |
ExecutorService exec = Executors.newSingleThreadExecutor(); |
| 136 |
Scheduler s = Schedulers.from(exec); |
| 137 |
try { |
| 138 |
Scheduler.Worker w = s.createWorker(); |
| 139 |
try { |
| 140 |
cancelledRetention(w, false); |
| 141 |
} finally { |
| 142 |
w.dispose(); |
| 143 |
} |
| 144 |
|
| 145 |
w = s.createWorker(); |
| 146 |
try { |
| 147 |
cancelledRetention(w, true); |
| 148 |
} finally { |
| 149 |
w.dispose(); |
| 150 |
} |
| 151 |
} finally { |
| 152 |
exec.shutdownNow(); |
| 153 |
} |
| 154 |
} |
| 155 |
|
| 156 |
/** A simple executor which queues tasks and executes them one-by-one if executeOne() is called. */ |
| 157 |
static final class TestExecutor implements Executor { |
| 158 |
final ConcurrentLinkedQueue<Runnable> queue = new ConcurrentLinkedQueue<>(); |
| 159 |
@Override |
| 160 |
public void execute(Runnable command) { |
| 161 |
queue.offer(command); |
| 162 |
} |
| 163 |
public void executeOne() { |
| 164 |
Runnable r = queue.poll(); |
| 165 |
if (r != null) { |
| 166 |
r.run(); |
| 167 |
} |
| 168 |
} |
| 169 |
public void executeAll() { |
| 170 |
Runnable r; |
| 171 |
while ((r = queue.poll()) != null) { |
| 172 |
r.run(); |
| 173 |
} |
| 174 |
} |
| 175 |
} |
| 176 |
|
| 177 |
@Test |
| 178 |
public void cancelledTasksDontRun() { |
| 179 |
final AtomicInteger calls = new AtomicInteger(); |
| 180 |
Runnable task = new Runnable() { |
| 181 |
@Override |
| 182 |
public void run() { |
| 183 |
calls.getAndIncrement(); |
| 184 |
} |
| 185 |
}; |
| 186 |
TestExecutor exec = new TestExecutor(); |
| 187 |
Scheduler custom = Schedulers.from(exec); |
| 188 |
Worker w = custom.createWorker(); |
| 189 |
try { |
| 190 |
Disposable d1 = w.schedule(task); |
| 191 |
Disposable d2 = w.schedule(task); |
| 192 |
Disposable d3 = w.schedule(task); |
| 193 |
|
| 194 |
d1.dispose(); |
| 195 |
d2.dispose(); |
| 196 |
d3.dispose(); |
| 197 |
|
| 198 |
exec.executeAll(); |
| 199 |
|
| 200 |
assertEquals(0, calls.get()); |
| 201 |
} finally { |
| 202 |
w.dispose(); |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
@Test |
| 207 |
public void cancelledWorkerDoesntRunTasks() { |
| 208 |
final AtomicInteger calls = new AtomicInteger(); |
| 209 |
Runnable task = new Runnable() { |
| 210 |
@Override |
| 211 |
public void run() { |
| 212 |
calls.getAndIncrement(); |
| 213 |
} |
| 214 |
}; |
| 215 |
TestExecutor exec = new TestExecutor(); |
| 216 |
Scheduler custom = Schedulers.from(exec); |
| 217 |
Worker w = custom.createWorker(); |
| 218 |
try { |
| 219 |
w.schedule(task); |
| 220 |
w.schedule(task); |
| 221 |
w.schedule(task); |
| 222 |
} finally { |
| 223 |
w.dispose(); |
| 224 |
} |
| 225 |
exec.executeAll(); |
| 226 |
assertEquals(0, calls.get()); |
| 227 |
} |
| 228 |
|
| 229 |
@Test |
| 230 |
public void plainExecutor() throws Exception { |
| 231 |
Scheduler s = Schedulers.from(new Executor() { |
| 232 |
@Override |
| 233 |
public void execute(Runnable r) { |
| 234 |
r.run(); |
| 235 |
} |
| 236 |
}); |
| 237 |
|
| 238 |
final CountDownLatch cdl = new CountDownLatch(5); |
| 239 |
|
| 240 |
Runnable r = new Runnable() { |
| 241 |
@Override |
| 242 |
public void run() { |
| 243 |
cdl.countDown(); |
| 244 |
} |
| 245 |
}; |
| 246 |
|
| 247 |
s.scheduleDirect(r); |
| 248 |
|
| 249 |
s.scheduleDirect(r, 50, TimeUnit.MILLISECONDS); |
| 250 |
|
| 251 |
Disposable d = s.schedulePeriodicallyDirect(r, 10, 10, TimeUnit.MILLISECONDS); |
| 252 |
|
| 253 |
try { |
| 254 |
assertTrue(cdl.await(5, TimeUnit.SECONDS)); |
| 255 |
} finally { |
| 256 |
d.dispose(); |
| 257 |
} |
| 258 |
|
| 259 |
assertTrue(d.isDisposed()); |
| 260 |
} |
| 261 |
|
| 262 |
@Test |
| 263 |
public void rejectingExecutor() { |
| 264 |
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); |
| 265 |
exec.shutdown(); |
| 266 |
|
| 267 |
Scheduler s = Schedulers.from(exec); |
| 268 |
|
| 269 |
List<Throwable> errors = TestHelper.trackPluginErrors(); |
| 270 |
|
| 271 |
try { |
| 272 |
assertSame(EmptyDisposable.INSTANCE, s.scheduleDirect(Functions.EMPTY_RUNNABLE)); |
| 273 |
|
| 274 |
assertSame(EmptyDisposable.INSTANCE, s.scheduleDirect(Functions.EMPTY_RUNNABLE, 10, TimeUnit.MILLISECONDS)); |
| 275 |
|
| 276 |
assertSame(EmptyDisposable.INSTANCE, s.schedulePeriodicallyDirect(Functions.EMPTY_RUNNABLE, 10, 10, TimeUnit.MILLISECONDS)); |
| 277 |
|
| 278 |
TestHelper.assertUndeliverable(errors, 0, RejectedExecutionException.class); |
| 279 |
TestHelper.assertUndeliverable(errors, 1, RejectedExecutionException.class); |
| 280 |
TestHelper.assertUndeliverable(errors, 2, RejectedExecutionException.class); |
| 281 |
} finally { |
| 282 |
RxJavaPlugins.reset(); |
| 283 |
} |
| 284 |
} |
| 285 |
|
| 286 |
@Test |
| 287 |
public void rejectingExecutorWorker() { |
| 288 |
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); |
| 289 |
exec.shutdown(); |
| 290 |
|
| 291 |
List<Throwable> errors = TestHelper.trackPluginErrors(); |
| 292 |
|
| 293 |
try { |
| 294 |
Worker s = Schedulers.from(exec).createWorker(); |
| 295 |
assertSame(EmptyDisposable.INSTANCE, s.schedule(Functions.EMPTY_RUNNABLE)); |
| 296 |
|
| 297 |
s = Schedulers.from(exec).createWorker(); |
| 298 |
assertSame(EmptyDisposable.INSTANCE, s.schedule(Functions.EMPTY_RUNNABLE, 10, TimeUnit.MILLISECONDS)); |
| 299 |
|
| 300 |
s = Schedulers.from(exec).createWorker(); |
| 301 |
assertSame(EmptyDisposable.INSTANCE, s.schedulePeriodically(Functions.EMPTY_RUNNABLE, 10, 10, TimeUnit.MILLISECONDS)); |
| 302 |
|
| 303 |
TestHelper.assertUndeliverable(errors, 0, RejectedExecutionException.class); |
| 304 |
TestHelper.assertUndeliverable(errors, 1, RejectedExecutionException.class); |
| 305 |
TestHelper.assertUndeliverable(errors, 2, RejectedExecutionException.class); |
| 306 |
} finally { |
| 307 |
RxJavaPlugins.reset(); |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
@Test |
| 312 |
public void reuseScheduledExecutor() throws Exception { |
| 313 |
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); |
| 314 |
|
| 315 |
try { |
| 316 |
Scheduler s = Schedulers.from(exec); |
| 317 |
|
| 318 |
final CountDownLatch cdl = new CountDownLatch(8); |
| 319 |
|
| 320 |
Runnable r = new Runnable() { |
| 321 |
@Override |
| 322 |
public void run() { |
| 323 |
cdl.countDown(); |
| 324 |
} |
| 325 |
}; |
| 326 |
|
| 327 |
s.scheduleDirect(r); |
| 328 |
|
| 329 |
s.scheduleDirect(r, 10, TimeUnit.MILLISECONDS); |
| 330 |
|
| 331 |
Disposable d = s.schedulePeriodicallyDirect(r, 10, 10, TimeUnit.MILLISECONDS); |
| 332 |
|
| 333 |
try { |
| 334 |
assertTrue(cdl.await(5, TimeUnit.SECONDS)); |
| 335 |
} finally { |
| 336 |
d.dispose(); |
| 337 |
} |
| 338 |
} finally { |
| 339 |
exec.shutdown(); |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
@Test |
| 344 |
public void reuseScheduledExecutorAsWorker() throws Exception { |
| 345 |
ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(); |
| 346 |
|
| 347 |
Worker s = Schedulers.from(exec).createWorker(); |
| 348 |
|
| 349 |
assertFalse(s.isDisposed()); |
| 350 |
try { |
| 351 |
|
| 352 |
final CountDownLatch cdl = new CountDownLatch(8); |
| 353 |
|
| 354 |
Runnable r = new Runnable() { |
| 355 |
@Override |
| 356 |
public void run() { |
| 357 |
cdl.countDown(); |
| 358 |
} |
| 359 |
}; |
| 360 |
|
| 361 |
s.schedule(r); |
| 362 |
|
| 363 |
s.schedule(r, 10, TimeUnit.MILLISECONDS); |
| 364 |
|
| 365 |
Disposable d = s.schedulePeriodically(r, 10, 10, TimeUnit.MILLISECONDS); |
| 366 |
|
| 367 |
try { |
| 368 |
assertTrue(cdl.await(5, TimeUnit.SECONDS)); |
| 369 |
} finally { |
| 370 |
d.dispose(); |
| 371 |
} |
| 372 |
} finally { |
| 373 |
s.dispose(); |
| 374 |
exec.shutdown(); |
| 375 |
} |
| 376 |
|
| 377 |
assertTrue(s.isDisposed()); |
| 378 |
} |
| 379 |
|
| 380 |
@Test |
| 381 |
public void disposeRace() { |
| 382 |
ExecutorService exec = Executors.newSingleThreadExecutor(); |
| 383 |
final Scheduler s = Schedulers.from(exec); |
| 384 |
try { |
| 385 |
for (int i = 0; i < 500; i++) { |
| 386 |
final Worker w = s.createWorker(); |
| 387 |
|
| 388 |
final AtomicInteger c = new AtomicInteger(2); |
| 389 |
|
| 390 |
w.schedule(new Runnable() { |
| 391 |
@Override |
| 392 |
public void run() { |
| 393 |
c.decrementAndGet(); |
| 394 |
while (c.get() != 0) { } |
| 395 |
} |
| 396 |
}); |
| 397 |
|
| 398 |
c.decrementAndGet(); |
| 399 |
while (c.get() != 0) { } |
| 400 |
w.dispose(); |
| 401 |
} |
| 402 |
} finally { |
| 403 |
exec.shutdownNow(); |
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
@Test |
| 408 |
public void runnableDisposed() { |
| 409 |
final Scheduler s = Schedulers.from(new Executor() { |
| 410 |
@Override |
| 411 |
public void execute(Runnable r) { |
| 412 |
r.run(); |
| 413 |
} |
| 414 |
}); |
| 415 |
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE); |
| 416 |
|
| 417 |
assertTrue(d.isDisposed()); |
| 418 |
} |
| 419 |
|
| 420 |
@Test |
| 421 |
public void runnableDisposedAsync() throws Exception { |
| 422 |
final Scheduler s = Schedulers.from(new Executor() { |
| 423 |
@Override |
| 424 |
public void execute(Runnable r) { |
| 425 |
new Thread(r).start(); |
| 426 |
} |
| 427 |
}); |
| 428 |
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE); |
| 429 |
|
| 430 |
while (!d.isDisposed()) { |
| 431 |
Thread.sleep(1); |
| 432 |
} |
| 433 |
} |
| 434 |
|
| 435 |
@Test |
| 436 |
public void runnableDisposedAsync2() throws Exception { |
| 437 |
final Scheduler s = Schedulers.from(executor); |
| 438 |
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE); |
| 439 |
|
| 440 |
while (!d.isDisposed()) { |
| 441 |
Thread.sleep(1); |
| 442 |
} |
| 443 |
} |
| 444 |
|
| 445 |
@Test |
| 446 |
public void runnableDisposedAsyncCrash() throws Exception { |
| 447 |
final Scheduler s = Schedulers.from(new Executor() { |
| 448 |
@Override |
| 449 |
public void execute(Runnable r) { |
| 450 |
new Thread(r).start(); |
| 451 |
} |
| 452 |
}); |
| 453 |
Disposable d = s.scheduleDirect(new Runnable() { |
| 454 |
@Override |
| 455 |
public void run() { |
| 456 |
throw new IllegalStateException(); |
| 457 |
} |
| 458 |
}); |
| 459 |
|
| 460 |
while (!d.isDisposed()) { |
| 461 |
Thread.sleep(1); |
| 462 |
} |
| 463 |
} |
| 464 |
|
| 465 |
@Test |
| 466 |
public void runnableDisposedAsyncTimed() throws Exception { |
| 467 |
final Scheduler s = Schedulers.from(new Executor() { |
| 468 |
@Override |
| 469 |
public void execute(Runnable r) { |
| 470 |
new Thread(r).start(); |
| 471 |
} |
| 472 |
}); |
| 473 |
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE, 1, TimeUnit.MILLISECONDS); |
| 474 |
|
| 475 |
while (!d.isDisposed()) { |
| 476 |
Thread.sleep(1); |
| 477 |
} |
| 478 |
} |
| 479 |
|
| 480 |
@Test |
| 481 |
public void runnableDisposedAsyncTimed2() throws Exception { |
| 482 |
ExecutorService executorScheduler = Executors.newScheduledThreadPool(1, new RxThreadFactory("TestCustomPoolTimed")); |
| 483 |
try { |
| 484 |
final Scheduler s = Schedulers.from(executorScheduler); |
| 485 |
Disposable d = s.scheduleDirect(Functions.EMPTY_RUNNABLE, 1, TimeUnit.MILLISECONDS); |
| 486 |
|
| 487 |
while (!d.isDisposed()) { |
| 488 |
Thread.sleep(1); |
| 489 |
} |
| 490 |
} finally { |
| 491 |
executorScheduler.shutdownNow(); |
| 492 |
} |
| 493 |
} |
| 494 |
|
| 495 |
@Test |
| 496 |
public void unwrapScheduleDirectTaskAfterDispose() { |
| 497 |
Scheduler scheduler = getScheduler(); |
| 498 |
final CountDownLatch cdl = new CountDownLatch(1); |
| 499 |
Runnable countDownRunnable = new Runnable() { |
| 500 |
@Override |
| 501 |
public void run() { |
| 502 |
cdl.countDown(); |
| 503 |
} |
| 504 |
}; |
| 505 |
Disposable disposable = scheduler.scheduleDirect(countDownRunnable, 100, TimeUnit.MILLISECONDS); |
| 506 |
SchedulerRunnableIntrospection wrapper = (SchedulerRunnableIntrospection) disposable; |
| 507 |
assertSame(countDownRunnable, wrapper.getWrappedRunnable()); |
| 508 |
disposable.dispose(); |
| 509 |
|
| 510 |
assertSame(Functions.EMPTY_RUNNABLE, wrapper.getWrappedRunnable()); |
| 511 |
} |
| 512 |
|
| 513 |
@Test |
| 514 |
public void interruptibleRunnableRunDisposeRace() { |
| 515 |
ExecutorService exec = Executors.newSingleThreadExecutor(); |
| 516 |
try { |
| 517 |
Scheduler s = Schedulers.from(r -> exec.execute(r), true); |
| 518 |
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { |
| 519 |
SequentialDisposable sd = new SequentialDisposable(); |
| 520 |
|
| 521 |
TestHelper.race( |
| 522 |
() -> sd.update(s.scheduleDirect(() -> { })), |
| 523 |
() -> sd.dispose() |
| 524 |
); |
| 525 |
} |
| 526 |
} finally { |
| 527 |
exec.shutdown(); |
| 528 |
} |
| 529 |
} |
| 530 |
|
| 531 |
@Test |
| 532 |
public void interruptibleRunnableRunDispose() { |
| 533 |
try { |
| 534 |
for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { |
| 535 |
AtomicReference<Runnable> runRef = new AtomicReference<>(); |
| 536 |
Scheduler s = Schedulers.from(r -> { |
| 537 |
runRef.set(r); |
| 538 |
}, true); |
| 539 |
|
| 540 |
Disposable d = s.scheduleDirect(() -> { }); |
| 541 |
TestHelper.race( |
| 542 |
() -> runRef.get().run(), |
| 543 |
() -> d.dispose() |
| 544 |
); |
| 545 |
} |
| 546 |
} finally { |
| 547 |
Thread.interrupted(); |
| 548 |
} |
| 549 |
} |
| 550 |
} |