You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/03/11 21:01:28 UTC

svn commit: r1665989 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Author: markt
Date: Wed Mar 11 20:01:28 2015
New Revision: 1665989

URL: http://svn.apache.org/r1665989
Log:
Add a comment

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1665989&r1=1665988&r2=1665989&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar 11 20:01:28 2015
@@ -1512,6 +1512,11 @@ public class AprEndpoint extends Abstrac
         }
 
 
+        /*
+         * This is only called from the SocketWrapper to ensure that it is only
+         * called once per socket. Calling it more than once typically results
+         * in the JVM crash.
+         */
         protected void close(long socket) {
             synchronized (this) {
                 closeList.add(socket, 0, 0);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1665989 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Posted by Mark Thomas <ma...@apache.org>.
On 11/03/2015 20:27, Christopher Schultz wrote:
> Mark,
> 
> On 3/11/15 4:01 PM, markt@apache.org wrote:
>> Author: markt
>> Date: Wed Mar 11 20:01:28 2015
>> New Revision: 1665989
>>
>> URL: http://svn.apache.org/r1665989
>> Log:
>> Add a comment
>>
>> Modified:
>>     tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
>>
>> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
>> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1665989&r1=1665988&r2=1665989&view=diff
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
>> +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar 11 20:01:28 2015
>> @@ -1512,6 +1512,11 @@ public class AprEndpoint extends Abstrac
>>          }
>>  
>>  
>> +        /*
>> +         * This is only called from the SocketWrapper to ensure that it is only
>> +         * called once per socket. Calling it more than once typically results
>> +         * in the JVM crash.
>> +         */
>>          protected void close(long socket) {
>>              synchronized (this) {
>>                  closeList.add(socket, 0, 0);
> 
> Is there a reason to prefer synchronized(this) here to simply using a
> synchronized method?

Nope. Just poor clean up on my part.

> As for an architectural comment: if only the SocketWrapper should be
> calling that method, should the method not exist elsewhere... or with
> some other kind of access strategy?

I think the best I can do is make it private.

Thanks for the review.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1665989 - /tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,

On 3/11/15 4:01 PM, markt@apache.org wrote:
> Author: markt
> Date: Wed Mar 11 20:01:28 2015
> New Revision: 1665989
> 
> URL: http://svn.apache.org/r1665989
> Log:
> Add a comment
> 
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> 
> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1665989&r1=1665988&r2=1665989&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Wed Mar 11 20:01:28 2015
> @@ -1512,6 +1512,11 @@ public class AprEndpoint extends Abstrac
>          }
>  
>  
> +        /*
> +         * This is only called from the SocketWrapper to ensure that it is only
> +         * called once per socket. Calling it more than once typically results
> +         * in the JVM crash.
> +         */
>          protected void close(long socket) {
>              synchronized (this) {
>                  closeList.add(socket, 0, 0);

Is there a reason to prefer synchronized(this) here to simply using a
synchronized method?

As for an architectural comment: if only the SocketWrapper should be
calling that method, should the method not exist elsewhere... or with
some other kind of access strategy?

-chris