FDA-102
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
package ch.psi.fda.rest;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -40,12 +41,21 @@ public class FdaqEngine {
|
||||
private ZMQDataService zmqService;
|
||||
private boolean stream = false;
|
||||
|
||||
private ExecutorService eservice;
|
||||
|
||||
@Inject
|
||||
public FdaqEngine(ZMQDataService zmqService){
|
||||
this.zmqService = zmqService;
|
||||
|
||||
eservice = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
|
||||
public void acquire(String trackingId, FdaqRequest request){
|
||||
|
||||
if(fdaq!=null && fdaq.isRunning()){
|
||||
throw new IllegalStateException("FDAQ is already running");
|
||||
}
|
||||
|
||||
bus = new AsyncEventBus(Executors.newSingleThreadExecutor());
|
||||
fdaq = new FdaqService(bus);
|
||||
|
||||
@@ -60,8 +70,13 @@ public class FdaqEngine {
|
||||
bus.register(zmqService);
|
||||
}
|
||||
|
||||
|
||||
fdaq.acquire();
|
||||
|
||||
eservice.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fdaq.acquire();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void stop(){
|
||||
|
||||
Reference in New Issue
Block a user