Ignore:
Timestamp:
2017-01-15T23:55:54+01:00 (7 years ago)
Author:
wiktorn
Message:

Wait in loop - properly handle thread interruptions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJobTest.java

    r11450 r11465  
    100100     */
    101101    @Test
    102     @SuppressFBWarnings(value = "WA_NOT_IN_LOOP")
    103     public void testUnknownHost() throws IOException, InterruptedException {
     102    public void testUnknownHost() throws IOException {
    104103        String key = "key_unknown_host";
    105104        TestCachedTileLoaderJob job = new TestCachedTileLoaderJob("http://unkownhost.unkownhost/unkown", key);
     
    107106        job.submit(listener, true);
    108107        synchronized (listener) {
    109             if (!listener.ready) {
    110                 listener.wait();
     108            while (!listener.ready) {
     109                try {
     110                    listener.wait();
     111                } catch (InterruptedException e1) {
     112                    // do nothing, still wait
     113                }
    111114            }
    112115        }
     
    124127        job.submit(listener, true);
    125128        synchronized (listener) {
    126             if (!listener.ready) {
    127                 listener.wait();
     129            while (!listener.ready) {
     130                try {
     131                    listener.wait();
     132                } catch (InterruptedException e1) {
     133                    // do nothing, wait
     134                }
    128135            }
    129136        }
Note: See TracChangeset for help on using the changeset viewer.