|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectParkNPark.common.Logger
public class Logger
Logger class that, as quickly as possible, logs information into a pre-allocated buffer and has facilities for manual and automatic flushing.
Field Summary | |
---|---|
protected int |
allocationSize
The number of array elements to allocate when creating new Lists |
protected List<LogEntry> |
log
Our currently-active log |
protected Object |
logMutex
Consistent mutex for the currently-active log (because log can get replaced by a new instance) |
protected BufferedWriter |
probeClientManagerIn
Sink for the times that client manager access begins |
protected BufferedWriter |
probeClientManagerOut
Sink for the times that client manager access ends |
protected BufferedWriter |
probeDbIn
Sink for the times that database access begins |
protected BufferedWriter |
probeDbOut
Sink for the times that database access ends |
protected BufferedWriter |
probeFaultDetection
Fault detection sink |
protected BufferedWriter |
probeFaultRecovery
Fault recovery sink |
protected BufferedWriter |
probeIn
Sink for the times that method calls begin in |
protected BufferedWriter |
probeMethod
Method name sink |
protected BufferedWriter |
probeNameServiceIn
Sink for the times that naming service access begins |
protected BufferedWriter |
probeNameServiceOut
Sink for the times that naming service access ends |
protected BufferedWriter |
probeOut
Sink for the times that method calls complete in |
protected BufferedWriter |
probeSource
Client name sink |
protected BufferedWriter |
probeWaitIn
Sink for the times that the waiting begins |
protected BufferedWriter |
probeWaitOut
Sink for the times that the waiting stops |
protected static File |
tempFilePath
Our temporary file path for logging |
Constructor Summary | |
---|---|
Logger(int numClients,
int numServers,
int requestsPerClient,
int interRequestTime,
int replySize,
String tier,
String hostname,
boolean logServerInfo,
boolean logClientInfo,
boolean appendLogs)
Creates a new Logger instance that can be used to log activities and, in the background, flush existing log entries to disk |
Method Summary | |
---|---|
LogEntry |
beginLogEntry(String methodName)
Creates a new LogEntry object instance, adds it to the log, and, just before returning it, sets its probeIn property to the current time in microseconds. |
LogEntry |
beginLogEntry(String methodName,
String clientName)
Creates a new LogEntry object instance, adds it to the log, and, just before returning it, sets its probeIn property to the current time in microseconds |
void |
close()
Closes the log files. |
void |
endLogEntry(LogEntry logEntry)
Ends a LogEntry after setting the probeOut property to the current time in microseconds |
void |
flush()
Flush out all the log entries into the output files. |
protected File |
getLogFile(int numClients,
int numServers,
int interRequestTime,
int replySize,
String probeType,
String machine,
String hostname)
Generate the full name of the log file name according to the given parameters |
protected static File |
getTempFilePath()
Returns the temporary file path to store logging files into |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<LogEntry> log
protected Object logMutex
protected int allocationSize
protected BufferedWriter probeIn
protected BufferedWriter probeOut
protected BufferedWriter probeMethod
protected BufferedWriter probeSource
protected BufferedWriter probeFaultDetection
protected BufferedWriter probeFaultRecovery
protected BufferedWriter probeDbIn
protected BufferedWriter probeDbOut
protected BufferedWriter probeNameServiceIn
protected BufferedWriter probeNameServiceOut
protected BufferedWriter probeClientManagerIn
protected BufferedWriter probeClientManagerOut
protected BufferedWriter probeWaitIn
protected BufferedWriter probeWaitOut
protected static File tempFilePath
Constructor Detail |
---|
public Logger(int numClients, int numServers, int requestsPerClient, int interRequestTime, int replySize, String tier, String hostname, boolean logServerInfo, boolean logClientInfo, boolean appendLogs)
numClients
- The number of clients in the current testnumServers
- The number of servers in the current testrequestsPerClient
- The number of requests expected from each clientinterRequestTime
- The delay between each invocation, which is used when
constructing the log file namesreplySize
- The size of the server's replies, which is used when
constructing the log file namestier
- The tier being logged: srv
or cli
hostname
- The host name of the machine being loggedlogServerInfo
- Log information relating to the serverlogFaults
- Log the fault detection and fault recovery times, which primarily
makes sense on a clientappendLogs
- True when the log files should be appended or false if the
log files should be overwrittenMethod Detail |
---|
public LogEntry beginLogEntry(String methodName) throws ServiceUnavailableException
methodName
- The name of the method that was called
ServiceUnavailableException
- Thrown if a log entry is attempted
when the log has already been closedpublic LogEntry beginLogEntry(String methodName, String clientName) throws ServiceUnavailableException
methodName
- The name of the method that was calledclientName
- The hostname of the client that called the method
ServiceUnavailableException
- Thrown if a log entry is attempted
when the log has already been closedpublic void endLogEntry(LogEntry logEntry) throws ServiceUnavailableException
logEntry
- The LogEntry instance to finish
ServiceUnavailableException
- Thrown when the logger has been
shut down and thus this log entry cannot be persistedpublic void flush() throws IOException
logMutex
locked or else a deadlock might occur!
IOException
- Thrown if an IOException occurs during the flushing,
such as out-of-disk-space exceptionspublic void close() throws IOException
IOException
protected File getLogFile(int numClients, int numServers, int interRequestTime, int replySize, String probeType, String machine, String hostname)
numClients
- The number of clients in the current testnumServers
- The number of servers in the current testinterRequestTime
- The delay between each invocationreplySize
- The size of the server's repliesprobeType
- The type of probe: in
, out
,
msg
, or source
machine
- The machine being logged: srv
or cli
hostname
- The host name of the machine being logged
protected static File getTempFilePath()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |