]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.init/src/org/argeo/init/StaticRuntimeContext.java
Better integrate RCP build
[lgpl/argeo-commons.git] / org.argeo.init / src / org / argeo / init / StaticRuntimeContext.java
1 package org.argeo.init;
2
3 import java.util.Map;
4
5 public class StaticRuntimeContext implements RuntimeContext {
6 private Map<String, String> config;
7
8 private boolean running = false;
9
10 protected StaticRuntimeContext(Map<String, String> config) {
11 this.config = config;
12 }
13
14 @Override
15 public synchronized void run() {
16 running = true;
17 notifyAll();
18 }
19
20 @Override
21 public void waitForStop(long timeout) throws InterruptedException {
22 long begin = System.currentTimeMillis();
23 while (running && (timeout == 0 || System.currentTimeMillis() - begin < timeout)) {
24 synchronized (this) {
25 wait(500);
26 }
27 }
28 }
29
30 @Override
31 public synchronized void close() throws Exception {
32 running = false;
33 }
34
35 }