V
- Type of data being extracted from the request when processedpublic abstract class AbstractChannelExitRequestHandler<V> extends AbstractChannelRequestHandler implements NamedResource
exit-XXX
" requests. Once such a request
has been successfully processed, an EventNotifier
can be invoked
indicating the processed event.RequestHandler.Result
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.atomic.AtomicReference<V> |
holder |
protected EventNotifier<? super java.lang.String> |
notifier |
log
BY_NAME_COMPARATOR, NAME_EXTRACTOR
CHANN2HNDLR
Modifier | Constructor and Description |
---|---|
protected |
AbstractChannelExitRequestHandler(java.util.concurrent.atomic.AtomicReference<V> holder,
EventNotifier<? super java.lang.String> notifier) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getEvent(Channel channel,
java.lang.String request,
V value) |
protected void |
notifyStateChanged(Channel channel,
java.lang.String request,
V value)
Notifies that some change has been made to the data in the holder.
|
RequestHandler.Result |
process(Channel channel,
java.lang.String request,
boolean wantReply,
Buffer buffer)
Process an SSH request.
|
protected abstract V |
processRequestValue(Channel channel,
java.lang.String request,
Buffer buffer)
Invoked by default from
process(Channel, String, boolean, Buffer) when
a request matching the handler's name is received |
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findByName, getName, getNameList, getNames, ofName, removeByName
protected final java.util.concurrent.atomic.AtomicReference<V> holder
protected final EventNotifier<? super java.lang.String> notifier
protected AbstractChannelExitRequestHandler(java.util.concurrent.atomic.AtomicReference<V> holder, EventNotifier<? super java.lang.String> notifier)
holder
- An AtomicReference
that will hold the extracted
request datanotifier
- An EventNotifier
to be invoked when request is
successfully processed and the holder has been updated
with the processed request datapublic RequestHandler.Result process(Channel channel, java.lang.String request, boolean wantReply, Buffer buffer) throws java.lang.Exception
RequestHandler
process
in interface ChannelRequestHandler
process
in interface RequestHandler<Channel>
channel
- The input parameterrequest
- The request stringwantReply
- Whether a reply is requestedbuffer
- The Buffer
with request specific dataRequestHandler.Result
java.lang.Exception
- If failed to handle the request - Note: in
order to signal an unsupported request the RequestHandler.Result.Unsupported
value should be returnedprotected abstract V processRequestValue(Channel channel, java.lang.String request, Buffer buffer) throws java.lang.Exception
process(Channel, String, boolean, Buffer)
when
a request matching the handler's name is receivedchannel
- The Channel
through which the request was receivedrequest
- 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 datanull
then request is ignored and
Unsupported
is returnedjava.lang.Exception
- If failed to process the received request bufferprotected void notifyStateChanged(Channel channel, java.lang.String request, V value)
getEvent(Channel, String, Object)
callchannel
- The Channel
through which the request was receivedrequest
- The processed requestvalue
- The processed valueprotected java.lang.String getEvent(Channel channel, java.lang.String request, V value)
channel
- The Channel
through which the request was receivedrequest
- The processed requestvalue
- The processed valueNamedResource.getName()
value