Public Member Functions | |
SQLMonitoring (String vdbName) | |
void | cleanStats () |
final void | logRequestTime (AbstractRequest request, long time) |
final void | logError (AbstractRequest request) |
final void | logCacheHit (AbstractRequest request) |
final void | resetRequestStat (AbstractRequest request) |
final Stats | getStatForRequest (AbstractRequest request) |
String[][] | getAllStatsInformation () |
void | dumpAllStatsInformation () |
boolean | getDefaultRule () |
void | setDefaultRule (boolean monitoring) |
void | addRule (SQLMonitoringRule rule) |
ArrayList | getRuleList () |
String | getXmlImpl () |
Definition at line 43 of file SQLMonitoring.java.
|
Create a SQLMonitoring object.
Definition at line 56 of file SQLMonitoring.java. 00057 { 00058 statList = new Hashtable(); 00059 ruleList = new ArrayList(); 00060 logger = Trace.getLogger("org.objectweb.cjdbc.controller.monitoring." 00061 + vdbName); 00062 }
|
|
Add a rule to the list.
Definition at line 218 of file SQLMonitoring.java. 00219 {
00220 this.ruleList.add(rule);
00221 }
|
|
Implements org.objectweb.cjdbc.controller.monitoring.Monitoring. Definition at line 67 of file SQLMonitoring.java. 00068 { 00069 statList.clear(); 00070 }
|
|
Dump all stats using the current logger (INFO level). Implements org.objectweb.cjdbc.controller.monitoring.Monitoring. Definition at line 177 of file SQLMonitoring.java. References org.objectweb.cjdbc.common.util.Stats.singleLineDisplay(). 00178 { 00179 if (logger.isInfoEnabled()) 00180 { 00181 for (Iterator iter = statList.values().iterator(); iter.hasNext();) 00182 { 00183 Stats stat = (Stats) iter.next(); 00184 logger.info(stat.singleLineDisplay()); 00185 } 00186 } 00187 }
|
|
Return all stats information in the form of a String
Implements org.objectweb.cjdbc.controller.monitoring.Monitoring. Definition at line 161 of file SQLMonitoring.java. References org.objectweb.cjdbc.common.util.Stats.toStringTable(). Referenced by org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveSQLStats(). 00162 { 00163 Collection values = statList.values(); 00164 String[][] result = new String[values.size()][]; 00165 int i = 0; 00166 for (Iterator iter = values.iterator(); iter.hasNext(); i++) 00167 { 00168 Stats stat = (Stats) iter.next(); 00169 result[i] = stat.toStringTable(); 00170 } 00171 return result; 00172 }
|
|
Get the default monitoring rule
Definition at line 198 of file SQLMonitoring.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getXmlImpl(). 00199 {
00200 return defaultRule;
00201 }
|
|
Definition at line 260 of file SQLMonitoring.java. 00261 {
00262 return ruleList;
00263 }
|
|
Retrieve the stat corresponding to a request and create it if it does not exist.
Definition at line 140 of file SQLMonitoring.java. Referenced by org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logCacheHit(), org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logError(), org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.logRequestTime(), and org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.resetRequestStat(). 00141 { 00142 String sql = monitorRequestRule(request); 00143 if (sql == null) 00144 return null; 00145 00146 // Note that the Hashtable is synchronized 00147 Stats stat = (Stats) statList.get(sql); 00148 if (stat == null) 00149 { // No entry for this query, create a new Stats entry 00150 stat = new Stats(sql); 00151 statList.put(sql, stat); 00152 } 00153 return stat; 00154 }
|
|
Implements org.objectweb.cjdbc.controller.monitoring.Monitoring. Definition at line 268 of file SQLMonitoring.java. References org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getDefaultRule(), and org.objectweb.cjdbc.controller.monitoring.SQLMonitoringRule.getXml(). 00269 { 00270 String info = "<" + DatabasesXmlTags.ELT_SQLMonitoring + " " 00271 + DatabasesXmlTags.ATT_defaultMonitoring + "=\""; 00272 info += getDefaultRule(); 00273 info += "\">"; 00274 for (int i = 0; i < ruleList.size(); i++) 00275 { 00276 SQLMonitoringRule rule = (SQLMonitoringRule) ruleList.get(i); 00277 info += rule.getXml(); 00278 } 00279 info += "</" + DatabasesXmlTags.ELT_SQLMonitoring + ">"; 00280 return info; 00281 }
|
|
Log a cache hit for the given request.
Definition at line 109 of file SQLMonitoring.java. References org.objectweb.cjdbc.common.util.Stats.getName(), org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getStatForRequest(), and org.objectweb.cjdbc.common.util.Stats.incrementCacheHit(). 00110 { 00111 Stats stat = getStatForRequest(request); 00112 if (stat == null) 00113 return; 00114 stat.incrementCacheHit(); 00115 if (logger.isDebugEnabled()) 00116 logger.debug("Cache hit " + stat.getName()); 00117 }
|
|
Log an error for the given request.
Definition at line 94 of file SQLMonitoring.java. References org.objectweb.cjdbc.common.util.Stats.getName(), org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getStatForRequest(), and org.objectweb.cjdbc.common.util.Stats.incrementError(). 00095 { 00096 Stats stat = getStatForRequest(request); 00097 if (stat == null) 00098 return; 00099 stat.incrementError(); 00100 if (logger.isDebugEnabled()) 00101 logger.debug("ERROR " + stat.getName()); 00102 }
|
|
Log the time elapsed to execute the given request.
Definition at line 78 of file SQLMonitoring.java. References org.objectweb.cjdbc.common.util.Stats.getName(), org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getStatForRequest(), org.objectweb.cjdbc.common.util.Stats.incrementCount(), and org.objectweb.cjdbc.common.util.Stats.updateTime(). 00079 { 00080 Stats stat = getStatForRequest(request); 00081 if (stat == null) 00082 return; 00083 stat.incrementCount(); 00084 stat.updateTime(time); 00085 if (logger.isDebugEnabled()) 00086 logger.debug(time + " " + stat.getName()); 00087 }
|
|
Reset the stats associated to a request.
Definition at line 124 of file SQLMonitoring.java. References org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getStatForRequest(), and org.objectweb.cjdbc.common.util.Stats.reset(). 00125 { 00126 Stats stat = getStatForRequest(request); 00127 if (stat == null) 00128 return; 00129 stat.reset(); 00130 }
|
|
Defines the default rule
Definition at line 208 of file SQLMonitoring.java. 00209 {
00210 this.defaultRule = monitoring;
00211 }
|