All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xxdb.streaming.client.QueueManager Maven / Gradle / Ivy

Go to download

The messaging and data conversion protocol between Java and DolphinDB server

There is a newer version: 1.0.27
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy