Interface SignalReceiver

    • Method Detail

      • init

        void init​(String params)
        Initialise the signal receiver. The syntax and meaning of the parameter sent to it is implementation-dependant. When this method return the signal receiver is ready to register signal handlers and receive signals.
        Parameters:
        params - Parameters needed to initialise the receiver
      • close

        void close​(int wait)
        Close the receiver. The receiver should close and cleanup any opened resources, unregister itself if neccesary and stop listening for signals.
        Parameters:
        wait - If the value is zero or positive, the Signal.ABORT should be sent to all registered signal handlers. The signal receiver should then wait at most the specified number of milliseconds for all signal handlers to get unregistered. If the timeout expires before all signal handlers has processed the signal, the signal receiver should continue it's shutdown.
      • getSignalTransporterClass

        Class<? extends SignalTransporter> getSignalTransporterClass()
        Get the signal transporter class that should be used to send signals to this receiver.
        Returns:
        A class objects that must be a subclass of SignalTransporter
      • registerSignalHandler

        String registerSignalHandler​(SignalHandler handler)
        Register a signal handler with this receiver. The receiver should return a string, that, when used with the SignalTransporter.init(String) method lets the transporter know how to send a signal to the specific handler. The SocketSignalReceiver will for example, include the IP number and port the transporter should connect to and a unique ID that allows the receiver to locate the signal hander the signal is intended for. The format of the ID is implementation specific and need only to be understandable by the receiver and transporter implementations.
        Parameters:
        handler - The signal handler that should receive signals through this receiver
        Returns:
        A string that allows a transporter instance locate and send a signal to the given signal handler
        See Also:
        AbstractSignalReceiver
      • unregisterSignalHandler

        void unregisterSignalHandler​(SignalHandler handler)
        Unregister a signal handler from this receiever. After this method returns, the receiver must not send any more signals to the specified handler.
        Parameters:
        handler - The handler to unregister
      • sendToAll

        void sendToAll​(SignalSender sender)
        Let the signal sender send one or more signals to all registered signal handlers on this reciever.
        Parameters:
        sender - A signal sender implementation
        Since:
        2.16