Class UpdateTimer


  • public class UpdateTimer
    extends java.lang.Object
    Class to calculate time between two update queries.
    Author:
    f.conrads
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  UpdateTimer.Strategy
      The possible strategies NONE: updates will be executed immediately after another FIXED: a fixed value in ms will be waited before the next update query DISTRIBUTED: the updates will be equally distributed over the time limit of the task
    • Constructor Summary

      Constructors 
      Constructor Description
      UpdateTimer()
      Creates the default UpdateTimer All update queries will be executed immediately after another
      UpdateTimer​(double fixedValue)
      Creates a FixedUpdateTimer
      UpdateTimer​(int noOfUpdates, java.lang.Double timeLimit)
      Creates a distributed UpdateTimer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double calculateTime​(double timeExceeded, long executedQueries)
      calculates the time the UPDATEWorker has to wait until the next update query
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • UpdateTimer

        public UpdateTimer()
        Creates the default UpdateTimer All update queries will be executed immediately after another
      • UpdateTimer

        public UpdateTimer​(double fixedValue)
        Creates a FixedUpdateTimer
        Parameters:
        fixedValue - the fixed time to wait between queries
      • UpdateTimer

        public UpdateTimer​(int noOfUpdates,
                           java.lang.Double timeLimit)
        Creates a distributed UpdateTimer
        Parameters:
        noOfUpdates - the number of update queries
        timeLimit - the timeLimit of the task
    • Method Detail

      • calculateTime

        public double calculateTime​(double timeExceeded,
                                    long executedQueries)
        calculates the time the UPDATEWorker has to wait until the next update query
        Parameters:
        timeExceeded - The time it took from start of the task to now
        executedQueries - currently number of executed Update Queries
        Returns:
        The time to wait
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object