@Override public void registerGroupMessageReceiver(String messageToken, MessageReceiver receiver) { logger.fine("[GroupServiceProvider]: REGISTERED A MESSAGE LISTENER: " + receiver + "; for token: " + messageToken); gms.addActionFactory(new MessageActionFactoryImpl(receiver), messageToken); }
/** * Registers a GroupLeadershipNotification Listener. * * @param callback processes GMS notification GroupLeadershipNotificationSignal. This event occurs when the GMS masters leaves the Group * and another member of the group takes over leadership. The signal indicates the new leader. */ @Override public void registerGroupLeadershipNotificationListener(CallBack callback) { if (gms != null) { gms.addActionFactory(new GroupLeadershipNotificationActionFactoryImpl(callback)); } }
/** * Registers a FailureNotification Listener. * * @param callback processes GMS notification FailureNotificationSignal */ @Override public void registerFailureNotificationListener(CallBack callback) { if (gms != null) { FailureNotificationActionFactory fnaf = new FailureNotificationActionFactoryImpl(callback); callbackFailureActionFactoryMapping.put(callback, fnaf); gms.addActionFactory(fnaf); } }
/** * Registers a JoinNotification Listener. * * @param callback processes GMS notification JoinNotificationSignal */ @Override public void registerJoinNotificationListener(CallBack callback) { if (gms != null && callback != null) { JoinNotificationActionFactory jnaf = new JoinNotificationActionFactoryImpl(callback); gms.addActionFactory(jnaf); callbackJoinActionFactoryMapping.put(callback, jnaf); } }
/** * Registers a JoinAndReadyNotification Listener. * * @param callback processes GMS notification JoinAndReadyNotificationSignal */ @Override public void registerJoinedAndReadyNotificationListener(CallBack callback) { if (gms != null && callback != null) { JoinedAndReadyNotificationActionFactory jnaf = new JoinedAndReadyNotificationActionFactoryImpl(callback); gms.addActionFactory(jnaf); callbackJoinedAndReadyActionFactoryMapping.put(callback, jnaf); } }
/** * Registers a PlannedShutdown Listener. * * @param callback processes GMS notification PlannedShutdownSignal */ @Override public void registerPlannedShutdownListener(CallBack callback) { if (gms != null && callback != null) { PlannedShutdownActionFactory psaf = new PlannedShutdownActionFactoryImpl(callback); callbackPlannedShutdownActionFactoryMapping.put(callback, psaf); gms.addActionFactory(psaf); } }
/** * Registers a FailureSuspected Listener. * * @param callback processes GMS notification FailureSuspectedSignal */ @Override public void registerFailureSuspectedListener(CallBack callback) { if (gms != null) { FailureSuspectedActionFactory fsaf = new FailureSuspectedActionFactoryImpl(callback); callbackFailureSuspectedActionFactoryMapping.put(callback, fsaf); gms.addActionFactory(fsaf); } }
/** * Registers a FailureRecovery Listener. * * @param callback processes GMS notification FailureRecoverySignal * @param componentName The name of the parent application's component that should be notified of selected for * performing recovery operations. One or more components in the parent application may * want to be notified of such selection for their respective recovery operations. */ @Override public void registerFailureRecoveryListener(String componentName, CallBack callback) { if (gms != null) { gms.addActionFactory(componentName, new FailureRecoveryActionFactoryImpl(callback)); } }
/** * Registers a Message Listener. * * @param componentName Name of the component that would like to consume * Messages. One or more components in the parent application would want to * be notified when messages arrive addressed to them. This registration * allows GMS to deliver messages to specific components. * @param messageListener processes GMS MessageSignal */ @Override public void registerMessageListener(String componentName, CallBack messageListener) { if (gms != null) { gms.addActionFactory(new MessageActionFactoryImpl(messageListener), componentName); } }
try { gms.join(); gms.addActionFactory(new MessageActionFactory() {
this.groupName = groupName; gms.addActionFactory(new JoinNotificationActionFactoryImpl(this)); gms.addActionFactory(new JoinedAndReadyNotificationActionFactoryImpl(this)); gms.addActionFactory(new FailureNotificationActionFactoryImpl(this)); gms.addActionFactory(new PlannedShutdownActionFactoryImpl(this));