handled = buffer.offer(m, 0);
handled = buffer.offer(processMessage(md), 0);
   public synchronized void handleCallback(Callback callback) throws HandleCallbackException   {      if (log.isTraceEnabled()) { log.trace("receiving message " + callback.getParameter() + " from the remoting layer"); }      if (closed)      {         log.warn("Consumer is closed - ignoring message");         //Note - we do not cancel the message if the handler is closed.         //If the handler is closed then the corresponding serverconsumerdelegate         //is either already closed or about to close, in which case it's deliveries         //will be cancelled anyway.         return;      }            Message m = (Message)callback.getParameter();            if (listener != null)      {         //Queue the message to be delivered by the session         ClientDeliveryRunnable cdr = new ClientDeliveryRunnable(this, processMessage(m));         try         {            onMessageExecutor.execute(cdr);         }         catch (InterruptedException e)         {            log.error("Thread was interrupted, cancelling message", e);            cancelMessage(m);         }      }      else      {                                          try         {                                //We attempt to put the message in the Channel            //The call will return false if the message is not picked up the receiving or listening            //thread in which case we need to cancel it                        boolean handled = false;            while (waiting)            {               //channel.offer will *only* return true if there is a thread waiting to take a               //message using take() or poll() hence we can guarantee there is no chance any               //messages can arrive and are left in the channel without being handled -  this is               //why we use a SynchronousChannel :)                              //We do this in a while loop to deal with a possible race condition where               //waiting had been set but the main consumer thread hadn't quite blocked on the call               //to take or poll from the channel                              handled = buffer.offer(m, 0);                                             if (handled)               {                  break;               }                               //ust yield to other threads - otherwise all CPU is eaten in this loop and everything               //slows down               Thread.yield();                           }                        if (!handled)            {               log.info("Not handled!");               //There is no-one waiting for our message so we cancel it               if (!closed)               {                  cancelMessage(m);               }            }                       }         catch(InterruptedException e)         {            String msg = "Interrupted attempt to put message in the delivery buffer";            log.error(msg);            throw new HandleCallbackException(msg, e);         }      }         }