Search in sources :

Example 1 with FollowerRunnable

use of com.alibaba.jstorm.schedule.FollowerRunnable in project jstorm by alibaba.

the class NimbusServer method initFollowerThread.

private void initFollowerThread(Map conf) {
    // when this nimbus become leader, we will execute this callback, to init some necessary data/thread
    Callback leaderCallback = new Callback() {

        public <T> Object execute(T... args) {
            try {
                init(data.getConf());
            } catch (Exception e) {
                LOG.error("Nimbus init error after becoming a leader", e);
                throw new RuntimeException(e);
            }
            return null;
        }
    };
    follower = new FollowerRunnable(data, 5000, leaderCallback);
    Thread thread = new Thread(follower);
    thread.setDaemon(true);
    thread.start();
    LOG.info("Successfully init Follower thread");
}
Also used : RunnableCallback(com.alibaba.jstorm.callback.RunnableCallback) Callback(com.alibaba.jstorm.callback.Callback) FollowerRunnable(com.alibaba.jstorm.schedule.FollowerRunnable) TTransportException(org.apache.thrift.transport.TTransportException) TException(org.apache.thrift.TException) IOException(java.io.IOException) AsyncLoopThread(com.alibaba.jstorm.callback.AsyncLoopThread)

Aggregations

AsyncLoopThread (com.alibaba.jstorm.callback.AsyncLoopThread)1 Callback (com.alibaba.jstorm.callback.Callback)1 RunnableCallback (com.alibaba.jstorm.callback.RunnableCallback)1 FollowerRunnable (com.alibaba.jstorm.schedule.FollowerRunnable)1 IOException (java.io.IOException)1 TException (org.apache.thrift.TException)1 TTransportException (org.apache.thrift.transport.TTransportException)1