Search in sources :

Example 1 with ITaskHookDelegate

use of backtype.storm.hooks.ITaskHookDelegate in project heron by twitter.

the class TopologyContext method addTaskHook.

/*
    public void setExecutorData(String name, Object data) {
        _executorData.put(name, data);
    }

    public Object getExecutorData(String name) {
        return _executorData.get(name);
    }
  */
public void addTaskHook(ITaskHook newHook) {
    Collection<com.twitter.heron.api.hooks.ITaskHook> hooks = delegate.getHooks();
    if (hooks == null) {
        ITaskHookDelegate delegateHook = new ITaskHookDelegate();
        delegateHook.addHook(newHook);
        delegate.addTaskHook(delegateHook);
    } else {
        for (com.twitter.heron.api.hooks.ITaskHook hook : hooks) {
            if (hook instanceof ITaskHookDelegate) {
                ITaskHookDelegate delegateHook = (ITaskHookDelegate) hook;
                delegateHook.addHook(newHook);
                return;
            }
        }
        throw new RuntimeException("StormCompat taskHooks not setup properly");
    }
}
Also used : ITaskHook(backtype.storm.hooks.ITaskHook) ITaskHookDelegate(backtype.storm.hooks.ITaskHookDelegate)

Aggregations

ITaskHook (backtype.storm.hooks.ITaskHook)1 ITaskHookDelegate (backtype.storm.hooks.ITaskHookDelegate)1