public class NonBlockingNagiosPassiveCheckSender extends Object implements PassiveCheckSender
NagiosPassiveCheckSender
.
Instead it internally queues the passive check in an unbounded queue and has
a single worker thread sending from the queue.
Any exceptions resulting from sending the passive check are output to standard error with a stack trace.
This sender is useful where you don't want to wait for the passive check to be sent and don't care if the sending fails
Modifier and Type | Class and Description |
---|---|
static interface |
NonBlockingNagiosPassiveCheckSender.ExceptionHandler
Exception handler to handle exceptions while sending passive checks with the
NonBlockingNagiosPassiveCheckSender . |
Constructor and Description |
---|
NonBlockingNagiosPassiveCheckSender(NagiosSettings settings)
Construct a new
NonBlockingNagiosPassiveCheckSender with the
provided NagiosSettings |
NonBlockingNagiosPassiveCheckSender(NagiosSettings settings,
NonBlockingNagiosPassiveCheckSender.ExceptionHandler handler)
Construct a new
NonBlockingNagiosPassiveCheckSender with the
provided NagiosSettings and NonBlockingNagiosPassiveCheckSender.ExceptionHandler |
Modifier and Type | Method and Description |
---|---|
void |
send(MessagePayload payload)
Send Passive Check
|
void |
setExecutor(ExecutorService executor)
Sets the backing executor to use if you do not want to use the default
executor which is a single thread executor.
|
void |
shutdown()
Shutdown the backing executor.
|
public NonBlockingNagiosPassiveCheckSender(NagiosSettings settings)
NonBlockingNagiosPassiveCheckSender
with the
provided NagiosSettings
settings
- the NagiosSettings
to use to send the Passive Checkpublic NonBlockingNagiosPassiveCheckSender(NagiosSettings settings, NonBlockingNagiosPassiveCheckSender.ExceptionHandler handler)
NonBlockingNagiosPassiveCheckSender
with the
provided NagiosSettings
and NonBlockingNagiosPassiveCheckSender.ExceptionHandler
settings
- the NagiosSettings
to use to send the Passive Checkhandler
- the NonBlockingNagiosPassiveCheckSender.ExceptionHandler
to use while sending the Passive Checkpublic void send(MessagePayload payload) throws NagiosException, IOException
PassiveCheckSender
send
in interface PassiveCheckSender
payload
- the Passive Check message payloadNagiosException
- thrown if an error occurs while sending the passive checkIOException
- thrown if I/O error occurs while trying to establish
connection with nagios hostpublic void setExecutor(ExecutorService executor)
You may want to use a custom executor in environments where you want to be in control of the used thread pools.
executor
- the custom executor to usepublic void shutdown()
To be used when your application has been shutdown and you want to cleanup all resources such as if you run in a hot deployment environment.
Copyright © Nov 2008–2016 JSend NSCA. All rights reserved.