Source:
<code>protected void doStart() { eventLoopGroup.next().execute(() -> { bootstrap = new Bootstrap(); bootstrap.group(eventLoopGroup) .channel(NioDatagramChannel.class) .option(ChannelOption.SO_BROADCAST, true) .option(ChannelOption.SO_REUSEADDR, true) .handler(new ChannelInitializer<DatagramChannel>() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast("protobufDecoder", new UdpProtostuffDecoder<>(Availability.getSchema(), false)); p.addLast("protobufEncoder", new UdpProtostuffEncoder<>(Availability.getSchema(), false)); p.addLast("beaconMessageHandler", new BeaconMessageHandler()); } }); bootstrap.bind(discoveryPort).addListener((ChannelFutureListener) future -> { if (future.isSuccess()) { broadcastChannel = future.channel(); } else { LOG.error("Unable to bind! ", future.cause()); notifyFailed(future.cause()); } }); try { localIPs = getLocalIPs(); } catch (SocketException e) { LOG.error("SocketException:", e); notifyFailed(e); return; } fiber = fiberSupplier.getNewFiber(this::notifyFailed); fiber.start(); incomingMessages.subscribe(fiber, this::processWireMessage); nodeInfoRequests.subscribe(fiber, this::handleNodeInfoRequest); moduleServer.availableModulePortsChannel().subscribe(fiber, this::updateCurrentModulePorts); if (localIPs.isEmpty()) { LOG.warn("Found no IP addresses to broadcast to other nodes; as a result, only sending to loopback"); } <START> fiber.scheduleAtFixedRate(this::sendBeacon, 2, 10, TimeUnit.SECONDS); <END> C5Futures.addCallback(moduleServer.getAvailableModulePorts(), (ImmutableMap<ModuleType, Integer> availablePorts) -> { updateCurrentModulePorts(availablePorts); notifyStarted(); }, this::notifyFailed, fiber); }); }</code><technical_language>pull this a static var least. configurable no</technical_language>

Target:
protected void doStart() { eventLoopGroup.next().execute(() -> { bootstrap = new Bootstrap(); bootstrap.group(eventLoopGroup) .channel(NioDatagramChannel.class) .option(ChannelOption.SO_BROADCAST, true) .option(ChannelOption.SO_REUSEADDR, true) .handler(new ChannelInitializer<DatagramChannel>() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast("protobufDecoder", new UdpProtostuffDecoder<>(Availability.getSchema(), false)); p.addLast("protobufEncoder", new UdpProtostuffEncoder<>(Availability.getSchema(), false)); p.addLast("beaconMessageHandler", new BeaconMessageHandler()); } }); bootstrap.bind(discoveryPort).addListener((ChannelFutureListener) future -> { if (future.isSuccess()) { broadcastChannel = future.channel(); } else { LOG.error("Unable to bind! ", future.cause()); notifyFailed(future.cause()); } }); try { localIPs = getLocalIPs(); } catch (SocketException e) { LOG.error("SocketException:", e); notifyFailed(e); return; } fiber = fiberSupplier.getNewFiber(this::notifyFailed); fiber.start(); incomingMessages.subscribe(fiber, this::processWireMessage); nodeInfoRequests.subscribe(fiber, this::handleNodeInfoRequest); moduleServer.availableModulePortsChannel().subscribe(fiber, this::updateCurrentModulePorts); if (localIPs.isEmpty()) { LOG.warn("Found no IP addresses to broadcast to other nodes; as a result, only sending to loopback"); } fiber.scheduleAtFixedRate(this::sendBeacon, BEACON_SERVICE_INITIAL_BROADCAST_DELAY_MILLISECONDS, BEACON_SERVICE_BROADCAST_PERIOD_MILLISECONDS, TimeUnit.MILLISECONDS); C5Futures.addCallback(moduleServer.getAvailableModulePorts(), (ImmutableMap<ModuleType, Integer> availablePorts) -> { updateCurrentModulePorts(availablePorts); notifyStarted(); }, this::notifyFailed, fiber); }); }