Search in sources :

Example 1 with BlockingQueueImpl

use of io.nuls.core.utils.queue.entity.BlockingQueueImpl in project nuls by nuls-io.

the class QueueService method createQueue.

/**
 * 创建一个持久化队列
 *
 * @param queueName    队列名称
 * @param maxSize      单个文件最大大小fileLimitLength/非持久化时是队列的最大长度
 * @param latelySecond 统计日志打印时间段
 * @return 是否创建成功
 */
public boolean createQueue(String queueName, Long maxSize, boolean persist, int latelySecond) {
    try {
        AbstractNulsQueue queue = null;
        if (persist) {
            queue = new PersistentQueue(queueName, maxSize);
        } else {
            queue = new BlockingQueueImpl(queueName, Integer.parseInt(maxSize + ""));
        }
        QueueManager.initQueue(queueName, queue, latelySecond);
        return true;
    } catch (Exception e) {
        Log.error("", e);
        return false;
    }
}
Also used : BlockingQueueImpl(io.nuls.core.utils.queue.entity.BlockingQueueImpl) AbstractNulsQueue(io.nuls.core.utils.queue.intf.AbstractNulsQueue) PersistentQueue(io.nuls.core.utils.queue.entity.PersistentQueue)

Aggregations

BlockingQueueImpl (io.nuls.core.utils.queue.entity.BlockingQueueImpl)1 PersistentQueue (io.nuls.core.utils.queue.entity.PersistentQueue)1 AbstractNulsQueue (io.nuls.core.utils.queue.intf.AbstractNulsQueue)1