public void ExecuteTaskPeriodically(int amount, int UnitTime, TimerTask task)

      {
        long ExecutionTime = 0;

        switch (UnitTime)
          {
            case HOURS:
                ExecutionTime = amount * oneHour;
                break;
            case MINUTES:
                ExecutionTime = amount * oneMinute;
                break;
            case SECONDS:
                ExecutionTime = amount * oneSecond;
                break;
            default:
                ExecutionTime = -1;
          }

        if (ExecutionTime != -1)
          {

            Timer periodicTask = new Timer();

            periodicTask.scheduleAtFixedRate(task,
                    Calendar.getInstance().getTime(),
                    ExecutionTime);

          }
        else
          {
          
          }
      }