Class Statistics

  • All Implemented Interfaces:
    Runnable

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

      • Statistics

        public Statistics​(Session session)
    • Method Detail

      • stop

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

        public 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 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 Runnable