com.xxdb.streaming.client.QueueManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-java Show documentation
Show all versions of api-java Show documentation
The messaging and data conversion protocol between Java and DolphinDB server
package com.xxdb.streaming.client;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import com.xxdb.streaming.client.IMessage;
class QueueManager {
private HashMap>> queueMap = new HashMap>>();
public synchronized BlockingQueue> addQueue(String topic) {
if(!queueMap.containsKey(topic)){
BlockingQueue> q = new ArrayBlockingQueue<>(4096);
queueMap.put(topic, q);
return q;
}
throw new RuntimeException("Topic " + topic + " already subscribed");
}
public synchronized BlockingQueue> getQueue(String topic) {
BlockingQueue> q = queueMap.get(topic);;
return q;
}
public synchronized void removeQueue(String topic) {
queueMap.remove(topic);
}
}