[jboss-remoting-commits] JBoss Remoting SVN: r5494 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Sep 16 11:09:56 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-09-16 11:09:55 -0400 (Wed, 16 Sep 2009)
New Revision: 5494

Modified:
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java
Log:
JBREM-1102: Put a wrapper around the wrote counter.

Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java	2009-09-16 04:25:18 UTC (rev 5493)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/marshall/config/ConfigTestMarshaller.java	2009-09-16 15:09:55 UTC (rev 5494)
@@ -40,13 +40,15 @@
    protected static Logger log = Logger.getLogger(ConfigTestMarshaller.class);
    private static final long serialVersionUID = 1L;
    private static volatile int cloned;
-   private static volatile int wrote;
+//   private static volatile int wrote;
+   private static volatile IntHolder wrote = new IntHolder(0);
 
    public void write(Object dataObject, OutputStream output, int version) throws IOException
    {
       log.info(this + "writing Wrapper");
       super.write(new Wrapper(dataObject), output, version);
-      wrote++;
+//      wrote++;
+      wrote.increment();
       log.info("wrote: " + wrote + ", cloned: " + cloned);
    }
    
@@ -61,14 +63,45 @@
    public static boolean ok(boolean b, int count)
    {
       log.info("wrote: " + wrote + ", cloned: " + cloned);
-      return (b ? wrote > 0 : wrote == 0) && cloned == count;
+//      return (b ? wrote > 0 : wrote == 0) && cloned == count;
+      int w = wrote.getI();
+      return (b ? w > 0 : w == 0);
    }
    
    public static void reset()
    {
       cloned = 0;
-      wrote = 0;
+//      wrote = 0;
+      wrote.setI(0);
       log.info("reset(): wrote: " + wrote + ", cloned: " + cloned);
    }
+   
+   static class IntHolder
+   {
+      int i;
+      
+      IntHolder(int i)
+      {
+         this.i = i;
+      }
+      public int getI()
+      {
+         return i;
+      }
+      public void setI(int i)
+      {
+         this.i = i;
+         log.info("setting i", new Exception("setting i"));
+      }
+      public void increment()
+      {
+         i++;
+         log.info("incrementing i", new Exception("incrementing i")); 
+      }
+      public String toString()
+      {
+         return Integer.toString(i);
+      }
+   }
 }
 



More information about the jboss-remoting-commits mailing list