Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector Class Reference

List of all members.

Public Member Functions

 DataCollector (Controller controller) throws NotCompliantMBeanException, JmxException
String getAssociatedString ()
String[][] retrieveBackendsData () throws DataCollectorException
String[][] retrieveBackendsData (String virtualDatabasename) throws DataCollectorException
String[][] retrieveCacheData () throws DataCollectorException
String[][] retrieveRecoveryLogData (String databaseName) throws DataCollectorException
String[][] retrieveCacheData (String virtualDatabasename) throws DataCollectorException
String[][] retrieveCacheStatsData () throws DataCollectorException
String[][] retrieveCacheStatsData (String virtualDatabasename) throws DataCollectorException
String[][] retrieveClientsData () throws DataCollectorException
String[][] retrieveClientsData (String virtualDatabasename) throws DataCollectorException
String[][] retrieveControllerLoadData ()
String[][] retrieveSQLStats () throws DataCollectorException
String[][] retrieveSQLStats (String virtualDatabasename) throws DataCollectorException
String[][] retrieveVirtualDatabasesData ()
Controller getController ()
String[][] retrieveSchedulerData (String virtualDatabasename) throws DataCollectorException
AbstractDataCollector retrieveDataCollectorInstance (int dataType, String targetName, String virtualDbName) throws DataCollectorException
long retrieveData (AbstractDataCollector collector) throws DataCollectorException
boolean hasVirtualDatabase (String name)

Package Attributes

Controller controller

Static Package Attributes

Trace logger = Trace.getLogger("org.objectweb.cjdbc.controller.jmx")

Detailed Description

This class implements retrieval of data to all possible objects in the controller or other c-jdbc components. It gets its interface from the corresponding MBean.

Author:
Nicolas Modrzyk

Emmanuel Cecchet

Definition at line 89 of file DataCollector.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.DataCollector Controller  controller  )  throws NotCompliantMBeanException, JmxException
 

Create a new DataCollector associated to this controller.

Parameters:
controller to collect data from
Exceptions:
NotCompliantMBeanException - if the mbeanInterface does not follow JMX design patterns for Management Interfaces, or if this does not implement the specified interface.
JmxException the bean could not be registered

Definition at line 107 of file DataCollector.java.

00109   {
00110     super(DataCollectorMBean.class);
00111     this.controller = controller;
00112     ObjectName objectName = JmxConstants.getDataCollectorObjectName();
00113     MBeanServerManager.registerMBean(this, objectName);
00114 
00115   }


Member Function Documentation

String org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.getAssociatedString  ) 
 

See also:
AbstractStandardMBean#getAssociatedString

Definition at line 120 of file DataCollector.java.

00121   {
00122     return "datacollector";
00123   }

Controller org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.getController  ) 
 

Returns:
Returns the controller.

Definition at line 341 of file DataCollector.java.

00342   {
00343     return controller;
00344   }

boolean org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.hasVirtualDatabase String  name  ) 
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.hasVirtualDatabase(java.lang.String)

Definition at line 468 of file DataCollector.java.

00469   {
00470     return controller.hasVirtualDatabase(name);
00471   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveBackendsData String  virtualDatabasename  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveBackendsData(java.lang.String)

Definition at line 152 of file DataCollector.java.

References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.acquireReadLockBackendLists(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getBackends(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.releaseReadLockBackendLists().

00154   {
00155     VirtualDatabase vdb = getVirtualDatabase(virtualDatabasename);
00156     try
00157     {
00158       vdb.acquireReadLockBackendLists();
00159     }
00160     catch (InterruptedException e)
00161     {
00162       String msg = Translate.get("virtualdatabase.fail.read.lock", e);
00163       throw new DataCollectorException(msg);
00164     }
00165     ArrayList backends = vdb.getBackends();
00166     int backendListSize = backends.size();
00167     String[][] data = new String[backendListSize][];
00168     for (int i = 0; i < backendListSize; i++)
00169     {
00170       data[i] = ((DatabaseBackend) backends.get(i)).getBackendData();
00171     }
00172     vdb.releaseReadLockBackendLists();
00173     return data;
00174   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveBackendsData  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveBackendsData()

Definition at line 144 of file DataCollector.java.

00145   {
00146     throw new DataCollectorException("Not Implemented");
00147   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheData String  virtualDatabasename  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveCacheData(java.lang.String)

Definition at line 201 of file DataCollector.java.

References org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getCacheData(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getRequestManager().

00203   {
00204     VirtualDatabase vdb = getVirtualDatabase(virtualDatabasename);
00205     AbstractResultCache cache = vdb.getRequestManager().getResultCache();
00206     if (cache == null)
00207       throw new DataCollectorException(ExceptionTypes.NO_CACHE_ENABLED);
00208     else
00209     {
00210       try
00211       {
00212         return cache.getCacheData();
00213       }
00214       catch (Exception e)
00215       {
00216         throw new DataCollectorException(e.getMessage());
00217       }
00218     }
00219   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheData  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveCacheData()

Definition at line 179 of file DataCollector.java.

00180   {
00181     throw new DataCollectorException(ExceptionTypes.NOT_IMPLEMENTED);
00182 
00183   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheStatsData String  virtualDatabasename  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveCacheStatsData(java.lang.String)

Definition at line 232 of file DataCollector.java.

References org.objectweb.cjdbc.controller.cache.result.AbstractResultCache.getCacheStatsData(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getRequestManager().

00234   {
00235     VirtualDatabase vdb = getVirtualDatabase(virtualDatabasename);
00236     AbstractResultCache cache = vdb.getRequestManager().getResultCache();
00237     if (cache == null)
00238       throw new DataCollectorException("No Cache enabled.");
00239     else
00240     {
00241       try
00242       {
00243         return cache.getCacheStatsData();
00244       }
00245       catch (Exception e)
00246       {
00247         throw new DataCollectorException(e.getMessage());
00248       }
00249     }
00250   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveCacheStatsData  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveCacheStatsData()

Definition at line 224 of file DataCollector.java.

00225   {
00226     throw new DataCollectorException(ExceptionTypes.NOT_IMPLEMENTED);
00227   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveClientsData String  virtualDatabasename  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveClientsData(java.lang.String)

Definition at line 263 of file DataCollector.java.

References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getActiveThreads().

00265   {
00266     VirtualDatabase vdb = getVirtualDatabase(virtualDatabasename);
00267     ArrayList activeThreads = vdb.getActiveThreads();
00268     int size = activeThreads.size();
00269     String[][] data = new String[size][];
00270     for (int i = 0; i < size; i++)
00271     {
00272       data[i] = ((VirtualDatabaseWorkerThread) activeThreads.get(i))
00273           .retrieveClientData();
00274     }
00275     return data;
00276   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveClientsData  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveClientsData()

Definition at line 255 of file DataCollector.java.

00256   {
00257     throw new DataCollectorException("Not Implemented");
00258   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveControllerLoadData  ) 
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveControllerLoadData()

Definition at line 281 of file DataCollector.java.

00282   {
00283     long total = Runtime.getRuntime().totalMemory();
00284     long free = Runtime.getRuntime().freeMemory();
00285     String[][] data = new String[1][6];
00286     data[0][0] = controller.getIPAddress();
00287     data[0][1] = String.valueOf(total / 1024 / 1024);
00288     data[0][2] = String.valueOf((total - free) / 1024 / 1024);
00289     data[0][3] = String.valueOf(Thread.activeCount());
00290     data[0][4] = String.valueOf(controller.getConnectionThread()
00291         .getControllerServerThreadPendingQueueSize());
00292     data[0][5] = String.valueOf(controller.getConnectionThread()
00293         .getIdleWorkerThreads());
00294     return data;
00295   }

long org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveData AbstractDataCollector  collector  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveData

Definition at line 456 of file DataCollector.java.

References org.objectweb.cjdbc.common.monitor.AbstractDataCollector.collectValue(), and org.objectweb.cjdbc.common.monitor.AbstractDataCollector.setController().

00458   {
00459     // Get the new value and return it
00460     // recall reference to controller (is transient in collector)
00461     collector.setController(controller);
00462     return collector.collectValue();
00463   }

AbstractDataCollector org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveDataCollectorInstance int  dataType,
String  targetName,
String  virtualDbName
throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveDataCollectorInstance

Definition at line 362 of file DataCollector.java.

00364   {
00365     switch (dataType)
00366     {
00367       /*
00368        * Controller Collectors
00369        */
00370       case CONTROLLER_TOTAL_MEMORY :
00371         return new TotalMemoryCollector(controller);
00372       case CONTROLLER_USED_MEMORY :
00373         return new UsedMemoryCollector(controller);
00374       case CONTROLLER_WORKER_PENDING_QUEUE :
00375         return new ControllerWorkerPendingQueueCollector(controller);
00376       case CONTROLLER_THREADS_NUMBER :
00377         return new ThreadsCountCollector(controller);
00378       case CONTROLLER_IDLE_WORKER_THREADS :
00379         return new ControllerIdleThreadsCollector(controller);
00380       /*
00381        * Backend collectors
00382        */
00383       case BACKEND_ACTIVE_TRANSACTION :
00384         return new ActiveTransactionCollector(targetName, virtualDbName);
00385       case BACKEND_PENDING_REQUESTS :
00386         return new PendingRequestsCollector(targetName, virtualDbName);
00387       case BACKEND_TOTAL_ACTIVE_CONNECTIONS :
00388         return new ActiveConnectionsCollector(targetName, virtualDbName);
00389       case BACKEND_TOTAL_REQUEST :
00390         return new RequestsCollector(targetName, virtualDbName);
00391       case BACKEND_TOTAL_READ_REQUEST :
00392         return new ReadRequestsCollector(targetName, virtualDbName);
00393       case BACKEND_TOTAL_WRITE_REQUEST :
00394         return new WriteRequestsCollector(targetName, virtualDbName);
00395       case BACKEND_TOTAL_TRANSACTIONS :
00396         return new TransactionsCollector(targetName, virtualDbName);
00397       /*
00398        * VirtualDatabase collectors
00399        */
00400       case DATABASES_ACTIVE_THREADS :
00401         return new ActiveDatabaseThreadCollector(virtualDbName);
00402       case DATABASES_PENDING_CONNECTIONS :
00403         return new PendingDatabaseConnectionCollector(virtualDbName);
00404       case DATABASES_NUMBER_OF_THREADS :
00405         return new DatabaseThreadsCollector(virtualDbName);
00406       /*
00407        * Cache stats collectors
00408        */
00409       case CACHE_STATS_COUNT_HITS :
00410         return new CountHitsCollector(virtualDbName);
00411       case CACHE_STATS_COUNT_INSERT :
00412         return new CountInsertCollector(virtualDbName);
00413       case CACHE_STATS_COUNT_SELECT :
00414         return new CountSelectCollector(virtualDbName);
00415       case CACHE_STATS_HITS_PERCENTAGE :
00416         return new HitsRatioCollector(virtualDbName);
00417       case CACHE_STATS_NUMBER_ENTRIES :
00418         return new CacheEntriesCollector(virtualDbName);
00419       /*
00420        * Scheduler collectors
00421        */
00422       case SCHEDULER_NUMBER_READ :
00423         return new NumberReadCollector(virtualDbName);
00424       case SCHEDULER_NUMBER_REQUESTS :
00425         return new NumberRequestsCollector(virtualDbName);
00426       case SCHEDULER_NUMBER_WRITES :
00427         return new NumberWriteCollector(virtualDbName);
00428       case SCHEDULER_PENDING_TRANSACTIONS :
00429         return new PendingTransactionsCollector(virtualDbName);
00430       case SCHEDULER_PENDING_WRITES :
00431         return new PendingWritesCollector(virtualDbName);
00432       /*
00433        * Client collectors
00434        */
00435       case CLIENT_BYTES_READ :
00436         return new ClientBytesReadCollector(virtualDbName, targetName);
00437       case CLIENT_BYTES_WRITTEN :
00438         return new ClientBytesWrittenCollector(virtualDbName, targetName);
00439       case CLIENT_TIME_ACTIVE :
00440         return new ClientActiveTimeCollector(virtualDbName, targetName);
00441       case CLIENT_READING_SPEED :
00442         return new ClientReadingSpeedCollector(virtualDbName, targetName);
00443       case CLIENT_WRITING_SPEED :
00444         return new ClientWritingSpeedCollector(virtualDbName, targetName);
00445       /*
00446        * Unknown collector
00447        */
00448       default :
00449         throw new DataCollectorException(ExceptionTypes.INVALID_COLLECTOR_TYPE);
00450     }
00451   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveRecoveryLogData String  databaseName  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveRecoveryLogData(java.lang.String)

Definition at line 188 of file DataCollector.java.

References org.objectweb.cjdbc.controller.recoverylog.AbstractRecoveryLog.getData(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getRequestManager().

00190   {
00191     VirtualDatabase vdb = getVirtualDatabase(databaseName);
00192     AbstractRecoveryLog log = vdb.getRequestManager().getRecoveryLog();
00193     if (log == null)
00194       throw new DataCollectorException(ExceptionTypes.NO_RECOVERY_LOG);
00195     return log.getData();
00196   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveSchedulerData String  virtualDatabasename  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveSchedulerData(java.lang.String)

Definition at line 349 of file DataCollector.java.

References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getRequestManager(), and org.objectweb.cjdbc.controller.scheduler.AbstractScheduler.getSchedulerData().

00351   {
00352     VirtualDatabase vdb = getVirtualDatabase(virtualDatabasename);
00353     AbstractScheduler scheduler = vdb.getRequestManager().getScheduler();
00354     String[][] data = new String[1][];
00355     data[0] = scheduler.getSchedulerData();
00356     return data;
00357   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveSQLStats String  virtualDatabasename  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveSQLStats()

Definition at line 308 of file DataCollector.java.

References org.objectweb.cjdbc.controller.monitoring.SQLMonitoring.getAllStatsInformation(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getSQLMonitor().

00310   {
00311     VirtualDatabase vdb = getVirtualDatabase(virtualDatabasename);
00312     if (vdb.getSQLMonitor() == null)
00313       throw new DataCollectorException("No SQL monitoring enabled.");
00314     else
00315       return vdb.getSQLMonitor().getAllStatsInformation();
00316   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveSQLStats  )  throws DataCollectorException
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveSQLStats()

Definition at line 300 of file DataCollector.java.

00301   {
00302     throw new DataCollectorException("Not Implemented");
00303   }

String [][] org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.retrieveVirtualDatabasesData  ) 
 

See also:
org.objectweb.cjdbc.common.jmx.mbeans.DataCollectorMBean.retrieveVirtualDatabasesData()

Definition at line 321 of file DataCollector.java.

References org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getActiveThreads(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getCurrentNbOfThreads(), org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getPendingConnections(), and org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase.getVirtualDatabaseName().

00322   {
00323     ArrayList dbs = controller.getVirtualDatabases();
00324     int size = dbs.size();
00325     String[][] data = new String[size][4];
00326     VirtualDatabase db;
00327     for (int i = 0; i < size; i++)
00328     {
00329       db = (VirtualDatabase) dbs.get(i);
00330       data[i][0] = db.getVirtualDatabaseName();
00331       data[i][1] = String.valueOf(db.getActiveThreads().size());
00332       data[i][2] = String.valueOf(db.getPendingConnections().size());
00333       data[i][3] = String.valueOf(db.getCurrentNbOfThreads());
00334     }
00335     return data;
00336   }


Member Data Documentation

Trace org.objectweb.cjdbc.controller.monitoring.datacollector.DataCollector.logger = Trace.getLogger("org.objectweb.cjdbc.controller.jmx") [static, package]
 

Logger instance

Definition at line 95 of file DataCollector.java.


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:04:21 2005 for C-JDBC by  doxygen 1.3.9.1