Package java.util

Examples of java.util.TimerTask


                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

        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

            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("connection is terminated. Try to reconnect to "  + uriString);
            }

            TimerTask reconnectTask = new TimerTask() {
               
                public void run() {
                    try {
                        if (LOG.isLoggable(Level.FINE)) {
                            LOG.fine("try reconnect " + uriString);
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

    public Event pollDelayed(final int milli) {

        final SuspendInfo info = suspend();

        Timer t = new Timer();
        t.schedule(new TimerTask() {
            @Override
            public void run() {
                try {
                    info.writeAndResume(new Event(milli, "Polling: Delayed event"));
                } catch (IOException e) {
View Full Code Here

        super.initialize(context);

        _tick = new Timer("AtmosphereContinuationBayeux-" + __id++, true);
        _timeout = new Timeout();

        _tick.schedule(new TimerTask() {
            @Override
            public void run() {
                _now = System.currentTimeMillis();
                _timeout.tick(_now);
            }
View Full Code Here

      domFactory = DocumentBuilderFactory.newInstance();                        // init
      domBuilder = domFactory.newDocumentBuilder();
    } catch (Exception e) {
      retVal=false;
    }
    tt = new TimerTask() {
      public void run() {
        Thread.currentThread().setPriority(Thread.MIN_PRIORITY);                // don't disturb other things going on
        createXML();
      }
    };
View Full Code Here

            throw new IllegalArgumentException("keyedPool must not be null.");
        }
        if (minIdle < 0) {
            throw new IllegalArgumentException("minIdle must be non-negative.");
        }
        final TimerTask task = new ObjectPoolMinIdleTimerTask(pool, minIdle);
        getMinIdleTimer().schedule(task, 0L, period);
        return task;
    }
View Full Code Here

            throw new IllegalArgumentException("key must not be null.");
        }
        if (minIdle < 0) {
            throw new IllegalArgumentException("minIdle must be non-negative.");
        }
        final TimerTask task = new KeyedObjectPoolMinIdleTimerTask(keyedPool, key, minIdle);
        getMinIdleTimer().schedule(task, 0L, period);
        return task;
    }
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.