Top Description Fields Constructors Methods
ch.qos.logback.classic.net.server

pack-priv Class RemoteAppenderStreamClient

extends Object
implements RemoteAppenderClient
Class Inheritance
All Implemented Interfaces
ch.qos.logback.classic.net.server.RemoteAppenderClient, ch.qos.logback.core.net.server.Client, java.io.Closeable, java.lang.AutoCloseable, java.lang.Runnable
Imports
java.io.EOFException, .IOException, .InputStream, java.net.Socket, ch.qos.logback.classic.Logger, .LoggerContext, ch.qos.logback.classic.spi.ILoggingEvent, ch.qos.logback.core.net.HardenedObjectInputStream, ch.qos.logback.core.util.CloseUtil

A RemoteAppenderClient that reads serialized ILoggingEvent objects from an InputStream.
Author
Carl Harris

Field Summary

Modifier and TypeField and Description
private final String
private final InputStream
private LoggerContext
private Logger
private final Socket

Constructor Summary

AccessConstructor and Description
public
RemoteAppenderStreamClient(String
a display name for the client
id
,
Socket
input stream from which events will be read
socket
)

Constructs a new client.

public
RemoteAppenderStreamClient(String
a display name for the client
id
,
InputStream
input stream from which events will be read
inputStream
)

Constructs a new client.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements ch.qos.logback.core.net.server.Client.close.

Closes any resources that are held by the client.
private HardenedObjectInputStream
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
public void
setLoggerContext(LoggerContext
the logger context to set
lc
)

Implements ch.qos.logback.classic.net.server.RemoteAppenderClient.setLoggerContext.

Sets the client's logger context.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

idback to summary
private final String id
inputStreamback to summary
private final InputStream inputStream
lcback to summary
private LoggerContext lc
loggerback to summary
private Logger logger
socketback to summary
private final Socket socket

Constructor Detail

RemoteAppenderStreamClientback to summary
public RemoteAppenderStreamClient(String id, Socket socket)

Constructs a new client.

Parameters
id:String

a display name for the client

socket:Socket

input stream from which events will be read

RemoteAppenderStreamClientback to summary
public RemoteAppenderStreamClient(String id, InputStream inputStream)

Constructs a new client.

This constructor is provided primarily to support unit tests for which it is inconvenient to create a socket.

Parameters
id:String

a display name for the client

inputStream:InputStream

input stream from which events will be read

Method Detail

closeback to summary
public void close()

Implements ch.qos.logback.core.net.server.Client.close.

Doc from ch.qos.logback.core.net.server.Client.close.

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 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).

createObjectInputStreamback to summary
private HardenedObjectInputStream createObjectInputStream() throws IOException
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

setLoggerContextback to summary
public void setLoggerContext(LoggerContext lc)

Implements ch.qos.logback.classic.net.server.RemoteAppenderClient.setLoggerContext.

Doc from ch.qos.logback.classic.net.server.RemoteAppenderClient.setLoggerContext.

Sets the client's logger context.

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 run() method.

Parameters
lc:LoggerContext

the logger context to set

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override