@Test public void shutsDownOnInterruptWhileWaitingForEvent() throws Exception { mockOneSuccessfulSocketConnection(); doThrow(new InterruptedException()).when(deque).takeFirst(); appender.start(); verify(deque, timeout(TIMEOUT)).takeFirst(); }
public void start() { if (isStarted()) return; int errorCount = 0; if (port <= 0) { errorCount++; addError("No port was configured for appender" + name + " For more information, please visit http: } if (remoteHost == null) { errorCount++; addError("No remote host was configured for appender" + name + " For more information, please visit http: } if (queueSize == 0) { addWarn("Queue size of zero is deprecated, use a size of one to indicate synchronous processing"); } if (queueSize < 0) { errorCount++; addError("Queue size must be greater than zero"); } if (errorCount == 0) { try { address = InetAddress.getByName(remoteHost); } catch (UnknownHostException ex) { addError("unknown host: " + remoteHost); errorCount++; } } if (errorCount == 0) { deque = queueFactory.newLinkedBlockingDeque(queueSize); peerId = "remote peer " + remoteHost + ":" + port + ": "; connector = createConnector(address, port, 0, reconnectionDelay.getMilliseconds()); task = getContext().getScheduledExecutorService().submit(new Runnable() { public void run() { connectSocketAndDispatchEvents(); } }); super.start(); } }
AbstractSocketAppender extends AppenderBase<E> implements SocketConnector.ExceptionHandler { public void start() { if (isStarted()) return; int errorCount = 0; if (port <= 0) { errorCount++; addError("No port was configured for appender" + name + " For more information, please visit http: } if (remoteHost == null) { errorCount++; addError("No remote host was configured for appender" + name + " For more information, please visit http: } if (queueSize == 0) { addWarn("Queue size of zero is deprecated, use a size of one to indicate synchronous processing"); } if (queueSize < 0) { errorCount++; addError("Queue size must be greater than zero"); } if (errorCount == 0) { try { address = InetAddress.getByName(remoteHost); } catch (UnknownHostException ex) { addError("unknown host: " + remoteHost); errorCount++; } } if (errorCount == 0) { deque = queueFactory.newLinkedBlockingDeque(queueSize); peerId = "remote peer " + remoteHost + ":" + port + ": "; connector = createConnector(address, port, 0, reconnectionDelay.getMilliseconds()); task = getContext().getScheduledExecutorService().submit(new Runnable() { public void run() { connectSocketAndDispatchEvents(); } }); super.start(); } } }
AbstractSocketAppender extends AppenderBase<E> implements SocketConnector.ExceptionHandler { public void start() { if (isStarted()) return; int errorCount = 0; if (port <= 0) { errorCount++; addError("No port was configured for appender" + name + " For more information, please visit http: } if (remoteHost == null) { errorCount++; addError("No remote host was configured for appender" + name + " For more information, please visit http: } if (queueSize == 0) { addWarn("Queue size of zero is deprecated, use a size of one to indicate synchronous processing"); } if (queueSize < 0) { errorCount++; addError("Queue size must be greater than zero"); } if (errorCount == 0) { try { address = InetAddress.getByName(remoteHost); } catch (UnknownHostException ex) { addError("unknown host: " + remoteHost); errorCount++; } } if (errorCount == 0) { deque = queueFactory.newLinkedBlockingDeque(queueSize); peerId = "remote peer " + remoteHost + ":" + port + ": "; connector = createConnector(address, port, 0, reconnectionDelay.getMilliseconds()); task = getContext().getScheduledExecutorService().submit(new Runnable() { public void run() { connectSocketAndDispatchEvents(); } }); super.start(); } } protected  AbstractSocketAppender();   AbstractSocketAppender(QueueFactory queueFactory, ObjectWriterFactory objectWriterFactory); }
AbstractSocketAppender extends AppenderBase<E> implements SocketConnector.ExceptionHandler { public void start() { if (isStarted()) return; int errorCount = 0; if (port <= 0) { errorCount++; addError("No port was configured for appender" + name + " For more information, please visit http: } if (remoteHost == null) { errorCount++; addError("No remote host was configured for appender" + name + " For more information, please visit http: } if (queueSize == 0) { addWarn("Queue size of zero is deprecated, use a size of one to indicate synchronous processing"); } if (queueSize < 0) { errorCount++; addError("Queue size must be greater than zero"); } if (errorCount == 0) { try { address = InetAddress.getByName(remoteHost); } catch (UnknownHostException ex) { addError("unknown host: " + remoteHost); errorCount++; } } if (errorCount == 0) { deque = queueFactory.newLinkedBlockingDeque(queueSize); peerId = "remote peer " + remoteHost + ":" + port + ": "; connector = createConnector(address, port, 0, reconnectionDelay.getMilliseconds()); task = getContext().getScheduledExecutorService().submit(new Runnable() { public void run() { connectSocketAndDispatchEvents(); } }); super.start(); } } protected  AbstractSocketAppender();   AbstractSocketAppender(QueueFactory queueFactory, ObjectWriterFactory objectWriterFactory); void start(); @Override void stop(); void connectionFailed(SocketConnector connector, Exception ex); void setRemoteHost(String host); String getRemoteHost(); void setPort(int port); int getPort(); void setReconnectionDelay(Duration delay); Duration getReconnectionDelay(); void setQueueSize(int queueSize); int getQueueSize(); void setEventDelayLimit(Duration eventDelayLimit); Duration getEventDelayLimit(); }
AbstractSocketAppender extends AppenderBase<E> implements SocketConnector.ExceptionHandler { public void start() { if (isStarted()) return; int errorCount = 0; if (port <= 0) { errorCount++; addError("No port was configured for appender" + name + " For more information, please visit http: } if (remoteHost == null) { errorCount++; addError("No remote host was configured for appender" + name + " For more information, please visit http: } if (queueSize == 0) { addWarn("Queue size of zero is deprecated, use a size of one to indicate synchronous processing"); } if (queueSize < 0) { errorCount++; addError("Queue size must be greater than zero"); } if (errorCount == 0) { try { address = InetAddress.getByName(remoteHost); } catch (UnknownHostException ex) { addError("unknown host: " + remoteHost); errorCount++; } } if (errorCount == 0) { deque = queueFactory.newLinkedBlockingDeque(queueSize); peerId = "remote peer " + remoteHost + ":" + port + ": "; connector = createConnector(address, port, 0, reconnectionDelay.getMilliseconds()); task = getContext().getScheduledExecutorService().submit(new Runnable() { public void run() { connectSocketAndDispatchEvents(); } }); super.start(); } } protected  AbstractSocketAppender();   AbstractSocketAppender(QueueFactory queueFactory, ObjectWriterFactory objectWriterFactory); void start(); @Override void stop(); void connectionFailed(SocketConnector connector, Exception ex); void setRemoteHost(String host); String getRemoteHost(); void setPort(int port); int getPort(); void setReconnectionDelay(Duration delay); Duration getReconnectionDelay(); void setQueueSize(int queueSize); int getQueueSize(); void setEventDelayLimit(Duration eventDelayLimit); Duration getEventDelayLimit(); static final int DEFAULT_PORT; static final int DEFAULT_RECONNECTION_DELAY; static final int DEFAULT_QUEUE_SIZE; }