Package esmska.update

Class Statistics


  • public class Statistics
    extends java.lang.Object
    Class handling everything needed about collecting and posting program usage statistics.
    • Constructor Summary

      Constructors 
      Constructor Description
      Statistics()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static net.sf.json.JSONObject collectUsageInfo()
      Collect program usage info and return it as a JSON object.
      static void refreshUUID()
      If the UUID hasn't already been changed this month, changes it.
      static void sendUsageInfo()
      Send program usage info to Esmska server if appropriate (check with shouldSend())
      static boolean shouldSend()
      Decide whether to send statistics to Esmska server or not.
      • Methods inherited from class java.lang.Object

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

      • Statistics

        public Statistics()
    • Method Detail

      • refreshUUID

        public static void refreshUUID()
        If the UUID hasn't already been changed this month, changes it. Otherwise does nothing.
      • collectUsageInfo

        public static net.sf.json.JSONObject collectUsageInfo()
        Collect program usage info and return it as a JSON object.
      • sendUsageInfo

        public static void sendUsageInfo()
        Send program usage info to Esmska server if appropriate (check with shouldSend())
      • shouldSend

        public static boolean shouldSend()
        Decide whether to send statistics to Esmska server or not. We don't want to send stats too often so that the server is not overloaded. The current decision algorithm:
        • If this is the first time Esmska was ever started, don't send anything.
        • If this is the first time Esmska was started in current month, always send.
        • If today is 20th or earlier day in the current month, send stats at maximum once per 5 days (check last submission date and decide).
        • If today is 21th or later day in the current month, send stats at maximum once per 3 days (check last submission date and decide).
        Returns:
        whether it is appropriate to send stats now or not