Search in sources :

Example 56 with NulsRuntimeException

use of io.nuls.core.exception.NulsRuntimeException in project nuls by nuls-io.

the class MsgLog method debug.

/**
 * 提供debug级别基本的日志输出
 *
 * @param msg       需要显示的消息
 * @param throwable 异常信息
 */
public static void debug(String msg, Throwable throwable) {
    if (LOG.isDebugEnabled()) {
        String logContent = isStringBlank(getId()) ? (getLogTrace() + ":" + msg) : (getLogTrace() + "[" + getId() + "]" + ":" + msg);
        if (!(throwable instanceof NulsException) || !(throwable instanceof NulsRuntimeException)) {
            throwable = new NulsException(ErrorCode.FAILED, throwable);
        }
        LOG.debug(logContent, throwable);
    }
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 57 with NulsRuntimeException

use of io.nuls.core.exception.NulsRuntimeException in project nuls by nuls-io.

the class MsgLog method error.

public static void error(Throwable throwable) {
    String logContent = isStringBlank(getId()) ? (getLogTrace() + ":") : (getLogTrace() + "[" + getId() + "]" + ":");
    if (!(throwable instanceof NulsException) || !(throwable instanceof NulsRuntimeException)) {
        throwable = new NulsException(ErrorCode.FAILED, throwable);
    }
    LOG.error(logContent, throwable);
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 58 with NulsRuntimeException

use of io.nuls.core.exception.NulsRuntimeException in project nuls by nuls-io.

the class MsgLog method trace.

/**
 * 提供trace级别基本的日志输出
 *
 * @param msg       需要显示的消息
 * @param throwable 异常信息
 */
public static void trace(String msg, Throwable throwable) {
    String logContent = isStringBlank(getId()) ? (getLogTrace() + ":" + msg) : (getLogTrace() + "[" + getId() + "]" + ":" + msg);
    if (!(throwable instanceof NulsException) || !(throwable instanceof NulsRuntimeException)) {
        throwable = new NulsException(ErrorCode.FAILED, throwable);
    }
    LOG.trace(logContent, throwable);
}
Also used : NulsException(io.nuls.core.exception.NulsException) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 59 with NulsRuntimeException

use of io.nuls.core.exception.NulsRuntimeException in project nuls by nuls-io.

the class QueueManager method poll.

public static Object poll(String queueName) {
    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");
    }
    Object obj = queue.poll();
    boolean notNull = null != obj;
    if (notNull) {
        queue.getStatInfo().takeOne();
        Log.debug("从队列中取出数据,名称:{},当前长度:{}。", queueName, queue.size());
    }
    return obj;
}
Also used : AbstractNulsQueue(io.nuls.core.utils.queue.intf.AbstractNulsQueue) NulsRuntimeException(io.nuls.core.exception.NulsRuntimeException)

Example 60 with NulsRuntimeException

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