users@shoal.java.net

Re: [Shoal-Users] Shoal binaries updated to latest promoted build

From: Joseph Fialli <Joseph.Fialli_at_Sun.COM>
Date: Fri, 24 Oct 2008 11:35:26 -0400

Olaf Krische wrote:
> Hello :-)
>
> On Thu, Oct 23, 2008 at 05:21:36PM -0700, Shreedhar Ganapathy wrote:
>
>> * Partial fix for Shoal issue : [10]79 : DistributedStateCacheImpl
>> not thread safe.
>>
>
> Hm? As far as i can see from the current cvs HEAD, no partial fix regarding that has been included. :P
>
I can clear up the confusion over this issue.

I mistakenly quoted shoal issue 79 instead of the proper shoal issue 78
in the commit message on Oct. 1.
There were fixes in DistributedStateCacheImpl.java but they only had to
do with placing log messages inside
of if (LOG.isLoggable(Level.XXXX).
I have attached that checkin, there is no mention of addressing
concurrency in the commit message.
So there was a misunderstanding based on my incorrect quoting of the
shoal issue in the putback.

I have verified Olaf's patch for shoal issue 79 but was awaiting word
that the contributor's agreement has been signed before checking
in the patch submitted for shoal issue 79. (which I would like to get
done.)

-Joe
> Btw, is there any interest to re-structure the project to a maven2 project using the default project layout?
> The main thing to be changed would be to move src/java/* to src/main/java/* and tests/* to src/test/java/*,
> creating a pom.xml, and changing build.xml and maven.xml accordingly?
>
> Ciao.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_shoal.dev.java.net
> For additional commands, e-mail: users-help_at_shoal.dev.java.net
>
>


attached mail follows:



User: jfialli
Date: 2008-10-01 16:54:05+0000
Modified:
   shoal/gms/src/java/com/sun/enterprise/ee/cms/impl/jxta/DistributedStateCacheImpl.java
   shoal/gms/src/java/com/sun/enterprise/ee/cms/impl/jxta/MessageWindow.java

Log:
 Partial Fix for shoal issue 79, add isLoggable around all log messages that are lower than warning AND have string concatenation in parameters
 passed to logger.log. Only did this for DistributedStateCache logging messages for the time being. More thorough treatment to be done in future.
 Reviewed by Sheetal.

File Changes:

Directory: /shoal/gms/src/java/com/sun/enterprise/ee/cms/impl/jxta/
===================================================================

File [changed]: DistributedStateCacheImpl.java
Url: https://shoal.dev.java.net/source/browse/shoal/gms/src/java/com/sun/enterprise/ee/cms/impl/jxta/DistributedStateCacheImpl.java?r1=1.19&r2=1.20
Delta lines: +32 -32
---------------------
--- DistributedStateCacheImpl.java 2008-04-08 23:42:34+0000 1.19
+++ DistributedStateCacheImpl.java 2008-10-01 16:54:02+0000 1.20
@@ -82,7 +82,7 @@
  *
  * @author Shreedhar Ganapathy
  * Date: June 20, 2006
- * @version $Revision: 1.19 $
+ * @version $Revision: 1.20 $
  */
 public class DistributedStateCacheImpl implements DistributedStateCache {
     private final ConcurrentHashMap<GMSCacheable, Object> cache =
@@ -120,9 +120,11 @@
             final String componentName, final String memberTokenId,
             final Serializable key, final Serializable state)
             throws GMSException {
+ if (logger.isLoggable(Level.FINER)) {
         logger.log(Level.FINER, "Adding to DSC by local Member:" + memberTokenId +
                 ",Component:" + componentName + ",key:" + key +
                 ",State:" + state);
+ }
         final GMSCacheable cKey = createCompositeKey(componentName,
                 memberTokenId,
                 key);
@@ -135,7 +137,9 @@
                            final Serializable key,
                            final byte[] state)
             throws GMSException {
- logger.log(Level.FINER, new StringBuilder().append("Adding to DSC by local Member:").append(memberTokenId).append(",Component:").append(componentName).append(",key:").append(key).append(",State:").append(state).toString());
+ if (logger.isLoggable(FINER)) {
+ logger.log(FINER, new StringBuilder().append("Adding to DSC by local Member:").append(memberTokenId).append(",Component:").append(componentName).append(",key:").append(key).append(",State:").append(state).toString());
+ }
         final GMSCacheable cKey = createCompositeKey(componentName,
                 memberTokenId,
                 key);
@@ -170,14 +174,18 @@
     public void addToLocalCache(GMSCacheable cKey,
                                 final Object state) {
         cKey = getTrueKey(cKey);
+ if (logger.isLoggable(Level.FINEST)) {
         logger.log(Level.FINEST, "Adding cKey="+cKey.toString()+" state="+state.toString());
+ }
         cache.put(cKey, state);
         printDSCContents();
     }
 
     private void printDSCContents () {
- logger.log(FINER, getGMSContext().getServerIdentityToken()+
- ":DSC now contains ---------\n"+getDSCContents());
+ if (logger.isLoggable(FINER)) {
+ logger.log(FINER, getGMSContext().getServerIdentityToken() +
+ ":DSC now contains ---------\n" + getDSCContents());
+ }
     }
 
     private GMSContext getGMSContext(){
@@ -271,8 +279,9 @@
     }
 
     public Map<Serializable, Serializable> getFromCacheForPattern(final String componentName, final String memberToken) {
-
+ if (logger.isLoggable(Level.FINE)) {
         logger.fine("DSCImpl.getCacheFromPattern() for " + memberToken);
+ }
         final Map<Serializable, Serializable> retval = new Hashtable<Serializable, Serializable>();
         if (componentName == null || memberToken == null) {
             return retval;
@@ -324,13 +333,10 @@
     public boolean contains(final Object key) {
         boolean retval = false;
         for (GMSCacheable c : cache.keySet()) {
+ if (logger.isLoggable(FINER)) {
             logger.log(FINER,
- new StringBuffer()
- .append("key=")
- .append(key)
- .append(" underlying key=")
- .append(c.getKey())
- .toString());
+ new StringBuffer().append("key=").append(key).append(" underlying key=").append(c.getKey()).toString());
+ }
             if (key.equals(c.getKey())) {
                 retval = true;
             }
@@ -341,20 +347,12 @@
     public boolean contains(final String componentName, final Object key) {
         boolean retval = false;
         for (GMSCacheable c : cache.keySet()) {
+ if (logger.isLoggable(FINER)) {
             logger.log(FINER,
- new StringBuffer()
- .append("comp=")
- .append(componentName)
- .append(" underlying comp=")
- .append(c.getComponentName())
- .toString());
+ new StringBuffer().append("comp=").append(componentName).append(" underlying comp=").append(c.getComponentName()).toString());
             logger.log(FINER,
- new StringBuffer()
- .append("key=")
- .append(key)
- .append(" underlying key=")
- .append(c.getKey())
- .toString());
+ new StringBuffer().append("key=").append(key).append(" underlying key=").append(c.getKey()).toString());
+ }
             if (key.equals(c.getKey())
                     &&
                     componentName.equals(c.getComponentName())) {
@@ -426,7 +424,9 @@
 
         final DSCMessage msg = new DSCMessage(temp, DSCMessage.OPERATION.ADDALLLOCAL.toString(), isCoordinator);
         if(!memberToken.equals(getGMSContext().getServerIdentityToken())){
- logger.log(Level.FINER, "Sending sync message from DistributedStateCache " + "to member " + memberToken);
+ if (logger.isLoggable(Level.FINER)) {
+ logger.log(Level.FINER, "Sending sync message from DistributedStateCache to member " + memberToken);
+ }
             sendMessage(memberToken, msg);
         }
         if (isCoordinator) {

File [changed]: MessageWindow.java
Url: https://shoal.dev.java.net/source/browse/shoal/gms/src/java/com/sun/enterprise/ee/cms/impl/jxta/MessageWindow.java?r1=1.16&r2=1.17
Delta lines: +14 -6
--------------------
--- MessageWindow.java 2008-09-04 17:59:36+0000 1.16
+++ MessageWindow.java 2008-10-01 16:54:02+0000 1.17
@@ -62,7 +62,7 @@
  *
  * @author Shreedhar Ganapathy
  * Date: Jul 11, 2006
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
  */
 public class MessageWindow implements Runnable {
     private Logger logger = GMSLogDomain.getLogger(GMSLogDomain.GMS_LOGGER);
@@ -111,14 +111,20 @@
     private void handleDSCMessage(final DSCMessage dMsg, final String token) {
 
         final String ops = dMsg.getOperation();
+ if (logger.isLoggable(Level.FINER)) {
         logger.log(Level.FINER, MessageFormat.format("DSCMessageReceived from :{0}, Operation :{1}", token, ops));
+ }
         final DistributedStateCacheImpl dsc =
                 (DistributedStateCacheImpl) getGMSContext().getDistributedStateCache();
         if (ops.equals(DSCMessage.OPERATION.ADD.toString())) {
+ if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Adding Message: " + dMsg.getKey() + ":" + dMsg.getValue());
+ }
             dsc.addToLocalCache(dMsg.getKey(), dMsg.getValue());
         } else if (ops.equals(DSCMessage.OPERATION.REMOVE.toString())) {
+ if (logger.isLoggable(Level.FINER)) {
             logger.log(Level.FINER, "Removing Values with Key: " + dMsg.getKey());
+ }
             dsc.removeFromLocalCache(dMsg.getKey());
         } else if (ops.equals(DSCMessage.OPERATION.ADDALLLOCAL.toString())) {
             if (dMsg.isCoordinator()) {
@@ -165,7 +171,9 @@
 
     private void writeLog(final String sender, final com.sun.enterprise.ee.cms.spi.GMSMessage message) {
         final String localId = getGMSContext().getServerIdentityToken();
+ if (logger.isLoggable(Level.FINER)) {
         logger.log(Level.FINER, MessageFormat.format("Sender:{0}, Receiver :{1}, TargetComponent :{2}, Message :{3}",
                 sender, localId, message.getComponentName(), new String(message.getMessage())));
     }
+ }
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe_at_shoal.dev.java.net
For additional commands, e-mail: cvs-help_at_shoal.dev.java.net