use of org.apache.nifi.annotation.lifecycle.OnStopped in project nifi by apache.
the class MergeRecord method resetState.
@OnStopped
public final void resetState() {
final RecordBinManager manager = binManager.get();
if (manager != null) {
manager.purge();
}
binManager.set(null);
}
use of org.apache.nifi.annotation.lifecycle.OnStopped in project nifi by apache.
the class PostHTTP method onStopped.
@OnStopped
public void onStopped() {
this.acceptsRef.set(null);
for (final Map.Entry<String, Config> entry : configMap.entrySet()) {
final Config config = entry.getValue();
config.getConnectionManager().shutdown();
}
configMap.clear();
final StreamThrottler throttler = throttlerRef.getAndSet(null);
if (throttler != null) {
try {
throttler.close();
} catch (IOException e) {
getLogger().error("Failed to close StreamThrottler", e);
}
}
}
use of org.apache.nifi.annotation.lifecycle.OnStopped in project nifi by apache.
the class ConsumeMQTT method onStopped.
@OnStopped
public void onStopped(final ProcessContext context) throws IOException {
if (mqttQueue != null && !mqttQueue.isEmpty() && processSessionFactory != null) {
logger.info("Finishing processing leftover messages");
ProcessSession session = processSessionFactory.createSession();
transferQueue(session);
} else {
if (mqttQueue != null && !mqttQueue.isEmpty()) {
throw new ProcessException("Stopping the processor but there is no ProcessSessionFactory stored and there are messages in the MQTT internal queue. Removing the processor now will " + "clear the queue but will result in DATA LOSS. This is normally due to starting the processor, receiving messages and stopping before the onTrigger happens. The messages " + "in the MQTT internal queue cannot finish processing until until the processor is triggered to run.");
}
}
}
use of org.apache.nifi.annotation.lifecycle.OnStopped in project nifi by apache.
the class PutSyslog method onStopped.
@OnStopped
public void onStopped() {
if (senderPool != null) {
ChannelSender sender = senderPool.poll();
while (sender != null) {
sender.close();
sender = senderPool.poll();
}
}
}
use of org.apache.nifi.annotation.lifecycle.OnStopped in project nifi by apache.
the class ConsumeWindowsEventLog method stop.
/**
* Cleanup
*/
@OnStopped
public void stop() {
if (isSubscribed()) {
wEvtApi.EvtClose(subscriptionHandle);
}
subscriptionHandle = null;
evtSubscribeCallback = null;
if (!renderedXMLs.isEmpty()) {
if (sessionFactory != null) {
getLogger().info("Finishing processing leftover events");
ProcessSession session = sessionFactory.createSession();
processQueue(session);
} else {
throw new ProcessException("Stopping the processor but there is no ProcessSessionFactory stored and there are messages in the internal queue. Removing the processor now will " + "clear the queue but will result in DATA LOSS. This is normally due to starting the processor, receiving events and stopping before the onTrigger happens. The messages " + "in the internal queue cannot finish processing until until the processor is triggered to run.");
}
}
sessionFactory = null;
provenanceUri = null;
renderedXMLs = null;
}
Aggregations