Search in sources :

Example 1 with TimeoutException

use of com.lmax.disruptor.TimeoutException in project jstorm by alibaba.

the class TaskReceiver method deserializer.

public boolean deserializer(KryoTupleDeserializer deserializer, boolean forceConsume) {
    //LOG.debug("start Deserializer of task, {}", taskId);
    boolean isIdling = true;
    DisruptorQueue exeQueue = innerTaskTransfer.get(taskId);
    if (!taskStatus.isShutdown()) {
        if ((deserializeQueue.population() > 0 && exeQueue.pctFull() < 1.0) || forceConsume) {
            try {
                List<Object> objects = deserializeQueue.retreiveAvailableBatch();
                for (Object object : objects) {
                    deserialize(deserializer, (byte[]) object, exeQueue);
                }
                isIdling = false;
            } catch (InterruptedException e) {
                LOG.error("InterruptedException " + e.getCause());
                return isIdling;
            } catch (TimeoutException e) {
                return isIdling;
            } catch (Throwable e) {
                if (Utils.exceptionCauseIsInstanceOf(KryoException.class, e)) {
                    throw new RuntimeException(e);
                } else if (!taskStatus.isShutdown()) {
                    LOG.error("Unknow exception ", e);
                }
            }
        }
    } else {
        task.unregisterDeserializeQueue();
    }
    return isIdling;
}
Also used : KryoException(com.esotericsoftware.kryo.KryoException) DisruptorQueue(backtype.storm.utils.DisruptorQueue) TimeoutException(com.lmax.disruptor.TimeoutException)

Aggregations

DisruptorQueue (backtype.storm.utils.DisruptorQueue)1 KryoException (com.esotericsoftware.kryo.KryoException)1 TimeoutException (com.lmax.disruptor.TimeoutException)1