OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 132 Rev 180
Line 105... Line 105...
105
            } else {
105
            } else {
106
                runnables = null;
106
                runnables = null;
107
            }
107
            }
108
        }
108
        }
109
 
109
 
-
 
110
        boolean interrupted = false;
110
        if (didDie) {
111
        if (didDie) {
111
            // only CacheTimeOut are in our executor (plus the runnable for trimWatchers())
112
            // only CacheTimeOut are in our executor (plus the runnable for trimWatchers())
112
            // and all items in a cache (even the running ones) have a timeout (but they don't all
113
            // and all items in a cache (even the running ones) have a timeout (but they don't all
113
            // have a watcher : watcherFactory can be null and an item can have no data)
114
            // have a watcher : watcherFactory can be null and an item can have no data)
114
            for (final Runnable r : runnables) {
115
            for (final Runnable r : runnables) {
Line 116... Line 117...
116
                if (sft.getInner() instanceof CacheTimeOut) {
117
                if (sft.getInner() instanceof CacheTimeOut) {
117
                    sft.getInnerRunnable().run();
118
                    sft.getInnerRunnable().run();
118
                }
119
                }
119
            }
120
            }
120
 
121
 
-
 
122
            // make sure that the currently executing runnable is done before checking
-
 
123
            while (true) {
-
 
124
                try {
-
 
125
                    if (this.getTimer().awaitTermination(1, TimeUnit.SECONDS))
-
 
126
                        break;
-
 
127
                } catch (InterruptedException e) {
-
 
128
                    interrupted = true;
-
 
129
                }
-
 
130
            }
121
            synchronized (this) {
131
            synchronized (this) {
122
                purgeWatchers();
132
                purgeWatchers();
123
                assert this.watchers.isEmpty() : this.watchers.size() + " item(s) were not removed : " + this.watchers.values();
133
                assert this.watchers.isEmpty() : this.watchers.size() + " item(s) were not removed : " + this.watchers.values();
124
            }
134
            }
125
        }
135
        }
126
 
136
 
-
 
137
        if (interrupted)
-
 
138
            Thread.currentThread().interrupt();
127
        return didDie;
139
        return didDie;
128
    }
140
    }
129
 
141
 
130
    public final boolean isDying() {
142
    public final boolean isDying() {
131
        return this.getTimer().isShutdown();
143
        return this.getTimer().isShutdown();