Class Statistics

  • All Implemented Interfaces:
    java.lang.Runnable

    public class Statistics
    extends java.lang.Object
    implements java.lang.Runnable
    Statistics acts as a facade for adding entries and running reports.
    • Constructor Summary

      Constructors 
      Constructor Description
      Statistics​(Session session)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntry​(Entry entry)
      Adds an entry to the statistics workspace.
      void addEntryAsync​(Entry entry)
      Adds an entry to the statistics workspace but does not guarantee that the entry is persisted when the method returns.
      void run()  
      java.util.Iterator runReport​(Report report)
      Runs a report and returns the result of the report.
      java.util.Iterator runReport​(Session session, Report report)
      Runs a report and returns the result of the report.
      void stop()
      Stops the statistics instance and releases resource.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Statistics

        public Statistics​(Session session)
    • Method Detail

      • stop

        public void stop()
        Stops the statistics instance and releases resource.
      • runReport

        public java.util.Iterator runReport​(Report report)
                                     throws RepositoryException
        Runs a report and returns the result of the report. Please note that this implementation serializes access to the underlying session that runs the report. For improved concurrency, use runReport(Session, Report) instead and provide your own session.

        This method is thread-safe.

        Parameters:
        report - the report to run.
        Returns:
        the result of the report.
        Throws:
        RepositoryException - if an error occurs while reading from the workspace.
      • runReport

        public java.util.Iterator runReport​(Session session,
                                            Report report)
                                     throws RepositoryException
        Runs a report and returns the result of the report.

        This method is thread-safe.

        Parameters:
        session - The Session to access the data from the repository to generate the report
        report - the report to run.
        Returns:
        the result of the report.
        Throws:
        RepositoryException - if an error occurs while reading from the workspace.
      • addEntry

        public void addEntry​(Entry entry)
                      throws RepositoryException
        Adds an entry to the statistics workspace.

        This method is thread-safe.

        Parameters:
        entry - the entry to add.
        Throws:
        RepositoryException - if an error occurs while writing to the workspace.
      • addEntryAsync

        public void addEntryAsync​(Entry entry)
                           throws RepositoryException
        Adds an entry to the statistics workspace but does not guarantee that the entry is persisted when the method returns. The entry may be persisted at some time in the future or may even fail (silently) because of an exception.

        This method is thread-safe.

        Parameters:
        entry - the entry to add.
        Throws:
        RepositoryException - if an error occurs while writing to the workspace.
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable