Package org.hcjf.io.net.broadcast
Class BroadcastService
- java.lang.Object
-
- org.hcjf.service.Service<BroadcastConsumer>
-
- org.hcjf.io.net.broadcast.BroadcastService
-
public class BroadcastService extends Service<BroadcastConsumer>
This service provides capabilities to register broadcast task in order to notify for all the net this task.- Author:
- javaito
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBroadcastService.PingMessageMessage that is sending in order to publish the instance for all the netstatic classBroadcastService.PongMessageMessage that is sending as response for the Ping Message.static classBroadcastService.ShutdownMessageMessage that is sending to notify for all the net that the instance is shutting down-
Nested classes/interfaces inherited from class org.hcjf.service.Service
Service.RunnableWrapperComparator, Service.ShutdownStage, Service.StaticServiceThread, Service.ThreadPoolAgent, Service.ThreadPoolAgentMBean
-
-
Field Summary
-
Fields inherited from class org.hcjf.service.Service
SERVICE_LOG_TAG
-
-
Method Summary
Modifier and Type Method Description static BroadcastServicegetInstance()Returns the singleton instance of the service.protected voidinit()This method initialize all the necessary components of the service.booleanisShuttingDown()Verify if the service is in the shutting down process.voidregisterConsumer(BroadcastConsumer consumer)Register a consumer into the the service.protected voidshutdown(Service.ShutdownStage stage)This method will be called for the global shutdown process in each stage.voidunregisterConsumer(BroadcastConsumer consumer)Unregister a consumer of the service.-
Methods inherited from class org.hcjf.service.Service
call, call, fork, fork, fork, fork, getPriority, getServiceName, run, run, shutdownExecutor, systemShutdown
-
-
-
-
Method Detail
-
getInstance
public static BroadcastService getInstance()
Returns the singleton instance of the service.- Returns:
- Service instance.
-
init
protected void init()
This method initialize all the necessary components of the service.- Overrides:
initin classService<BroadcastConsumer>
-
isShuttingDown
public boolean isShuttingDown()
Verify if the service is in the shutting down process.- Returns:
- True if the service in the shutting down process or not in the otherwise.
-
shutdown
protected void shutdown(Service.ShutdownStage stage)
Description copied from class:ServiceThis method will be called for the global shutdown process in each stage.- Overrides:
shutdownin classService<BroadcastConsumer>- Parameters:
stage- Shutdown stage.
-
registerConsumer
public void registerConsumer(BroadcastConsumer consumer)
Register a consumer into the the service.- Specified by:
registerConsumerin classService<BroadcastConsumer>- Parameters:
consumer- Object with the logic to consume the service.
-
unregisterConsumer
public void unregisterConsumer(BroadcastConsumer consumer)
Unregister a consumer of the service.- Specified by:
unregisterConsumerin classService<BroadcastConsumer>- Parameters:
consumer- Consumer to unregister.
-
-