Code example for ArrayBlockingQueue

Methods: offer

0
    public ClusterService(Node node){
        this.node = node;
    } 
    public void enqueuePacket(Packet p) {
        logger.debug("Packet enqueue"); 
        inPacket.offer(p);
        if(Debug.DEBUG){ 
        } 
    } 
 
    @Override 
    public void run() { 
        // TODO Auto-generated method stub 
        Packet m;
        try { 
            while ((m = inPacket.take()) != null) {
                node.messageManager.handledPacket(m);
            } 
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block 
            e.printStackTrace();