Package java.util

Examples of java.util.TimerTask


    }
  }

  private void startMaintenanceTimer(int period) {
    maintenanceTimer = new Timer(true);
    maintenanceTimer.schedule(new TimerTask() {
      public void run() {
        if (maintenanceScheduled) {
          gc();
          // need to lock for consistent backup
          lock.readLock().lock();
View Full Code Here


  private static Runnable runnable;

  public static void start() {
    stop();
    timer = new Timer();
    timer.schedule(new TimerTask() {
      public void run() {
        try {
          String newSource = Registry
              .getParameter(Names.JEASE_TIMER_TASK);
          if (Validations.isNotEmpty(newSource)) {
View Full Code Here

          sessionTemporaryFolder.deleteOnExit();
        }
       
        // Launch a timer that updates modification date of the temporary folder each minute
        final long updateDelay = 60000;
        new Timer(true).schedule(new TimerTask() {
            @Override
            public void run() {
              // Ensure modification date is always growing in case system time was adjusted
              sessionTemporaryFolder.setLastModified(Math.max(System.currentTimeMillis(),
                  sessionTemporaryFolder.lastModified() + updateDelay));
            }
          }, updateDelay, updateDelay);
       
        if (siblingTemporaryFolders != null
            && siblingTemporaryFolders.length > 0) {
          // Launch a timer that will delete in 10 min temporary folders older than a week
          final long deleteDelay = 10 * 60000;
          final long age = 7 * 24 * 3600000;
          new Timer(true).schedule(new TimerTask() {
              @Override
              public void run() {
                long now = System.currentTimeMillis();
                for (File siblingTemporaryFolder : siblingTemporaryFolders) {
                  if (siblingTemporaryFolder.exists()
View Full Code Here

      this.timer = null;
    }
    int autoSaveDelayForRecovery = this.application.getUserPreferences().getAutoSaveDelayForRecovery();
    if (autoSaveDelayForRecovery > 0) {
      this.timer = new Timer("autoSaveTimer", true);
      TimerTask task = new TimerTask() {
        @Override
        public void run() {
          if (System.currentTimeMillis() - lastAutoSaveTime > MINIMUM_DELAY_BETWEEN_AUTO_SAVE_OPERATIONS) {
            cloneAndSaveHomes();
          }
View Full Code Here

        public void onRequest(final IHttpExchange exchange) throws IOException, BadMessageException {
            receivedRequests.incrementAndGet();
           
            int delay = exchange.getRequest().getIntParameter("delay", 0);
                   
            TimerTask task = new TimerTask() {
                @Override
                public void run() {
                    try {
                        exchange.send(new HttpResponse(200, "text/plain", "OK"));
                    } catch (IOException ioe) {
View Full Code Here

      }
    }

   
    protected final void sendLater(int delayMillis, final IHttpRequest request) {
      TimerTask task = new TimerTask() {
        @Override
        public void run() {
          sendNow(request);
        }
      };
View Full Code Here

                // sending the response header
                final BodyDataSink sink = exchange.send(new HttpResponseHeader(200, "text/event-stream"));

               
                TimerTask tt = new TimerTask() {

                    private int id = Integer.parseInt(exchange.getRequest().getHeader("Last-Event-Id", "0"));
                   
                    public void run() {
                        try {
View Full Code Here

                // sending the response header
                final BodyDataSink sink = exchange.send(new HttpResponseHeader(200, "text/event-stream"));

               
                TimerTask tt = new TimerTask() {

                    private int id = Integer.parseInt(exchange.getRequest().getHeader("Last-Event-Id", "0"));
                   
                    public void run() {
                        try {
View Full Code Here

                final String idString = exchange.getRequest().getHeader("Last-Event-Id", "0");

                // sending the response header
                final BodyDataSink sink = exchange.send(new HttpResponseHeader(200, "text/event-stream"));

                TimerTask tt = new TimerTask() {

                    private int id = Integer.parseInt(idString);
                   
                    public void run() {
                        try {
View Full Code Here

                final String idString = exchange.getRequest().getHeader("Last-Event-Id", "0");

                // sending the response header
                final BodyDataSink sink = exchange.send(new HttpResponseHeader(200, "text/event-stream"));

                TimerTask tt = new TimerTask() {

                    private int id = Integer.parseInt(idString);
                   
                    public void run() {
                        try {
View Full Code Here

TOP

Related Classes of java.util.TimerTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.