@Override public boolean stop(final long timeout, final TimeUnit timeUnit) { setStopping(); super.stop(timeout, timeUnit, false); final Layout<? extends Serializable> layout = getLayout(); if (layout != null) { final byte[] bytes = layout.getFooter(); if (bytes != null) { write(bytes); } } setStopped(); return true; }
protected void writeFooter(final Layout<?> layout, final OutputStream out) throws IOException { final byte[] footer = layout.getFooter(); if (footer != null) { out.write(footer); } }
/** * Writes the footer. */ protected void writeFooter() { if (layout == null || skipFooter) { return; } final byte[] footer = layout.getFooter(); if (footer != null) { write(footer); } }
@Override public DatagramSocketManager createManager(final String name, final FactoryData data) { InetAddress inetAddress; try { inetAddress = InetAddress.getByName(data.host); } catch (final UnknownHostException ex) { LOGGER.error("Could not find address of " + data.host, ex); return null; } final OutputStream os = new DatagramOutputStream(data.host, data.port, data.layout.getHeader(), data.layout.getFooter()); return new DatagramSocketManager(name, os, inetAddress, data.host, data.port, data.layout, data.bufferSize); } }