use of io.nuls.core.utils.queue.intf.AbstractNulsQueue in project nuls by nuls-io.
the class QueueManager method remove.
public static <T> void remove(String queueName, T item) {
if (!Running) {
throw new NulsRuntimeException(ErrorCode.FAILED, "The DBModule is not running!");
}
AbstractNulsQueue queue = QUEUES_MAP.get(queueName);
if (null == queue) {
throw new NulsRuntimeException(ErrorCode.FAILED, "queue not exist");
}
queue.remove(item);
queue.getStatInfo().putOne();
Log.debug("从队列中删除数据,名称:{},当前长度:{}。", queueName, queue.size());
}
use of io.nuls.core.utils.queue.intf.AbstractNulsQueue in project nuls by nuls-io.
the class QueueManager method destroyQueue.
public static void destroyQueue(String queueName) throws IOException, FileFormatException {
if (!Running) {
throw new NulsRuntimeException(ErrorCode.FAILED, "The DBModule is not running!");
}
AbstractNulsQueue queue = QUEUES_MAP.get(queueName);
if (null == queue) {
throw new NulsRuntimeException(ErrorCode.FAILED, "queue not exist");
}
queue.distroy();
QUEUES_MAP.remove(queueName);
Log.debug("队列销毁,名称:{}。", queueName);
}
use of io.nuls.core.utils.queue.intf.AbstractNulsQueue in project nuls by nuls-io.
the class QueueManager method offer.
public static void offer(String queueName, Object item) {
if (!Running) {
throw new NulsRuntimeException(ErrorCode.FAILED, "The DBModule is not running!");
}
AbstractNulsQueue queue = QUEUES_MAP.get(queueName);
if (null == queue) {
throw new NulsRuntimeException(ErrorCode.FAILED, "queue not exist");
}
queue.offer(item);
queue.getStatInfo().putOne();
Log.debug("向队列中加入数据,名称:{},当前长度:{}。", queueName, queue.size());
}
use of io.nuls.core.utils.queue.intf.AbstractNulsQueue in project nuls by nuls-io.
the class QueueManager method close.
public static void close(String queueName) throws NulsRuntimeException {
if (!Running) {
throw new NulsRuntimeException(ErrorCode.FAILED, "The DBModule is not running!");
}
AbstractNulsQueue queue = QUEUES_MAP.get(queueName);
if (null == queue) {
throw new NulsRuntimeException(ErrorCode.FAILED, "queue not exist");
}
try {
queue.close();
} catch (Exception e) {
throw new NulsRuntimeException(e);
}
Log.debug("关闭队列实例,名称:{},当前长度:{}。", queueName, queue.size());
}
Aggregations