Class AbstractChannelExitRequestHandler<V>

    • Constructor Detail

      • AbstractChannelExitRequestHandler

        protected AbstractChannelExitRequestHandler​(AtomicReference<V> holder,
                                                    EventNotifier<? super String> notifier)
        Parameters:
        holder - An AtomicReference that will hold the extracted request data
        notifier - An EventNotifier to be invoked when request is successfully processed and the holder has been updated with the processed request data
    • Method Detail

      • processRequestValue

        protected abstract V processRequestValue​(Channel channel,
                                                 String request,
                                                 Buffer buffer)
                                          throws Exception
        Invoked by default from process(Channel, String, boolean, Buffer) when a request matching the handler's name is received
        Parameters:
        channel - The Channel through which the request was received
        request - The received request - Note: guaranteed to match the handler's name if invoked from process(Channel, String, boolean, Buffer)
        buffer - The received Buffer for extracting the data
        Returns:
        The extracted data - if null then request is ignored and Unsupported is returned
        Throws:
        Exception - If failed to process the received request buffer
      • notifyStateChanged

        protected void notifyStateChanged​(Channel channel,
                                          String request,
                                          V value)
        Notifies that some change has been made to the data in the holder. The reported event is obtained via the getEvent(Channel, String, Object) call
        Parameters:
        channel - The Channel through which the request was received
        request - The processed request
        value - The processed value
      • getEvent

        protected String getEvent​(Channel channel,
                                  String request,
                                  V value)
        Parameters:
        channel - The Channel through which the request was received
        request - The processed request
        value - The processed value
        Returns:
        The event name to be used - default: NamedResource.getName() value