public class JSyncLogger extends java.lang.Object implements JSyncConstants
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REVISION |
SC_BAD_ADDRESS, SC_BAD_LEADER, SC_BAD_MESSAGE, SC_INTERNAL_SERVER_ERROR, SC_JOIN_REJECTED, SC_LEADER_CANNOT_JOIN, SC_NO_ACK, SC_NO_SEND, SC_OK, SC_UNKNOWN, SC_UNKNOWN_URID, SC_URID_ALREADY_ADDED, STATUS_LEADER, STATUS_LONE, STATUS_MEMBER, STATUS_SUBLEADER
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
Constructor and Description |
---|
JSyncLogger(java.io.File logDir)
Constructs a new JSyncLogger
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String type,
java.lang.String action,
java.lang.String urid,
int sc,
long duration,
java.util.TreeMap<java.lang.String,java.lang.String> extra)
Generic method to add a new entry in the log
|
void |
addDisjoinIn(java.lang.String urid,
int sc,
long duration)
Logs an incoming disjoin
|
void |
addDisjoinOut(java.lang.String urid,
int sc,
long duration)
Logs an outgoing disjoin
|
void |
addJoinIn(java.lang.String urid,
int sc,
long duration)
Logs an incoming join
|
void |
addJoinOut(java.lang.String urid,
int sc,
long duration)
Logs an outgoind join
|
void |
addRejectedMessage(java.lang.String urid,
int sc)
Logs an internal message rejecting
|
void |
addRemoveReplica(java.lang.String urid)
Logs an internal replica removing
|
void |
addSuggestJoinIn(java.lang.String urid,
int sc,
long duration)
Logs an incoming suggestjoin
|
void |
addSuggestJoinOut(java.lang.String urid,
int sc,
long duration)
Logs an outging suggestjoin
|
void |
addUpdateIn(java.lang.String urid,
int sc,
long duration,
int nbOps,
int nbFiles,
boolean merge,
int nbUU,
int nbUD,
int nbDU,
int nbDD)
Logs an incoming update
|
void |
addUpdateOut(java.lang.String urid,
int sc,
long duration,
int nbOps,
int nbFiles,
boolean partial)
Logs an outgoing update
|
java.io.File |
getLogFile(java.util.Date date)
Return the log file for the given date
|
java.util.List<java.io.File> |
getLogFileList(java.util.Date beginDate,
java.util.Date endDate)
Return a list of log file for the given date range
|
java.lang.String |
getStatusLabel(int sc,
java.util.Locale locale)
Return the label of the given status code
|
public static final java.lang.String REVISION
public JSyncLogger(java.io.File logDir)
logDir
- the log directorypublic java.io.File getLogFile(java.util.Date date)
date
- the datepublic java.util.List<java.io.File> getLogFileList(java.util.Date beginDate, java.util.Date endDate)
beginDate
- the begin dateendDate
- the end datepublic java.lang.String getStatusLabel(int sc, java.util.Locale locale)
sc
- the status code (must be a new status code value (e.g. 1101, 1200, ...)locale
- the locale to be usedpublic void add(java.lang.String type, java.lang.String action, java.lang.String urid, int sc, long duration, java.util.TreeMap<java.lang.String,java.lang.String> extra)
type
- the type of the log (in, out, internal)action
- the action (join, disjoin, update, ...)urid
- the uridsc
- the status codeduration
- the durationextra
- an extra map of attributespublic void addJoinIn(java.lang.String urid, int sc, long duration)
urid
- the urid of the replica which has sent the join messagesc
- the status code sentduration
- the durationpublic void addSuggestJoinIn(java.lang.String urid, int sc, long duration)
urid
- the urid of the replica which has sent the join messagesc
- the status code sentduration
- the durationpublic void addSuggestJoinOut(java.lang.String urid, int sc, long duration)
urid
- the urid of the replica which has sent the join messagesc
- the status code sentduration
- the durationpublic void addJoinOut(java.lang.String urid, int sc, long duration)
urid
- the urid of the leadersc
- the status code receivedduration
- the durationpublic void addDisjoinIn(java.lang.String urid, int sc, long duration)
urid
- the urid of the replica which has sent the disjoin messagesc
- the status code sentduration
- the durationpublic void addDisjoinOut(java.lang.String urid, int sc, long duration)
urid
- the urid of the leadersc
- the status code receivedduration
- the durationpublic void addUpdateIn(java.lang.String urid, int sc, long duration, int nbOps, int nbFiles, boolean merge, int nbUU, int nbUD, int nbDU, int nbDD)
urid
- the urid of the replica which has sent the update messagesc
- the status code sentduration
- the durationnbOps
- the number of operationsnbFiles
- the number of filesmerge
- true if the 2 divergents store suffix have been mergednbUU
- the number of U/U conflictsnbUD
- the number of U/D conflictsnbDU
- the number of D/U conflictsnbDD
- the number of D/D conflictspublic void addUpdateOut(java.lang.String urid, int sc, long duration, int nbOps, int nbFiles, boolean partial)
urid
- the urid of the replica the message has been sentsc
- the status code receivedduration
- the durationnbOps
- the number of operationsnbFiles
- the number of filespartial
- true if this is a partial updatepublic void addRemoveReplica(java.lang.String urid)
urid
- the urid of the replica removedpublic void addRejectedMessage(java.lang.String urid, int sc)
urid
- the urid of the replica rejectedsc
- the status code sentCopyright © 2001-2010 Jalios SA. All Rights Reserved.