Package java.util

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


        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

  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

        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

    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

            return true;
        }
        if(timer.getNumberOfScheduled() >= limitSched) {
            return false;
        }
        final TimerTask cancel = new TimerTask() {
            public void run() {
                if(activeCount.get() < 1) {
                    closeQuietly(channels);
                }
            }
View Full Code Here

   private void scheduleAutocloseTask() {
       final int delay = COConfigurationManager.getIntParameter("Message Popup Autoclose in Seconds") * 1000;
        if(delay < 1000)
            return;

       closeTimer.scheduleAtFixedRate(new TimerTask() {
           public void run() {
               display.syncExec(new AERunnable() {
                    public void runSupport() {
                        if(shell.isDisposed()) {
                            closeTimer.cancel();
View Full Code Here

    synchronized (this) {
      accumulator+=zoomIncrement;
      if (zoomAccumulator!=null) return;
      zoomAccumulator = new Timer();
      zoomAccumulator.schedule(new TimerTask() {
        public void run() {
          int accuCopy;
          synchronized (Frame3DJava3D.this) {
            accuCopy = accumulator;
            accumulator = 0;
View Full Code Here

      synchronized(timerLock){
        if(timer!=null){
          return; // there is a timer let it do its job
        }
        timer = new Timer(true); // do not block the application on exit 
        timer.schedule(new TimerTask() {
        public void run() {
          int n=0;
          synchronized(paintedAreas){
            Iterator it=paintedAreas.keySet().iterator();
            if(!it.hasNext()){
View Full Code Here

    public void start() {
        if (isRunning()) {
            return;
        }
        timer = new Timer(true); // do not block the application on exit
        timer.scheduleAtFixedRate(new TimerTask() {
            public void run() {
                try {
                    step();
                } catch (DataException e) {
                    if (autoStop && (e instanceof NoSuchIndex)) {
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.