|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.websphere.rsadapter.WSSystemMonitor
This class allows users to collect system monitoring data for a datbase connection. WebSphere
users can have access to this object by calling getSystemMonitor()
on the
com.ibm.websphere.rsadapter.WSConnection
Example:
import com.ibm.websphere.rsadapter.WSConnection;
.....
try {
InitialContext ctx = new InitialContext();
// Perform a naming service lookup to get the DataSource object.
DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/jdbc/myDS");
} catch (Exception e) {;}
WSConnection conn = (WSConnection) ds.getConnection();
WSSystemMonitor sysMon = conn.getSystemMonitor();
if (sysMon != null) // indicates that system monitoring is supported on the current backend database
{
sysMon.enable(true);
sysMon.start(WSSystemMonitor.RESET_TIMES);
// ......interact with the database
sysMon.stop();
...... collect data from the sysMon object
}
conn.close();
com.ibm.websphere.rsadapter.WSConnection
documentation.
Field Summary | |
---|---|
static int |
ACCUMULATE_TIMES
This constant causes the counter not to get reset when start() is called. |
static int |
RESET_TIMES
This constant causes the counter to get reset when start() is called. |
Constructor Summary | |
---|---|
WSSystemMonitor(java.lang.Object sysMonitor,
com.ibm.ws.rsadapter.spi.InternalDataStoreHelper internalHelper,
com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl mc)
|
Method Summary | |
---|---|
void |
enable(boolean flag)
This method enables the system monitor associated with a connection. |
long |
getApplicationTimeMillis()
This method returns the total time in milliseconds that has been monitored. |
long |
getCoreDriverTimeMicros()
This method returns the sum of elapsed monitored API times in microseconds collected while time monitoring is enabled. See the specific database documentation for system monitors |
long |
getNetworkIOTimeMicros()
This method returns the sum of elapsed network I/O times in microseconds collected while time monitoring is enabled. See the specific database documentation for system monitors |
long |
getServerTimeMicros()
This method returns the sum of all reported database server elapsed times in microseconds collected while time monitoring is enabled. See the specific database documentation for system monitors |
void |
start(int lapMode)
This method starts collecting system monitoring data for the connection associated with it if the monitor is enabled. Calling this method with system monitoring disabled is a no-op. |
void |
stop()
This method stops collecting system monitoring data for the connection associated with it if the monitor is enabled. After monitoring is stopped by calling this method, monitored times can be obtained by calling the getter methods of this interface. Calling this method with system monitoring disabled is a no-op. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int RESET_TIMES
public static final int ACCUMULATE_TIMES
Constructor Detail |
public WSSystemMonitor(java.lang.Object sysMonitor, com.ibm.ws.rsadapter.spi.InternalDataStoreHelper internalHelper, com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl mc)
Method Detail |
public void enable(boolean flag) throws java.sql.SQLException
flag
- boolean true to enable, false to disable
java.sql.SQLException
- if the backend database throws an exceptionpublic void start(int lapMode) throws java.sql.SQLException
lapMode
- indicates whether or not to zero out the time counters before monitoring is started.
Possible values are:
java.sql.SQLException
- if this method is called twice in a row without an intervening stop()public void stop() throws java.sql.SQLException
java.sql.SQLException
- if this method is called twice in a row without an intervening start()public long getServerTimeMicros() throws java.sql.SQLException
java.sql.SQLException
- if the stop method has not been called, i.e. monitoring is occurring.public long getNetworkIOTimeMicros() throws java.sql.SQLException
java.sql.SQLException
- if the stop method has not been called, i.e monitoring is occurring.public long getCoreDriverTimeMicros() throws java.sql.SQLException
java.sql.SQLException
- if the stop method has not been called, i.e monitoring is currently occuring.>br>
if the underlying JVM does not support reporting times in microseconds.public long getApplicationTimeMillis() throws java.sql.SQLException
java.sql.SQLException
- if the stop method has not been called, i.e monitoring is occuring.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |