Java Code Examples for org.apache.nifi.nar.NarCloseable#withFrameworkNar()

The following examples show how to use org.apache.nifi.nar.NarCloseable#withFrameworkNar() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlowController.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    try (final NarCloseable narCloseable = NarCloseable.withFrameworkNar()) {
        if (heartbeatsSuspended.get()) {
            return;
        }

        final HeartbeatMessage message = createHeartbeatMessage();
        if (message == null) {
            LOG.debug("No heartbeat to send");
            return;
        }

        heartbeater.send(message);
    } catch (final UnknownServiceAddressException usae) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(usae.getMessage());
        }
    } catch (final Throwable ex) {
        LOG.warn("Failed to send heartbeat due to: " + ex);
        if (LOG.isDebugEnabled()) {
            LOG.warn("", ex);
        }
    }
}
 
Example 2
Source File: FlowController.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    try (final NarCloseable narCloseable = NarCloseable.withFrameworkNar()) {
        if (heartbeatsSuspended.get()) {
            return;
        }

        final HeartbeatMessage message = createHeartbeatMessage();
        if (message == null) {
            LOG.debug("No heartbeat to send");
            return;
        }

        heartbeater.send(message);
    } catch (final UnknownServiceAddressException usae) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(usae.getMessage());
        }
    } catch (final Throwable ex) {
        LOG.warn("Failed to send heartbeat due to: " + ex);
        if (LOG.isDebugEnabled()) {
            LOG.warn("", ex);
        }
    }
}