Search in sources :

Example 1 with IllegalClassException

use of org.apache.storm.shade.org.apache.commons.lang.IllegalClassException in project storm by apache.

the class WindowsStateUpdater method updateState.

@Override
public void updateState(WindowsState state, List<TridentTuple> tuples, TridentCollector collector) {
    Long currentTxId = state.getCurrentTxId();
    LOG.debug("Removing triggers using WindowStateUpdater, txnId: [{}] ", currentTxId);
    for (TridentTuple tuple : tuples) {
        try {
            Object fieldValue = tuple.getValueByField(WindowTridentProcessor.TRIGGER_FIELD_NAME);
            if (!(fieldValue instanceof WindowTridentProcessor.TriggerInfo)) {
                throw new IllegalClassException(WindowTridentProcessor.TriggerInfo.class, fieldValue.getClass());
            }
            WindowTridentProcessor.TriggerInfo triggerInfo = (WindowTridentProcessor.TriggerInfo) fieldValue;
            String triggerCompletedKey = WindowTridentProcessor.getWindowTriggerInprocessIdPrefix(triggerInfo.windowTaskId) + currentTxId;
            LOG.debug("Removing trigger key [{}] and trigger completed key [{}] from store: [{}]", triggerInfo, triggerCompletedKey, windowsStore);
            windowsStore.removeAll(Lists.newArrayList(triggerInfo.generateTriggerKey(), triggerCompletedKey));
        } catch (Exception ex) {
            LOG.warn(ex.getMessage());
            collector.reportError(ex);
            throw new FailedException(ex);
        }
    }
}
Also used : FailedException(org.apache.storm.topology.FailedException) IllegalClassException(org.apache.storm.shade.org.apache.commons.lang.IllegalClassException) IllegalClassException(org.apache.storm.shade.org.apache.commons.lang.IllegalClassException) FailedException(org.apache.storm.topology.FailedException) TridentTuple(org.apache.storm.trident.tuple.TridentTuple)

Aggregations

IllegalClassException (org.apache.storm.shade.org.apache.commons.lang.IllegalClassException)1 FailedException (org.apache.storm.topology.FailedException)1 TridentTuple (org.apache.storm.trident.tuple.TridentTuple)1