Java Doc for StopwatchStorage.java in  » Profiler » stopwatch » com » commsen » stopwatch » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Profiler » stopwatch » com.commsen.stopwatch 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.commsen.stopwatch.StopwatchStorage

All known Subclasses:   com.commsen.stopwatch.storages.AbstractDatabaseStorage,
StopwatchStorage
public interface StopwatchStorage (Code)
Interface describes the basic functionality a Stopwatch storage should support. A storage is a place where collected measurements are stored. By implementig this interface one can provide an "in-memory", "database", "file" or any other type of storage. All classes implementing this interface are considered Stopwatch engines. By default Stopwatch uses com.commsen.stopwatch.storages.DefaultHSQLInMemoryStorage to store data in "in-memory" HSQL database. Stopwatch can be configured to use another storage by :
  • setting -Dcom.commsen.stopwatch.storage=<fully_qualified_class_name> JVM parameter
  • creating "stopwatch.properties" file on classpath and seting storage=<fully_qualified_class_name>
Warning: the storage should be compatible with used engine. For example using com.commsen.stopwatch.engines.MemoryStopwatchEngine with com.commsen.stopwatch.storages.DefaultHSQLInMemoryStorage will work (because com.commsen.stopwatch.engines.MemoryStopwatchEngine extends com.commsen.stopwatch.engines.DefaultStopwatchEngine ) but the reports will not contain memory usage information.
author:
   Milen Dyankov




Method Summary
public  voidclose()
     Called when engine is about to be stopped or for some other reason will no more use this storage.
public  booleancompleteRecord(long id, Object[] parameters)
     Instructs the storage to complete (at least remember the time) the record identified by given parameters. Engines should know what parameters storage expects. Most storages will assume that parameters passed uniquely identify only one record.
public  voidfreeze()
     Called when engine is about to be paused or for some other reason will temporary not use this storage.
public  Report[]getAllByGroupReports()
     Implementing methods should generate and return an array of reports.
public  Report[]getAllByLabelReports()
     Implementing methods should generate and return an array of reports.
public  Report[]getGroupReports(String group)
     Implementing methods should generate and return an array of reports.
public  Report[]getLabelReports(String label)
     Implementing methods should generate and return an array of reports.
public  long[]getLoad(String group, String label, int periodField, int numberOfPeriods)
     Implementing methods should generate and return information of how many instances of the code specified by group and label ware running for the last numberOfPeriods periods.
public  ReportgetReport(String group, String label)
    
public  Report[]getReports()
     Implementing methods should generate and return an array of reports.
public  longnewCompleteRecord(Object[] startParameters, Object[] endParameters)
     Instructs the storage to create new complete record and store passed parameters. It is used in DELAYED mode.
public  longnewRecord(Object[] parameters)
     Instructs the storage to create new record and store passed parameters.
public  voidopen()
     Called when engine is about to use the storage for the first time.
public  booleanremoveRecord(long id)
     Instructs the storage to remove the record identified by given parameters. Engines should know what parameters storage expects. Most storages will assume that parameters passed uniquely identify only one record.
public  voidsetDebugEnabled(boolean debugEnabled)
     Instructs the storage to disable/enable debug information. The reason for this exist is to be able to minimize the performance impact Stopwatch may have on the measured application.
public  voidunfreeze()
     Called when engine is about to be resumed.



Method Detail
close
public void close() throws StopwatchStorageException(Code)
Called when engine is about to be stopped or for some other reason will no more use this storage. Gives storage a chance to clean up.
throws:
  StopwatchStorageException - if there is a problem closing the storage



completeRecord
public boolean completeRecord(long id, Object[] parameters) throws StopwatchStorageException(Code)
Instructs the storage to complete (at least remember the time) the record identified by given parameters. Engines should know what parameters storage expects. Most storages will assume that parameters passed uniquely identify only one record.
Parameters:
  id - of the database record to be updated
Parameters:
  parameters - used to find the record true if record was completed successfuly, false otherwise
throws:
  StopwatchStorageException - on error



freeze
public void freeze() throws StopwatchStorageException(Code)
Called when engine is about to be paused or for some other reason will temporary not use this storage. Gives storage a chance to free resources.
throws:
  StopwatchStorageException - if there is a problem with freezing the storage.



getAllByGroupReports
public Report[] getAllByGroupReports()(Code)
Implementing methods should generate and return an array of reports. Array should contain exectly 1 element for each group and all measurment should represent summary for all labels in that group. If there is no enough data to produce reports, method should return null array of reports.



getAllByLabelReports
public Report[] getAllByLabelReports()(Code)
Implementing methods should generate and return an array of reports. Array should contain exectly 1 element for each label and all measurment should represent summary for all groups containing that label. If there is no enough data to produce reports, method should return null array of reports.



getGroupReports
public Report[] getGroupReports(String group)(Code)
Implementing methods should generate and return an array of reports. Array shoud contain exectly 1 element for each group If there is no enough data to produce the report, method should return null
Parameters:
  group - the name of group for which report should be generated array of reports.



getLabelReports
public Report[] getLabelReports(String label)(Code)
Implementing methods should generate and return an array of reports. Array shoud contain exectly 1 element for each label If there is no enough data to produce the report, method should return null
Parameters:
  label - the label for which report should be generated array of reports.



getLoad
public long[] getLoad(String group, String label, int periodField, int numberOfPeriods)(Code)
Implementing methods should generate and return information of how many instances of the code specified by group and label ware running for the last numberOfPeriods periods. Period length is defined by periodField which can be one of java.util.Calendar.FIELD_NAME

For example to see how many instances of code labeled "l1" in group "g1" were running per minute for the last 30 minutes, one could use:

 long[] load = Stopwatch.getLoad("g1, "l1", 
java.util.Calendar.MINUTE , 30);
 
which will forward the call to the appropriate storage implementation. In this case load[0] will contain the number of code instances running 30 minutes ago and load[29] number of code instances running in the last minute.

If group is null - summary load of all masurments labeled label should be returned. If label is null - summary load of all masurments in group gtroup should be returned. If both group and label are null - summary load of all masurments should be returned.
Parameters:
  group - the group for which load report should be generated
Parameters:
  label - the label for which load report should be generated
Parameters:
  periodField - can be one of java.util.Calendar.FIELD_NAME
Parameters:
  numberOfPeriods - number of periods array of length numberOfPeriods where every element represents the load for given pariod.




getReport
public Report getReport(String group, String label)(Code)
Implementing methods should generate and return a single report for provided group and label If there is no enough data to produce the report, method should return null
Parameters:
  group - the group for which report should be generated
Parameters:
  label - the label for which report should be generated single report for provided group and label.



getReports
public Report[] getReports()(Code)
Implementing methods should generate and return an array of reports. Array should contain exectly 1 element for each combination of group and label If there is no enough data to produce reports, method should return null array of reports.



newCompleteRecord
public long newCompleteRecord(Object[] startParameters, Object[] endParameters) throws StopwatchStorageException(Code)
Instructs the storage to create new complete record and store passed parameters. It is used in DELAYED mode. Start parameters are kept in memory until the end of given measurments and then passed here together with the end parameters. Engines should know what parameters storage expects.
Parameters:
  startParameters - parameters describing start condition
Parameters:
  endParameters - parameters describing end condition true if record was completed successfuly, false otherwise
throws:
  StopwatchStorageException - on error



newRecord
public long newRecord(Object[] parameters) throws StopwatchStorageException(Code)
Instructs the storage to create new record and store passed parameters. Engines should know what parameters storage expects.
Parameters:
  parameters - the id of newly created record
throws:
  StopwatchStorageException -



open
public void open() throws StopwatchStorageException(Code)
Called when engine is about to use the storage for the first time. Gives storage a chance to open connections, prepare statements, etc.
throws:
  StopwatchStorageException - if there is problem preparing the storage.



removeRecord
public boolean removeRecord(long id) throws StopwatchStorageException(Code)
Instructs the storage to remove the record identified by given parameters. Engines should know what parameters storage expects. Most storages will assume that parameters passed uniquely identify only one record.
Parameters:
  id - of the database record to be removed
Parameters:
  parameters - used to find the record true if record was removed successfuly, false otherwise
throws:
  StopwatchStorageException - on error



setDebugEnabled
public void setDebugEnabled(boolean debugEnabled)(Code)
Instructs the storage to disable/enable debug information. The reason for this exist is to be able to minimize the performance impact Stopwatch may have on the measured application. Generating debug info consumes additional CPU units, which may become a problem if Stopwatch is heavily used. Setting this to false (it is false by default) should cause no debug info being generated even when log4j's level is set to DEBUG.
Parameters:
  debugEnabled - should debug information be generated



unfreeze
public void unfreeze() throws StopwatchStorageException(Code)
Called when engine is about to be resumed. Simply indicates that is about to use this storage again. Gives storage a chance to re-connect, etc.
throws:
  StopwatchStorageException - if there is a problem with unfreezing the storage.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.