Package java.util

Examples of java.util.TimerTask


    this.adminSecurityDomains.add(domain);
    LogManager.logInfo(LogConstants.CTX_SECURITY, "Admin Security Enabled: true"); //$NON-NLS-1$
  }

  public void start() {
        this.sessionMonitor.schedule(new TimerTask() {
          @Override
          public void run() {
            monitorSessions();
          }
        }, 0, ServerConnection.PING_INTERVAL * 5);
 
View Full Code Here


  protected void startTimer() {
    if (mRefreshListTimer != null) {
      mRefreshListTimer.cancel();
    }
    mRefreshListTimer = new Timer("Refresh channel list");
    mRefreshListTimer.schedule(new TimerTask() {
      public void run() {
        if (!mListUpdating) {
          mListUpdating = true;
          fillAvailableChannelsListBox();
          mListUpdating = false;
View Full Code Here

  public void stopEndPoints () {
    stopEndPoints(0);
  }

  public void stopEndPoints (int stopAfterMillis) {
    timer.schedule(new TimerTask() {
      public void run () {
        for (EndPoint endPoint : endPoints)
          endPoint.stop();
        endPoints.clear();
      }
View Full Code Here

    waitForThreads();
  }

  public void waitForThreads () {
    fail = false;
    TimerTask failTask = new TimerTask() {
      public void run () {
        stopEndPoints();
        fail = true;
      }
    };
    timer.schedule(failTask, 11000);
    while (true) {
      for (Iterator iter = threads.iterator(); iter.hasNext();) {
        Thread thread = (Thread)iter.next();
        if (!thread.isAlive()) iter.remove();
      }
      if (threads.isEmpty()) break;
      try {
        Thread.sleep(100);
      } catch (InterruptedException ignored) {
      }
    }
    failTask.cancel();
    if (fail) fail("Test did not complete in a timely manner.");
    // Give sockets a chance to close before starting the next test.
    try {
      Thread.sleep(1000);
    } catch (InterruptedException ignored) {
View Full Code Here

          Timer currentTimer = siteInfo.getUserTimer(individualId);
          if (currentTimer != null) {
            currentTimer.cancel();
          }

          TimerTask currentTask = siteInfo.getUserTask(individualId);
          if (currentTask != null) {
            currentTask.cancel();
          }

          Timer newTimer = new Timer(true);
          TimerTask userEmailCheck = new UserEmailCheck(individualId, session, dataSource, host);
          newTimer.schedule(userEmailCheck, 300000L, interval.longValue());
          siteInfo.setUserTimer(individualId, newTimer, userEmailCheck);
        }

        // code added for concurrent user maintinance
View Full Code Here

            } 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

      // 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

  }
 
  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

          // "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

        .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

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.