[ 
https://issues.apache.org/jira/browse/GERONIMO-3761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561481#action_12561481
 ] 

Sangjin Lee commented on GERONIMO-3761:
---------------------------------------

I uploaded a modified patch.  This still needs discussions and a few details 
that need to be worked out.  The changes here are -- 

- I rewrote the EventQueue class to use an Executor.  Since the Executor 
implementation provided by the JDK is basically a thread pool associated with a 
task queue, it provides an identical functionality to what was in EventQueue.  
I think that it is good to use the constructs from java.util.concurrent.* 
whenever it makes sense, and I believe this is one of them.

- This change also enables us to remove "synchronized" from 
notifyMonitoringListener().  The notify method will be called very often and 
concurrently, and reducing the lock contention will be important.  Using an 
Executor makes it possible to eliminate synchronization, at least at that level.

- I associated a shared thread pool (Executor) for all dispatchers.  I think it 
is desirable for dispatchers to share this thread pool rather than each 
instance of dispatchers creating and maintaining its own thread.

- Renamed EventQueue to EventDispatcher.

- I also moved the monitoring listener list to EventDispatcher.  I also used 
CopyOnWriteArrayList as the implementation for the list.  CopyOnWriteArrayList 
is an ideal choice for this as it is thread safe and lock-free.  Also, our use 
case is heavy read-access but very infrequent write-access, which 
CopyOnWriteArrayList is suitable for.

- I moved the connection_failed notification to before the getSession() call.  
The getSession() call here always throws an exception (by design), and thus 
notification needs to be done before calling getSession().

- I rewrote the CountingMonitor to use AtomicIntegers.  This should be slightly 
safer.

- I changed the timestamp calls from System.currentTimeMillis() to 
System.nanoTime()/1000000.  The nanoTime() call is more high-res, as 
currentTimeMillis() may be tens of milliseconds accurate on some platforms, and 
thus not suitable for these measurements.

> Add data collection and instrumentation to the AsyncHttpClient
> --------------------------------------------------------------
>
>                 Key: GERONIMO-3761
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-3761
>             Project: Geronimo
>          Issue Type: New Feature
>      Security Level: public(Regular issues) 
>          Components: AsyncHttpClient
>            Reporter: Rick McGuire
>         Attachments: GERONIMO-3761-v2.patch, GERONIMO-3761.patch
>
>
> There's been some discussion on the dev list about adding some 
> instrumentation to the AsyncHttpClient.  This is for tracking these 
> additions.   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to