Class DefaultBroadcastService

  • All Implemented Interfaces:
    BroadcastService

    public class DefaultBroadcastService
    extends java.lang.Object
    implements BroadcastService
    The default broadcast service implementation of hybris platform.

    Its purpose is to send messages to a hybris cluster using all configured methods.

    • Field Detail

      • CUR_VERSION

        public static final int CUR_VERSION
        stores the current platform version encoded as integer currently: 4.1.1.0
        See Also:
        Constant Field Values
    • Method Detail

      • getStartupInfo

        protected java.lang.String getStartupInfo()
      • updateNodeIDsFromDatabase

        protected void updateNodeIDsFromDatabase()
        Should be called after system initialization since node IDs may have changed!
      • createMessageSendingExecutorService

        protected java.util.concurrent.ExecutorService createMessageSendingExecutorService()
      • getMessageSendingExecutorService

        protected java.util.concurrent.ExecutorService getMessageSendingExecutorService()
      • initMethods

        public void initMethods()
      • startPingHandler

        protected void startPingHandler()
      • getClusterIslandPK

        public long getClusterIslandPK()
      • getClusterNodeID

        public int getClusterNodeID()
      • isClusteringEnabled

        public boolean isClusteringEnabled()
      • addTransportData

        public void addTransportData​(RawMessage message)
      • sendSynchronously

        protected void sendSynchronously​(DefaultBroadcastService.MethodWrapper methodWrapper,
                                         RawMessage message)
        Sends a message synchronously.
        Parameters:
        methodWrapper - the method wrapper
        message - the message to send
      • sendAsnychronously

        protected void sendAsnychronously​(DefaultBroadcastService.MethodWrapper methodWrapper,
                                          RawMessage message,
                                          Tenant currentTenant,
                                          java.util.concurrent.ExecutorService executorService)
                                   throws java.util.concurrent.RejectedExecutionException
        Sends a message using a executor service. In case the service is rejecting the message this method blocks and tries to send the message again until the configured wait timeout has been reached.
        Parameters:
        methodWrapper - the method wrapper
        message - the message
        currentTenant - the current tenant to be used when sending
        executorService - the executor service
        Throws:
        java.util.concurrent.RejectedExecutionException
      • accept

        public boolean accept​(RawMessage message)
        Determines whether or not a specific message is being accepted.

        Currently only message from other cluster nodes (determined by their dynamic node ID) and the same cluster island PK are accepted.

        Specified by:
        accept in interface BroadcastService
        Parameters:
        message - the message to check
        Returns:
        true if the message is being accepted
      • isDuplicateMessage

        protected boolean isDuplicateMessage​(RawMessage message)
      • isLocal

        protected boolean isLocal​(RawMessage message)
      • processMessageFromMethod

        protected void processMessageFromMethod​(RawMessage message,
                                                java.lang.String methodName)
      • destroy

        public void destroy()