Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.io.File;
import java.nio.file.Path;
import java.util.List;
import java.util.TreeMap;
import java.util.TreeSet;
import org.jlab.clara.std.services.EventWriterException;
import org.jlab.detector.calib.utils.ConstantsManager;
import org.jlab.detector.helicity.HelicitySequenceDelayed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
*
* @author baltzell
*/
public class CLASDecoderPool {
public class CLASDecoderPool extends ConcurrentLinkedQueue<CLASDecoder> {

ConcurrentLinkedQueue<CLASDecoder> pool;

int sharedConstantsManagers = 64;

public CLASDecoderPool(int size, String variation, String timestamp) {

pool = new ConcurrentLinkedQueue<>();
super();

CLASDecoder d0 = null;

for (int i=0; i<size; i++) {
Expand All @@ -30,16 +28,15 @@ public CLASDecoderPool(int size, String variation, String timestamp) {
}
else d = new CLASDecoder(d0);

pool.add(d);
add(d);
}
}

public CLASDecoder take() throws InterruptedException {
return pool.poll();
}
volatile static CLASDecoderPool instance = null;

public void put(CLASDecoder decoder) throws InterruptedException {
pool.offer(decoder);
public static synchronized CLASDecoderPool getInstance() {
if (instance == null)
instance = new CLASDecoderPool(64,"default",null);
return instance;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public EngineData execute(EngineData input) {
}
HipoDataEvent hipo;
try {
CLASDecoder d = pool.take();
CLASDecoder d = pool.poll();
hipo = new HipoDataEvent(d.getDecodedEvent(evio),schema);
pool.put(d);
pool.offer(d);
output.setData("binary/data-hipo", hipo.getHipoEvent());
} catch (Exception e) {
String msg = String.format("Error processing input event%n%n%s", ClaraUtil.reportException(e));
Expand Down
Loading