@Override public void lifecycleEvent(LifecycleEvent event) { if (Lifecycle.PERIODIC_EVENT.equals(event.getType())) { if (sender == null) { if (proxyList == null) sender = new MultiCastSender(); else sender = new TcpSender(); } /* Read busy and ready */ if (coll == null) { try { coll = new CollectedInfo(host, port); this.port = coll.getPort(); this.host = coll.getHost(); } catch (Exception ex) { log.error("Unable to initialize info collection: " + ex); coll = null; return; } } /* Start or restart sender */ try { sender.init(this); } catch (Exception ex) { log.error("Unable to initialize Sender: " + ex); sender = null; return; } /* refresh the connector information and send it */ try { coll.refresh(); } catch (Exception ex) { log.error("Unable to collect load information: " + ex); coll = null; return; } String output = "v=1&ready=" + coll.getReady() + "&busy=" + coll.getBusy() + "&port=" + port; try { sender.send(output); } catch (Exception ex) { log.error("Unable to send colllected load information: " + ex); } } }