1 /** 2 * Logback: the reliable, generic, fast and flexible logging framework. 3 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 4 * 5 * This program and the accompanying materials are dual-licensed under 6 * either the terms of the Eclipse Public License v1.0 as published by 7 * the Eclipse Foundation 8 * 9 * or (per the licensee's choosing) 10 * 11 * under the terms of the GNU Lesser General Public License version 2.1 12 * as published by the Free Software Foundation. 13 */ 14 package ch.qos.logback.core.net.server; 15 16 import java.io.IOException; 17 18 import ch.qos.logback.core.spi.ContextAware; 19 20 /** 21 * An object that is responsible for the asynchronous execution of a socket 22 * server. 23 * <p> 24 * This interface exists primarily to allow the runner to be mocked for the 25 * purpose of unit testing the socket server implementation. 26 * 27 * @author Carl Harris 28 */ 29 public interface ServerRunner<T extends Client> extends ContextAware, Runnable { 30 31 /** 32 * Gets a flag indicating whether the server is currently running. 33 * 34 * @return flag state 35 */ 36 boolean isRunning(); 37 38 /** 39 * Stops execution of the runner. 40 * <p> 41 * This method must cause all I/O and thread resources associated with the 42 * runner to be released. If the receiver has not been started, this method must 43 * have no effect. 44 * 45 * @throws IOException 46 */ 47 void stop() throws IOException; 48 49 /** 50 * Presents each connected client to the given visitor. 51 * 52 * @param visitor the subject visitor 53 */ 54 void accept(ClientVisitor<T> visitor); 55 56 }