users@grizzly.java.net

Re: How to use TCPNIOAsyncQueueReader?

From: yelingbug <yelingbug_at_163.com>
Date: Mon, 5 Sep 2011 19:55:47 -0700 (PDT)

Hi!
  Thanks for you replying.
  
  But I still have a question about 'AbstractNIOAsyncQueueReader' used in
'StandaloneProcessor'.

  For pieces of code as following:

    StandaloneProcessor#process(Context context):
           .......
           */ if (reader.isReady(connection)) {
                reader.processAsync(connection);/
            }*
           ......

    AbstractNIOAsyncQueueReader#processAsync(Connection connection):
           .........
          * /
           final Queue<AsyncReadQueueRecord> queue =
connectionQueue.getQueue();
           final AtomicReference<AsyncReadQueueRecord> currentElement =
                connectionQueue.getCurrentElementAtomic();
           AsyncReadQueueRecord queueRecord = currentElement.get();
--------(1)
           if (queueRecord == LOCK_RECORD) return;

           try {
             while (queueRecord != null) {
--------(2)
            ...........
           }/*

   When execution gets to (2), I think that it will never get into the loop,
because the variable
   of 'queueRecord' may always be null as there can't find any other places
to initialize or set
   'queueRecord' like

              */getCurrentElementAtomic().set(...)/*

    so am I right?


yelingbug.
        
  

--
View this message in context: http://grizzly.1045725.n5.nabble.com/How-to-use-TCPNIOAsyncQueueReader-tp4769708p4772975.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.