com.jalios.jstore.jsync
Class JSyncLogger

java.lang.Object
  extended by com.jalios.jstore.jsync.JSyncLogger
All Implemented Interfaces:
JSyncConstants, JaliosConstants

public class JSyncLogger
extends Object
implements JSyncConstants

This class writes logs JSyncReplica actions such as join, disjoin, update, etc.

Version:
$Revision: 21412 $
Author:
Olivier Dedieu

Field Summary
static String REVISION
           
 
Fields inherited from interface com.jalios.jstore.jsync.JSyncConstants
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
 
Fields inherited from interface com.jalios.util.JaliosConstants
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 Summary
JSyncLogger(File logDir)
          Constructs a new JSyncLogger
 
Method Summary
 void add(String type, String action, String urid, int sc, long duration, TreeMap<String,String> extra)
          Generic method to add a new entry in the log
 void addDisjoinIn(String urid, int sc, long duration)
          Logs an incoming disjoin
 void addDisjoinOut(String urid, int sc, long duration)
          Logs an outgoing disjoin
 void addJoinIn(String urid, int sc, long duration)
          Logs an incoming join
 void addJoinOut(String urid, int sc, long duration)
          Logs an outgoind join
 void addRejectedMessage(String urid, int sc)
          Logs an internal message rejecting
 void addRemoveReplica(String urid)
          Logs an internal replica removing
 void addSuggestJoinIn(String urid, int sc, long duration)
          Logs an incoming suggestjoin
 void addSuggestJoinOut(String urid, int sc, long duration)
          Logs an outging suggestjoin
 void addUpdateIn(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(String urid, int sc, long duration, int nbOps, int nbFiles, boolean partial)
          Logs an outgoing update
 File getLogFile(Date date)
          Return the log file for the given date
 List<File> getLogFileList(Date beginDate, Date endDate)
          Return a list of log file for the given date range
 String getStatusLabel(int sc, Locale locale)
          Return the label of the given status code
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Constructor Detail

JSyncLogger

public JSyncLogger(File logDir)
Constructs a new JSyncLogger

Parameters:
logDir - the log directory
Since:
jcms-4.1
Method Detail

getLogFile

public File getLogFile(Date date)
Return the log file for the given date

Parameters:
date - the date
Returns:
the log file for the given date
Since:
jcms-4.1

getLogFileList

public List<File> getLogFileList(Date beginDate,
                                 Date endDate)
Return a list of log file for the given date range

Parameters:
beginDate - the begin date
endDate - the end date
Returns:
a List of File objects
Since:
jcms-4.1

getStatusLabel

public String getStatusLabel(int sc,
                             Locale locale)
Return the label of the given status code

Parameters:
sc - the status code (must be a new status code value (e.g. 1101, 1200, ...)
locale - the locale to be used
Returns:
the status label
Since:
jcms-4.1

add

public void add(String type,
                String action,
                String urid,
                int sc,
                long duration,
                TreeMap<String,String> extra)
Generic method to add a new entry in the log

Parameters:
type - the type of the log (in, out, internal)
action - the action (join, disjoin, update, ...)
urid - the urid
sc - the status code
duration - the duration
extra - an extra map of attributes
Since:
jcms-4.1

addJoinIn

public void addJoinIn(String urid,
                      int sc,
                      long duration)
Logs an incoming join

Parameters:
urid - the urid of the replica which has sent the join message
sc - the status code sent
duration - the duration
Since:
jcms-4.1

addSuggestJoinIn

public void addSuggestJoinIn(String urid,
                             int sc,
                             long duration)
Logs an incoming suggestjoin

Parameters:
urid - the urid of the replica which has sent the join message
sc - the status code sent
duration - the duration
Since:
jcms-5.7.4

addSuggestJoinOut

public void addSuggestJoinOut(String urid,
                              int sc,
                              long duration)
Logs an outging suggestjoin

Parameters:
urid - the urid of the replica which has sent the join message
sc - the status code sent
duration - the duration
Since:
jcms-5.7.4

addJoinOut

public void addJoinOut(String urid,
                       int sc,
                       long duration)
Logs an outgoind join

Parameters:
urid - the urid of the leader
sc - the status code received
duration - the duration
Since:
jcms-4.1

addDisjoinIn

public void addDisjoinIn(String urid,
                         int sc,
                         long duration)
Logs an incoming disjoin

Parameters:
urid - the urid of the replica which has sent the disjoin message
sc - the status code sent
duration - the duration
Since:
jcms-4.1

addDisjoinOut

public void addDisjoinOut(String urid,
                          int sc,
                          long duration)
Logs an outgoing disjoin

Parameters:
urid - the urid of the leader
sc - the status code received
duration - the duration
Since:
jcms-4.1

addUpdateIn

public void addUpdateIn(String urid,
                        int sc,
                        long duration,
                        int nbOps,
                        int nbFiles,
                        boolean merge,
                        int nbUU,
                        int nbUD,
                        int nbDU,
                        int nbDD)
Logs an incoming update

Parameters:
urid - the urid of the replica which has sent the update message
sc - the status code sent
duration - the duration
nbOps - the number of operations
nbFiles - the number of files
merge - true if the 2 divergents store suffix have been merged
nbUU - the number of U/U conflicts
nbUD - the number of U/D conflicts
nbDU - the number of D/U conflicts
nbDD - the number of D/D conflicts
Since:
jcms-4.1

addUpdateOut

public void addUpdateOut(String urid,
                         int sc,
                         long duration,
                         int nbOps,
                         int nbFiles,
                         boolean partial)
Logs an outgoing update

Parameters:
urid - the urid of the replica the message has been sent
sc - the status code received
duration - the duration
nbOps - the number of operations
nbFiles - the number of files
partial - true if this is a partial update
Since:
jcms-4.1

addRemoveReplica

public void addRemoveReplica(String urid)
Logs an internal replica removing

Parameters:
urid - the urid of the replica removed
Since:
jcms-4.1

addRejectedMessage

public void addRejectedMessage(String urid,
                               int sc)
Logs an internal message rejecting

Parameters:
urid - the urid of the replica rejected
sc - the status code sent
Since:
jcms-4.1


Copyright © 2001-2010 Jalios SA. All Rights Reserved.