Search in sources :

Example 1 with FrameworkReregisteredMessage

use of mesos.internal.Messages.FrameworkReregisteredMessage in project jesos by groupon.

the class LocalSchedulerMessageProcessor method frameworkReregistered.

@Subscribe
public void frameworkReregistered(final FrameworkReregisteredMessageEnvelope envelope) {
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");
    final FrameworkReregisteredMessage frameworkReregisteredMessage = envelope.getMessage();
    if (!masterIsValid(frameworkReregisteredMessage.getMasterInfo())) {
        return;
    }
    final FrameworkID frameworkId = frameworkReregisteredMessage.getFrameworkId();
    checkState(frameworkId != null, "Received null framework reregistration message!");
    checkState(frameworkId.equals(context.getFrameworkId()), "Received framework reregistration for %s but expected %s", frameworkId.getValue(), context.getFrameworkId().getValue());
    context.connected();
    context.setFailover(false);
    eventBus.post(new SchedulerCallback() {

        @Override
        public Runnable getCallback(final Scheduler scheduler, final SchedulerDriver schedulerDriver) {
            return new Runnable() {

                @Override
                public void run() {
                    scheduler.reregistered(schedulerDriver, context.getMaster());
                }
            };
        }
    });
}
Also used : Scheduler(org.apache.mesos.Scheduler) FrameworkID(org.apache.mesos.Protos.FrameworkID) FrameworkReregisteredMessage(mesos.internal.Messages.FrameworkReregisteredMessage) SchedulerDriver(org.apache.mesos.SchedulerDriver) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

Subscribe (com.google.common.eventbus.Subscribe)1 FrameworkReregisteredMessage (mesos.internal.Messages.FrameworkReregisteredMessage)1 FrameworkID (org.apache.mesos.Protos.FrameworkID)1 Scheduler (org.apache.mesos.Scheduler)1 SchedulerDriver (org.apache.mesos.SchedulerDriver)1