Search in sources :

Example 1 with ITaskHookDelegate

use of org.apache.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(org.apache.storm.hooks.ITaskHook) ITaskHookDelegate(org.apache.storm.hooks.ITaskHookDelegate)

Aggregations

ITaskHook (org.apache.storm.hooks.ITaskHook)1 ITaskHookDelegate (org.apache.storm.hooks.ITaskHookDelegate)1