Search in sources :

Example 61 with NulsRuntimeException

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);
}
Also used : AbstractNulsQueue(io.nuls.core.utils.queue.intf.AbstractNulsQueue) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 62 with NulsRuntimeException

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());
}
Also used : AbstractNulsQueue(io.nuls.core.utils.queue.intf.AbstractNulsQueue) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 63 with NulsRuntimeException

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());
}
Also used : AbstractNulsQueue(io.nuls.core.utils.queue.intf.AbstractNulsQueue) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException) IOException(java.io.IOException) FileFormatException(io.nuls.core.utils.queue.fqueue.exception.FileFormatException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 64 with NulsRuntimeException

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);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Aggregations

NulsRuntimeException (io.nuls.core.exception.NulsRuntimeException)64 NulsException (io.nuls.core.exception.NulsException)26 IOException (java.io.IOException)11 Transaction (io.nuls.core.chain.entity.Transaction)10 ArrayList (java.util.ArrayList)9 Account (io.nuls.account.entity.Account)7 AbstractNulsQueue (io.nuls.core.utils.queue.intf.AbstractNulsQueue)7 DbSession (io.nuls.db.transactional.annotation.DbSession)6 CoinTransferData (io.nuls.ledger.entity.params.CoinTransferData)5 ValidateResult (io.nuls.core.validate.ValidateResult)4 Coin (io.nuls.ledger.entity.params.Coin)4 TransactionEvent (io.nuls.ledger.event.TransactionEvent)4 AccountService (io.nuls.account.service.intf.AccountService)3 Block (io.nuls.core.chain.entity.Block)3 AccountPo (io.nuls.db.entity.AccountPo)3 AbstractCoinTransaction (io.nuls.ledger.entity.tx.AbstractCoinTransaction)3 BlockHashResponse (io.nuls.consensus.entity.BlockHashResponse)2 RedPunishData (io.nuls.consensus.entity.RedPunishData)2 BestCorrectBlock (io.nuls.consensus.entity.block.BestCorrectBlock)2 Agent (io.nuls.consensus.entity.member.Agent)2