Code example for ConcurrentLinkedQueue

Methods: add

0
            req.getAsyncContext().complete();
        } else if (req.isAsyncSupported()) {
            AsyncContext actx = req.startAsync();
            actx.addListener(this);
            resp.setContentType("text/plain");
            clients.add(actx);
            if (clientcount.incrementAndGet()==1) {
                ticker.addTickListener(this);
            } 
        } else { 
            new Exception("Async Not Supported").printStackTrace();
            resp.sendError(400,"Async is not supported.");
        } 
    } 
 
 
    @Override 
    public void tick(Stock stock) {
        ticks.add((Stock)stock.clone());
        Iterator<AsyncContext> it = clients.iterator();
        while (it.hasNext()) {