river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter_firmst...@apache.org
Subject svn commit: r1484201 - in /river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing: LeasedSpaceListener.java UseNotifyLeaseTest.java
Date Sun, 19 May 2013 00:21:31 GMT
Author: peter_firmstone
Date: Sun May 19 00:21:31 2013
New Revision: 1484201

URL: http://svn.apache.org/r1484201
Log:
Suspect that arm test failure is caused by event arriving too fast and reset of listener not
atomic

Modified:
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/LeasedSpaceListener.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/UseNotifyLeaseTest.java

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/LeasedSpaceListener.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/LeasedSpaceListener.java?rev=1484201&r1=1484200&r2=1484201&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/LeasedSpaceListener.java
(original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/LeasedSpaceListener.java
Sun May 19 00:21:31 2013
@@ -75,11 +75,16 @@ public class LeasedSpaceListener
 	return new BasicProxyTrustVerifier(proxy);
     }
 
-    public synchronized void notify(RemoteEvent theEvent)
+    public void notify(RemoteEvent theEvent)
             throws UnknownEventException, RemoteException {
-	logger.log(Level.FINEST, "notify called at " + (new java.util.Date()));
-        received = true;
-        this.notifyAll();
+        // Perform logging outside the synchronized block so we don't affect
+        // timing.
+        java.util.Date date = new java.util.Date();
+        synchronized (this){
+            received = true;
+            this.notifyAll();
+        }
+        logger.log(Level.INFO, "notify called at {0}", date);
     }
 
     /**

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/UseNotifyLeaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/UseNotifyLeaseTest.java?rev=1484201&r1=1484200&r2=1484201&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/UseNotifyLeaseTest.java
(original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/leasing/UseNotifyLeaseTest.java
Sun May 19 00:21:31 2013
@@ -80,8 +80,6 @@ public class UseNotifyLeaseTest extends 
             synchronized (this){
                 listener = new LeasedSpaceListener(getConfig().getConfiguration());
                 space = (JavaSpace) services[0];
-                JavaSpace space = this.space;
-                LeasedSpaceListener listener = this.listener;
                 EventRegistration reg = space.notify(aEntry, null, listener,
                         durationRequest, null);
                 reg = (EventRegistration)
@@ -105,7 +103,10 @@ public class UseNotifyLeaseTest extends 
             synchronized (this){
                 logger.log(Level.FINEST, "Writing entry {0}", ++count);
                 synchronized (listener) {
-                    listener.setReceived(false);
+                    // This doesn't look atomic, if the event is sent too
+                    // quickly, this will just set it false.  Alternative;
+                    // reset listener immediately after we receive it.
+//                    listener.setReceived(false);
 
                     /*
                      * Important to have the write inside the
@@ -121,6 +122,8 @@ public class UseNotifyLeaseTest extends 
                         listener.wait(callbackWait);
                         if (listener.isReceived()){
                             logger.log(Level.FINEST, "Wait done at {0}, received = {1}",
new Object[]{new java.util.Date(), listener.isReceived()});
+                            // Reset listener, see comment above.
+                            listener.setReceived(false);
                             return true;
                         }
                     }



Mime
View raw message