class RemoteAppenderStreamClient extends java.lang.Object implements RemoteAppenderClient
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
id |
private java.io.InputStream |
inputStream |
private LoggerContext |
lc |
private Logger |
logger |
private java.net.Socket |
socket |
| Constructor and Description |
|---|
RemoteAppenderStreamClient(java.lang.String id,
java.io.InputStream inputStream)
Constructs a new client.
|
RemoteAppenderStreamClient(java.lang.String id,
java.net.Socket socket)
Constructs a new client.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes any resources that are held by the client.
|
private java.io.ObjectInputStream |
createObjectInputStream() |
void |
run() |
void |
setLoggerContext(LoggerContext lc)
Sets the client's logger context.
|
java.lang.String |
toString() |
private final java.lang.String id
private final java.net.Socket socket
private final java.io.InputStream inputStream
private LoggerContext lc
private Logger logger
public RemoteAppenderStreamClient(java.lang.String id,
java.net.Socket socket)
id - a display name for the clientinputStream - input stream from which events will be readpublic RemoteAppenderStreamClient(java.lang.String id,
java.io.InputStream inputStream)
This constructor is provided primarily to support unit tests for which it is inconvenient to create a socket.
id - a display name for the clientinputStream - input stream from which events will be readpublic void setLoggerContext(LoggerContext lc)
This provides the local logging context to the client's service thread, and is used as the destination for logging events received from the client.
This method must be invoked before the Runnable.run() method.
setLoggerContext in interface RemoteAppenderClientlc - the logger context to setpublic void close()
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 IOException subclass.
Note also, that unlike Closeable.close() this method is not
permitted to propagate any IOException that occurs when closing
the underlying resource(s).
public void run()
run in interface java.lang.Runnableprivate java.io.ObjectInputStream createObjectInputStream()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object