Commit 5c548081 authored by Lukáš Marek's avatar Lukáš Marek
Browse files

fixed several problems with new analysis dispatcher

parent 94ef7513
package ch.usi.dag.dislreserver.msg.analyze.mtdispatch;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.LinkedBlockingQueue;
import ch.usi.dag.dislreserver.exception.DiSLREServerFatalException;
......@@ -13,8 +13,9 @@ import ch.usi.dag.dislreserver.exception.DiSLREServerFatalException;
class ATEManager {
protected final Map<Long, AnalysisTaskExecutor> liveExecutors =
new HashMap<Long, AnalysisTaskExecutor>();
// we need concurrent for waitForAllToProcessEpoch method
protected final ConcurrentMap<Long, AnalysisTaskExecutor> liveExecutors =
new ConcurrentHashMap<Long, AnalysisTaskExecutor>();
protected final BlockingQueue<AnalysisTaskExecutor> endingExecutors =
new LinkedBlockingQueue<AnalysisTaskExecutor>();
......@@ -2,6 +2,7 @@ package ch.usi.dag.dislreserver.msg.analyze.mtdispatch;
import java.util.List;
import ch.usi.dag.dislreserver.exception.DiSLREServerFatalException;
import ch.usi.dag.dislreserver.msg.analyze.AnalysisInvocation;
// Each thread has dedicated queue where new tasks are submitted.
......@@ -82,7 +83,22 @@ public class AnalysisDispatcher {
// NOTE: we are not updating the executor is ending state because
// whole shadow vm is ending
// wait for ending
// wait for analysis threads
// wait for free thread
try {
// signal end
oftExec.addTask(new ObjectFreeTask());
// wait for end
} catch (InterruptedException e) {
throw new DiSLREServerFatalException(
"Interrupted while waiting on obj free thread to finish",
......@@ -53,7 +53,7 @@ public final class RequestDispatcher {
final Map <Byte, RequestHandler> requestMap = new HashMap <Byte, RequestHandler> ();
requestMap.put (__REQUEST_ID_CLOSE__, new CloseHandler ());
AnalysisHandler anlHndl = new AnalysisHandler ();
requestMap.put (__REQUEST_ID_INVOKE_ANALYSIS__, new AnalysisHandler ());
requestMap.put (__REQUEST_ID_INVOKE_ANALYSIS__, anlHndl);
requestMap.put (__REQUEST_ID_OBJECT_FREE__, new ObjectFreeHandler (anlHndl));
requestMap.put (__REQUEST_ID_NEW_CLASS__, new NewClassHandler ());
requestMap.put (__REQUEST_ID_CLASS_INFO__, new ClassInfoHandler ());
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment