managed the shutdown of server with first notify execution threads and after wait for them, issue
@@ -418,6 +418,8 @@ public class OClientConnectionManager {
public void shutdown() {
timerTask.cancel();
+ List<ONetworkProtocol> toWait = new ArrayList<ONetworkProtocol>();
+
final Iterator<Entry<Integer, OClientConnection>> iterator = connections.entrySet().iterator();
while (iterator.hasNext()) {
final Entry<Integer, OClientConnection> entry = iterator.next();
@@ -465,11 +467,19 @@ public class OClientConnectionManager {
OLogManager.instance().debug(this, "Sending interrupt signal to thread %s", protocol);
protocol.interrupt();
}
-
- // protocol.join();
+ toWait.add(protocol);
}
}
}
+
+ for (ONetworkProtocol protocol : toWait) {
+ try {
+ protocol.join();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
}
public void killAllChannels() {
