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 AtomicReference<V> |
holder |
protected EventNotifier<? super String> |
notifier |
log
BY_NAME_COMPARATOR, NAME_EXTRACTOR
CHANN2HNDLR
Modifier | Constructor and Description |
---|---|
protected |
AbstractChannelExitRequestHandler(AtomicReference<V> holder,
EventNotifier<? super String> notifier) |
Modifier and Type | Method and Description |
---|---|
protected String |
getEvent(Channel channel,
String request,
V value) |
protected void |
notifyStateChanged(Channel channel,
String request,
V value)
Notifies that some change has been made to the data in the holder.
|
RequestHandler.Result |
process(Channel channel,
String request,
boolean wantReply,
Buffer buffer)
Process an SSH request.
|
protected abstract V |
processRequestValue(Channel channel,
String request,
Buffer buffer)
Invoked by default from
process(Channel, String, boolean, Buffer) when a request matching the handler's
name is received |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
findByName, findFirstMatchByName, getName, getNameList, getNames, ofName, removeByName, safeCompareByName
protected final AtomicReference<V> holder
protected final EventNotifier<? super String> notifier
protected AbstractChannelExitRequestHandler(AtomicReference<V> holder, EventNotifier<? super 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, String request, boolean wantReply, Buffer buffer) throws 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
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, String request, Buffer buffer) throws 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
returnedException
- If failed to process the received request bufferprotected void notifyStateChanged(Channel channel, String request, V value)
getEvent(Channel, String, Object)
callchannel
- The Channel
through which the request was receivedrequest
- The processed requestvalue
- The processed valueCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.