org.apache.log4j.net
class: SocketAppender.Connector [javadoc |
source]
java.lang.Object
java.lang.Thread
org.apache.log4j.net.SocketAppender$Connector
All Implemented Interfaces:
Runnable
The Connector will reconnect when the server becomes available
again. It does this by attempting to open a new connection every
reconnectionDelay milliseconds.
It stops trying whenever a connection is established. It will
restart to try reconnect to the server when previpously open
connection is droppped.
- author:
Ceki - Gülcü
- since:
0.8.4 -
| Field Summary |
|---|
| boolean | interrupted | |
| Method from org.apache.log4j.net.SocketAppender$Connector Summary: |
|---|
|
run |
| Methods from java.lang.Thread: |
|---|
|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Method from org.apache.log4j.net.SocketAppender$Connector Detail: |
public void run() {
Socket socket;
while(!interrupted) {
try {
sleep(reconnectionDelay);
LogLog.debug("Attempting connection to "+address.getHostName());
socket = new Socket(address, port);
synchronized(this) {
oos = new ObjectOutputStream(socket.getOutputStream());
connector = null;
LogLog.debug("Connection established. Exiting connector thread.");
break;
}
} catch(InterruptedException e) {
LogLog.debug("Connector interrupted. Leaving loop.");
return;
} catch(java.net.ConnectException e) {
LogLog.debug("Remote host "+address.getHostName()
+" refused connection.");
} catch(IOException e) {
LogLog.debug("Could not connect to " + address.getHostName()+
". Exception is " + e);
}
}
//LogLog.debug("Exiting Connector.run() method.");
}
|