On 30/06/2009, [email protected] <[email protected]> wrote:
> Author: rjung
> Date: Tue Jun 30 13:26:10 2009
> New Revision: 789714
>
> URL: http://svn.apache.org/viewvc?rev=789714&view=rev
> Log:
> Separate statistics counter lock in FastAsyncSocketSender
> from inherited DataSender lock to reduce blocking during
> failed node detection.
>
> Backport of http://svn.apache.org/viewvc?rev=759694&view=rev
> from OACC to tc5.5.x.
>
> Modified:
>
> tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java
> tomcat/container/tc5.5.x/webapps/docs/changelog.xml
> tomcat/current/tc5.5.x/STATUS.txt
>
> Modified:
> tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java
> URL:
> http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java?rev=789714&r1=789713&r2=789714&view=diff
>
> ==============================================================================
> ---
> tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java
> (original)
> +++
> tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java
> Tue Jun 30 13:26:10 2009
> @@ -91,6 +91,13 @@
>
> private int threadPriority = Thread.NORM_PRIORITY;;
>
> + /**
> + * Separate mutex for our local state.
> + * We keep the synchronization independent of the synchronization
> + * in the super class DataSender.
> + */
> + private Object mutex = new Object();
Should be final as well to indicate that it must never be changed and
to ensure safe publication across threads.
> // -------------------------------------------------------------
> Constructor
>
> /**
> @@ -353,7 +360,7 @@
> public void sendMessage(ClusterData data)
> throws java.io.IOException {
> queue.add(data.getUniqueId(), data);
> - synchronized (this) {
> + synchronized (mutex) {
> inQueueCounter++;
> if(queueThread != null)
> queueThread.incQueuedNrOfBytes(data.getMessage().length);
> @@ -455,15 +462,15 @@
> return queuedNrOfBytes;
> }
>
> - protected synchronized void setQueuedNrOfBytes(long
> queuedNrOfBytes) {
> + protected void setQueuedNrOfBytes(long queuedNrOfBytes) {
> this.queuedNrOfBytes = queuedNrOfBytes;
> }
>
> - protected synchronized void incQueuedNrOfBytes(long size) {
> + protected void incQueuedNrOfBytes(long size) {
> queuedNrOfBytes += size;
> }
>
> - protected synchronized void decQueuedNrOfBytes(long size) {
> + protected void decQueuedNrOfBytes(long size) {
> queuedNrOfBytes -= size;
> }
>
> @@ -561,8 +568,10 @@
> .getKey()), x);
> }
> } finally {
> - outQueueCounter++;
> - decQueuedNrOfBytes(messagesize);
> + synchronized (sender.mutex) {
> + outQueueCounter++;
> + decQueuedNrOfBytes(messagesize);
> + }
> }
> entry = entry.next();
> } while (keepRunning && entry != null);
>
> Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
> URL:
> http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=789714&r1=789713&r2=789714&view=diff
>
> ==============================================================================
> --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
> +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Tue Jun 30 13:26:10
> 2009
> @@ -195,6 +195,10 @@
> <subsection name="Cluster">
> <changelog>
> <fix>
> + Separate statistics counter lock in FastAsyncSocketSender from
> inherited
> + DataSender lock to reduce blocking during failed node detection.
> (rjung)
> + </fix>
> + <fix>
> Handle situation session ID rewriting on fail-over with parallel
> requests
> from the same client. (pero)
> </fix>
>
> Modified: tomcat/current/tc5.5.x/STATUS.txt
> URL:
> http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=789714&r1=789713&r2=789714&view=diff
>
> ==============================================================================
> --- tomcat/current/tc5.5.x/STATUS.txt (original)
> +++ tomcat/current/tc5.5.x/STATUS.txt Tue Jun 30 13:26:10 2009
> @@ -33,17 +33,6 @@
> -1: markt (see https://issues.apache.org/bugzilla/show_bug.cgi?id=47308)
> kkolinko: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4686717
>
> -* Fix locking in cluster/tcp/FastAsyncSocketSender:
> - Locking in DataSender and the sub class FastAsyncSocketSender
> - uses the same lock, although the reasons for locking are totally
> - independent. This leads to a problem between a node crash
> - and the final disappear detection of membership.
> - For details see the log messages of r759694.
> - Port of http://svn.apache.org/viewvc?rev=759694&view=rev
> - from OACC to tc5.5.x.
> - +1: rjung, pero, kkolinko
> - -1:
> -
> * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46384
> Use sync when adding and removing members
> Note: Untested
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]