Examples of TimerTask


Examples of java.util.TimerTask

            } catch (ServiceException e) {
                System.err.println(PrintUtils.prettyPrintStackTrace(e));
            }
        }
        if(timeout > 0) {
            TimerTask cancel = new TimerTask() {
                public void run() {
                    System.err.println("Execution Timeout: " + sw.toString());
                    System.exit(1);
                }
            };
View Full Code Here

Examples of java.util.TimerTask

      // minutes to seconds, then seconds to miliseconds...
      Integer interval = new Integer(supportInterval * 60 * 1000);
      // 600000L = 10 minutes * 60 seconds/minute * 1000 miliseconds/second
      // delay the first check for 10 minutes after the startup.
      // Just to give things time to settle down.
      TimerTask supportEmailTask = new SupportEmailCheck(dataSource);
      supportEmailTimer.schedule(supportEmailTask, 600000L, interval.longValue());
      siteInfo.setSupportEmailTask(supportEmailTask);
    }

    // now stick the Timer into the Settings Singleton so that
View Full Code Here

Examples of java.util.TimerTask

  }
 
  public void initialize(Properties info) {
    PropertiesUtils.setBeanProperties(this, info, "org.teiid.sockets"); //$NON-NLS-1$
    this.pingTimer = new Timer("SocketPing", true); //$NON-NLS-1$
    this.pingTimer.schedule(new TimerTask() {
     
      @Override
      public void run() {
        Set<Map.Entry<HostInfo, Set<SessionToken>>> sessionEntries = null;
        synchronized (sessions) {
View Full Code Here

Examples of java.util.TimerTask

          // "Oh we're not gonna take it... No, we ain't gonna take it... Oh we're not gonna take it anymore..."
        }
        SettingsInterface settings = Settings.getInstance();
        // re-schedule JOB because it is currently running and
        // we have changed the interval at which it executes
        TimerTask supportEmailTask = settings.getSupportEmailTask();
        Timer supportEmailTimer = settings.getSupportEmailTimer();
        // cancel the existing timer.
        if (supportEmailTask != null) {
          supportEmailTask.cancel();
        }
        if (supportEmailTimer != null) {
          supportEmailTimer.cancel();
        }
        // only re-schedule the job if the interval is greater than zero
        // a zero value means do not check support email ever
        if (formInterval.intValue() > 0) {
          // minutes to seconds, seconds to miliseconds
          Integer interval = new Integer(formInterval.intValue() * 60 * 1000);
          // then create a new Timer.
          Timer newSupportEmailTimer = new Timer(true);
          // wait a full two minutes for the next execution.
          TimerTask newSupportEmailTask = new SupportEmailCheck(dataSource);
          newSupportEmailTimer.schedule(newSupportEmailTask, 120000L, interval.longValue());
          // And store our reference.
          settings.setSupportEmailTimer(newSupportEmailTimer);
          settings.setSupportEmailTask(newSupportEmailTask);
        }
View Full Code Here

Examples of java.util.TimerTask

        .getCacheProvider("memcached");
    cacheProvider.setCacheServers("192.168.16.123:11211");
    cacheProvider.setExpiryTime(1000 * 10);
    cacheProvider.put("name", "www.cnoss.org");
    final Timer timer = new Timer();
    timer.schedule(new TimerTask() {
      @Override
      public void run() {
        Object name = cacheProvider.get("name");
        if (name == null)
          timer.cancel();
View Full Code Here

Examples of java.util.TimerTask

    final Label lbl = new Label(shell, SWT.NONE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    lbl.setLayoutData(gd);

    final TimerTask task = new TimerTask() {
      String lastText = "";

      public String formatString() {
        return "FP:\n" + dlData.sExplainFP + "\n" + "SR:" + dlData.sExplainSR
            + "\n" + "TRACE:\n" + dlData.sTrace;
      }

      public void setText(final String s) {
        lastText = s;

        txtFP.setText(s);
      }

      public void run() {
        if (shell.isDisposed())
          return;

        shell.getDisplay().syncExec(new Runnable() {
          public void run() {
            if (shell.isDisposed()) {
              return;
            }
            String s = formatString();
            if (s.compareTo(lastText) != 0) {
              if (lastText.length() == 0 || btnAutoRefresh.getSelection()
                  || btnRefresh.getData("Pressing") != null)
                setText(s);
              else
                lbl.setText("Information is outdated.  Press refresh.");
            } else {
              lbl.setText("");
            }
          }
        });
      }
    };
    btnAutoRefresh.addListener(SWT.MouseUp, new Listener() {
      public void handleEvent(Event event) {
        if (btnAutoRefresh.getSelection())
          lbl.setText("");
        task.run();
      }
    });

    btnRefresh.addListener(SWT.MouseUp, new Listener() {
      public void handleEvent(Event event) {
        btnRefresh.setData("Pressing", "1");
        task.run();
        btnRefresh.setData("Pressing", null);
      }
    });
   
    shell.addTraverseListener(new TraverseListener() {
View Full Code Here

Examples of java.util.TimerTask

        this.deadlockCheckPeriod = deadlockCheckPeriod;
    }

    public void start() {
        if(started.compareAndSet(false, true)) {
            threadCheck.schedule(new TimerTask() {
                public void run() {
                    checkForDeadlocks();
                }
            }, 10, deadlockCheckPeriod);
        }
View Full Code Here

Examples of java.util.TimerTask

  private  AbstractTableModel model;
 
  protected GStatistics(String name) {
    super(name);
   
    addTimerTask("Statistics update", UPDATE_REPEAT, new TimerTask() {
     
      public void run() {
//        logger.trace("Update");
        update(UPDATE_REPEAT);
      }
View Full Code Here

Examples of java.util.TimerTask

        public IPCExecutionListener(ClientProcess client) {
            this.client = client;

            //start a timer to periodically send our live output to our server
            liveOutputTimer = new Timer();
            liveOutputTimer.scheduleAtFixedRate(new TimerTask() {
                @Override
                public void run() {
                    sendLiveOutput();
                }
            }, 500, 500);
View Full Code Here

Examples of java.util.TimerTask

    public static void schduleCloseQuietly(final Timer timer, final long delay, final Closeable... channels) {
        if(delay == 0) {
            closeQuietly(channels);
            return;
        }
        final TimerTask cancel = new TimerTask() {
            @Override
            public void run() {
                closeQuietly(channels);
            }
        };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.