org.apache.juli.logging.ch.qos.logback.core.net.server.Client Maven / Gradle / Ivy
Show all versions of tomcat85-slf4j-logback Show documentation
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2015, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package org.apache.juli.logging.ch.qos.logback.core.net.server;
import java.io.Closeable;
import java.io.IOException;
/**
* A client of a {@link ServerRunner}.
*
* This interface exists primarily to abstract away the details of the client's
* underlying {@code Socket} and the concurrency associated with handling
* multiple clients. Such realities make it difficult to create effective unit
* tests for the {@link ServerRunner} that are easy to understand and maintain.
*
* This interface captures the only those details about a client that the
* {@code ServerRunner} cares about; namely, that it is something that
*
* - is Runnable — i.e. it can be executed concurrently
* - holds resources that need to be closed before the client is
* discarded
*
*
* @author Carl Harris
*/
public interface Client extends Runnable, Closeable {
/**
* Closes any resources that are held by the client.
*
* Note that (as described in Doug Lea's discussion about interrupting I/O
* operations in "Concurrent Programming in Java" - Addison-Wesley Professional,
* 2nd edition, 1999) this method is used to interrupt any blocked I/O operation
* in the client when the server is shutting down. The client implementation
* must anticipate this potential, and gracefully exit when the blocked I/O
* operation throws the relevant {@link IOException} subclass.
*
* Note also, that unlike {@link Closeable#close()} this method is not permitted
* to propagate any {@link IOException} that occurs when closing the underlying
* resource(s).
*/
void close();
}