Package java.util

Examples of java.util.TimerTask


    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        final long started = lastInsert = System.currentTimeMillis();
        if (!getSelectionWindow().isVisible()) {
          if (isAnyValueStartingWith(getLastWord())) {
            new Timer(true).schedule(new TimerTask() {
              public void run() {
                if (lastInsert == started
                    && !getSelectionWindow().isVisible()) {
                  model.fireChange();
                  showWindow();
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

     
        // 100-continue response expected?
            if (HttpUtils.isContainExpect100ContinueHeader(requestHeader)) {
                is100ContinueExpected = true;
                is100ResponseNotified = false;
                missing100ResponseHandler = new TimerTask() {
                   
                    @Override
                    public void run() {
                        cancel();
                       
View Full Code Here

            this.broker = broker;
        }
       
        public void onTopicAppears(final String topic) {
           
            TimerTask task = new TimerTask() {
           
                @Override
                public void run() {
                    Set<IWebSocketConnection> cons = broker.retrieve(topic);
                    for (IWebSocketConnection con : cons) {
                        try {
                            Event event = new Event("REVISION_CHANGED", topic, "old=35", "new=65");
                            con.writeMessage(new TextMessage(event.toString()));
                        } catch (IOException ioe) {
                            broker.deregister(topic, con);
                            con.closeQuitly();
                        }
                    }
                }
            };
           
            TimerTask oldTask;
            synchronized (openTasks) {
                oldTask = openTasks.put(topic, task);
            }
           
            if (oldTask != null) {
                oldTask.cancel();
            }
           
            timer.schedule(task, 1000, 1000);
        }
View Full Code Here

        }
       
       
        public void onTopicDisappears(String topic) {

            TimerTask task;
            synchronized (openTasks) {
                task = openTasks.remove(topic);
            }
           
            if (task != null) {
                task.cancel();
            }
        }
View Full Code Here

    public void launch(String host, int port, int waittime, int maxActive) throws Exception {
     
      System.out.println("calling " + host + ":" + port + " (waitime between requests " + waittime + " millis; maxActive=" + maxActive + ")");
     
      TimerTask printTask = new TimerTask() {
       
        @Override
        public void run() {
          printRate();
        }
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

        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

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

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.