public class SocketHubReceiver extends Receiver implements SocketNodeEventListener, PortBased
Once the event has been "posted", it will be handled by the appenders currently configured in the LoggerRespository.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active
Active.
|
protected org.apache.log4j.receivers.net.SocketHubReceiver.Connector |
connector
Connector.
|
protected String |
host
Host.
|
protected int |
port
Port.
|
protected int |
reconnectionDelay
Reconnection delay.
|
protected SocketNode13 |
socketNode
Socket.
|
static String |
ZONE
The MulticastDNS zone advertised by a SocketHubReceiver
|
thresholdLevelnamerepository| Constructor and Description |
|---|
SocketHubReceiver()
Create new instance.
|
SocketHubReceiver(String h,
int p)
Create new instance.
|
SocketHubReceiver(String h,
int p,
org.apache.log4j.spi.LoggerRepository repo)
Create new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activateOptions()
Starts the SocketReceiver with the current options.
|
void |
addSocketNodeEventListener(SocketNodeEventListener l)
Adds a SocketNodeEventListener to this receiver to be notified
of SocketNode events.
|
String |
getHost()
Get the remote host to connect to for logging events.
|
int |
getPort()
Get the remote port to connect to for logging events.
|
int |
getReconnectionDelay()
Returns value of the ReconnectionDelay option.
|
boolean |
isAdvertiseViaMulticastDNS() |
boolean |
isEquivalent(Plugin testPlugin)
Returns true if the receiver is the same class and they are
configured for the same properties, and super class also considers
them to be equivalent.
|
void |
removeSocketNodeEventListener(SocketNodeEventListener l)
Removes a specific SocketNodeEventListener from this instance
so that it will no longer be notified of SocketNode events.
|
protected void |
setActive(boolean b)
Sets the flag to indicate if receiver is active or not.
|
void |
setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS) |
void |
setHost(String remoteHost)
Configures the Host property, this will require activateOptions
to be called for this to take effect.
|
void |
setPort(int p)
Set the remote port to connect to for logging events.
|
void |
setPort(String remoteHost)
Set the remote host to connect to for logging events.
|
void |
setReconnectionDelay(int delay)
The ReconnectionDelay option takes a positive integer
representing the number of milliseconds to wait between each
failed connection attempt to the server.
|
void |
shutdown()
Called when the receiver should be stopped.
|
void |
socketClosedEvent(Exception e)
Listen for a socketClosedEvent from the SocketNode.
|
void |
socketOpened(String remoteInfo)
This method does nothing.
|
doPost, getThreshold, isAsSevereAsThreshold, setThresholdaddPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getLoggerRepository, getName, isActive, removePropertyChangeListener, removePropertyChangeListener, setLoggerRepository, setNamegetLogger, getNonFloodingLogger, resetErrorCountclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetName, isActiveprotected String host
protected int port
protected int reconnectionDelay
public static final String ZONE
protected boolean active
protected org.apache.log4j.receivers.net.SocketHubReceiver.Connector connector
protected SocketNode13 socketNode
public SocketHubReceiver()
public SocketHubReceiver(String h, int p)
h - hostp - portpublic SocketHubReceiver(String h, int p, org.apache.log4j.spi.LoggerRepository repo)
h - hostp - portrepo - logger repositorypublic void addSocketNodeEventListener(SocketNodeEventListener l)
l - listenerpublic void removeSocketNodeEventListener(SocketNodeEventListener l)
l - listenerpublic String getHost()
public void setHost(String remoteHost)
remoteHost - address of remote host.public void setPort(String remoteHost)
remoteHost - address of remote host.public int getPort()
public void setPort(int p)
p - portpublic void setReconnectionDelay(int delay)
Setting this option to zero turns off reconnection capability.
delay - milliseconds to wait or zero to not reconnect.public int getReconnectionDelay()
public boolean isEquivalent(Plugin testPlugin)
isEquivalent in interface PluginisEquivalent in class PluginSkeletontestPlugin - The plugin to test equivalency against.protected void setActive(boolean b)
b - new valuepublic void activateOptions()
activateOptions in interface org.apache.log4j.spi.OptionHandlerpublic void shutdown()
public void socketClosedEvent(Exception e)
socketClosedEvent in interface SocketNodeEventListenere - exception not used.public void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS)
public boolean isAdvertiseViaMulticastDNS()
public void socketOpened(String remoteInfo)
socketOpened in interface SocketNodeEventListenerremoteInfo - remote info.Copyright © 2013 The Apache Software Foundation. Licensed under the Apache License, Version 2.0
Apache Extras for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.