use of io.nuls.core.exception.NulsRuntimeException 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.exception.NulsRuntimeException 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.exception.NulsRuntimeException 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());
}
use of io.nuls.core.exception.NulsRuntimeException in project nuls by nuls-io.
the class ModuleService method startModules.
public void startModules(Map<String, String> bootstrapClasses) {
moduleManager.setModulesCfg(bootstrapClasses);
List<String> keyList = new ArrayList<>(bootstrapClasses.keySet());
for (String key : keyList) {
try {
startModule(key, bootstrapClasses.get(key));
} catch (Exception e) {
throw new NulsRuntimeException(e);
}
}
}
Aggregations