|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.pogamut.base.utils.logging.NetworkLogManager
public class NetworkLogManager
A class used for network logging of agents.
It is a singleton which accepts logs from agents of one JVM and publishes them on certain port, where clients may accept them.
Field Summary | |
---|---|
static long |
NETWORK_FLUSH_PERIOD_MILLIS
How often the logs are flushed to the socket (value < 100 results in unacceptable throughput). |
static long |
NETWORK_LOG_MANAGER_SOCKET_TIMEOUT_MILLIS
How long do we wait for the agent-id before we drop the connection. |
protected cz.cuni.amis.pogamut.base.utils.logging.NetworkLogManager.ServerWorker |
serverWorker
|
protected Thread |
serverWorkerThread
Thread of the server worker. |
static Charset |
USED_CHARSET
Charset that is used by the NetworkLogManager to send logs over the socket. |
Method Summary | |
---|---|
void |
addAgent(cz.cuni.amis.utils.token.IToken agent)
Initializes logging for the 'agent'. |
static LogCategory |
getLog()
Returns a logger that the NetworkLogManager is using. |
String |
getLoggerHost()
|
int |
getLoggerPort()
|
static NetworkLogManager |
getNetworkLogManager()
|
boolean |
isRunning()
Whether this instance is active, i.e., it was not NetworkLogManager#shutdown() . |
void |
kill()
Method called from DefaultPogamutPlatform.close() to shutdown the network
logging, terminating its thread to let JVM die gracefully. |
void |
processLog(NetworkLogEnvelope record,
cz.cuni.amis.utils.token.IToken agent)
A method called from NetworkLogPublisher when a log is to be published. |
void |
removeAgent(cz.cuni.amis.utils.token.IToken agent)
Removes an agent from the manager - stops accepting its logs, closes sockets where its logs are being sent etc... |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Charset USED_CHARSET
Charset
that is used by the NetworkLogManager
to send logs over the socket.
Initialized to "UTF-8" as default.
public static final long NETWORK_FLUSH_PERIOD_MILLIS
Initialized to 200 millis;
public static final long NETWORK_LOG_MANAGER_SOCKET_TIMEOUT_MILLIS
Initialized to 1000 millis.
protected cz.cuni.amis.pogamut.base.utils.logging.NetworkLogManager.ServerWorker serverWorker
protected Thread serverWorkerThread
Method Detail |
---|
public static NetworkLogManager getNetworkLogManager()
NetworkLogManager
, if called for the first time, creates an instance, before returning it.public boolean isRunning()
NetworkLogManager#shutdown()
.
public void kill()
DefaultPogamutPlatform.close()
to shutdown the network
logging, terminating its thread to let JVM die gracefully.
YOU DO NOT PROBABLY WANT TO CALL THIS METHOD MANUALLY!!!
But if you do, it will shutdown all sockets and the worker, but it will start it up again if there is any agent will wish to log something again. Therefore it is a good idea to call the shutdown after all Pogamut's agents are stopped/killed (i.e., dead).
public int getLoggerPort()
public String getLoggerHost()
public void addAgent(cz.cuni.amis.utils.token.IToken agent)
agent
- public void removeAgent(cz.cuni.amis.utils.token.IToken agent)
agent
- The agent whose logging is to be stopped.public void processLog(NetworkLogEnvelope record, cz.cuni.amis.utils.token.IToken agent)
record
- The envelope containing informations to be publishedid
- Who has sent the log.public static LogCategory getLog()
NetworkLogManager
is using.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |