You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2013/05/23 15:35:42 UTC

svn commit: r1485700 - in /river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test: impl/fiddler/ impl/norm/ impl/outrigger/matching/ impl/outrigger/notify/ share/ spec/discoveryservice/ spec/discoveryservice/lease/ spec/javaspace/conformance/ spec...

Author: peter_firmstone
Date: Thu May 23 13:35:41 2013
New Revision: 1485700

URL: http://svn.apache.org/r1485700
Log:
River-420 Fixes for unsafe publication by exporting during construction.

The low hanging fruit from the qa suite.

Modified:
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/fiddler/ProxyToString.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/AddRenewRemoveTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/BatchRenewTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/ExpiredLeaseTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseBackEndImpl.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseExpirationTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LocalLease.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoteListener.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoveExactlyOneTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewAtTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewalFailureTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/ARemoteInterfaceImpl.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/JavaSpaceAuditor.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MatchTestBase.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MonitoredSpaceListener.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NotifyTestUtil.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/TestSpaceListener.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/notify/ThrowRuntimeException.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RememberingRemoteListener.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RemoteListener.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/AbstractBaseTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLease.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLeaseMap.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLease.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLeaseMap.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/NotifyCounter.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/ParticipantImpl.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TestEventListener05.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeIfExistsTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeIfExistsTest.java
    river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeTest.java

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/fiddler/ProxyToString.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/fiddler/ProxyToString.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/fiddler/ProxyToString.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/fiddler/ProxyToString.java Thu May 23 13:35:41 2013
@@ -78,10 +78,11 @@ public class ProxyToString extends Abstr
                 fiddlerAdminProxy = (FiddlerAdmin)admin;
             }//endif
         }//endif
-
-        fiddlerRegistration = DiscoveryServiceUtil.getRegistration
+        DiscoveryServiceUtil.BasicEventListener listener = new DiscoveryServiceUtil.BasicEventListener();
+        listener.export();
+        fiddlerRegistration = DiscoveryServiceUtil.getRegistration 
                                (fiddlerProxy,
-                                new DiscoveryServiceUtil.BasicEventListener());
+                                listener);
 
         fiddlerLease = getPreparedLease(fiddlerRegistration);
         return this;

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/AddRenewRemoveTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/AddRenewRemoveTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/AddRenewRemoveTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/AddRenewRemoveTest.java Thu May 23 13:35:41 2013
@@ -103,6 +103,7 @@ public class AddRenewRemoveTest extends 
 	final long now = System.currentTimeMillis();
 
 	final LeaseBackEndImpl home = new LeaseBackEndImpl(1);
+        home.export();
 	final long initExp = now + renewGrant;
 	final RenewingOwner owner = new RenewingOwner(initExp, renewCount, 
 						    renewGrant,

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/BatchRenewTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/BatchRenewTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/BatchRenewTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/BatchRenewTest.java Thu May 23 13:35:41 2013
@@ -132,6 +132,7 @@ public class BatchRenewTest extends Test
 	// Create the object that will serve as the landlord
 	final BaseOwner owners[] = new BaseOwner[15];
 	final LeaseBackEndImpl home = new LeaseBackEndImpl(owners.length);
+        home.export();
 	int j = 0;
 
 	// Three Arg renewFors

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/ExpiredLeaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/ExpiredLeaseTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/ExpiredLeaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/ExpiredLeaseTest.java Thu May 23 13:35:41 2013
@@ -93,6 +93,7 @@ public class ExpiredLeaseTest extends Te
 
 	// Register for failure events
 	final OurListener listener = new OurListener();
+        listener.export();
 	final MarshalledObject handback = new MarshalledObject(new Long(347));
 	EventRegistration reg = 
 	    set.setRenewalFailureListener(listener, handback);

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseBackEndImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseBackEndImpl.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseBackEndImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseBackEndImpl.java Thu May 23 13:35:41 2013
@@ -34,6 +34,7 @@ import java.io.Serializable;
 
 import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
+import java.rmi.server.ExportException;
 
 import net.jini.export.Exporter;
 import net.jini.config.Configuration;
@@ -61,7 +62,9 @@ public class LeaseBackEndImpl implements
     private int idGen = 0;
 
     /** Our stub */
-    final private LeaseBackEnd stub;
+    private LeaseBackEnd stub;
+    
+    private final Exporter exporter;
 
     /** Total number of calls to renew */
     private long renewCalls;
@@ -92,10 +95,14 @@ public class LeaseBackEndImpl implements
 	} catch (ConfigurationException e) {
 	    throw new RemoteException("Configuration problem", e);
 	}
-	stub = (LeaseBackEnd)exporter.export(this);
+	this.exporter = exporter;
+    }
+    
+    public synchronized void export() throws ExportException{
+        stub = (LeaseBackEnd)exporter.export(this);
     }
 
-    public Object writeReplace() throws ObjectStreamException {
+    public synchronized Object writeReplace() throws ObjectStreamException {
 	return stub;
     }
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseExpirationTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseExpirationTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseExpirationTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LeaseExpirationTest.java Thu May 23 13:35:41 2013
@@ -145,6 +145,7 @@ public class LeaseExpirationTest extends
 	addLease(setLease, true);
 
 	listener = new OurListener(setLease, setRenewals);
+        listener.export();
 
 	// If we need to register for warning events
 	if (shouldRegister) {	    
@@ -175,6 +176,7 @@ public class LeaseExpirationTest extends
 
 	// Create owners and leases
 	final LeaseBackEndImpl home = new LeaseBackEndImpl(leaseCount);
+        home.export();
 	for (int i = 0; i < leaseCount; i++) {
 	    final long now = System.currentTimeMillis();
 	    final long initExp = now + renewGrant;

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LocalLease.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LocalLease.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LocalLease.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/LocalLease.java Thu May 23 13:35:41 2013
@@ -45,6 +45,9 @@ import net.jini.core.constraint.MethodCo
 
 import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
+import java.rmi.server.ExportException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * A lease implementation that is completely local for use in some of the 
@@ -82,14 +85,24 @@ class LocalLease implements Lease, Seria
      */
     private long id;
 
-    private ProxyTrustImpl pt = new ProxyTrustImpl();
+    private ProxyTrustImpl pt = getProxyTrust();
+    
+    private static ProxyTrustImpl getProxyTrust() {
+        ProxyTrustImpl proxy = new ProxyTrustImpl();
+        try {
+            proxy.export();
+        } catch (ExportException ex) {
+            throw new RuntimeException("Problem creating verifier", ex);
+        }
+        return proxy;
+    }
 
     public static LocalLease getLocalLease(long initExp, 
 					   long renewLimit, 
 					   long bundle, 
 					   long id) 
     {
-	ProxyTrustImpl pt = new ProxyTrustImpl();
+	ProxyTrustImpl pt = getProxyTrust();
 	if (pt.getProxy() instanceof RemoteMethodControl) {
 	    return new ConstrainableLocalLease(initExp, renewLimit, bundle, id, pt);
 	} else {
@@ -103,7 +116,7 @@ class LocalLease implements Lease, Seria
 					   long id,
 					   long count) 
     {
-	ProxyTrustImpl pt = new ProxyTrustImpl();
+	ProxyTrustImpl pt = getProxyTrust();
 	if (pt.getProxy() instanceof RemoteMethodControl) {
 	    return new ConstrainableFailingLocalLease(initExp, renewLimit, bundle, id, count, pt);
 	} else {
@@ -117,7 +130,7 @@ class LocalLease implements Lease, Seria
 					   long id,
 					   long count) 
     {
-	ProxyTrustImpl pt = new ProxyTrustImpl();
+	ProxyTrustImpl pt = getProxyTrust();
 	if (pt.getProxy() instanceof RemoteMethodControl) {
 	    return new ConstrainableDestructingLocalLease(initExp, renewLimit, bundle, id, count, pt);
 	} else {
@@ -353,7 +366,8 @@ class LocalLease implements Lease, Seria
     public static class ProxyTrustImpl
 	implements ProxyTrust, ServerProxyTrust, Serializable
     {
-	ProxyTrust proxy;
+	private ProxyTrust proxy;
+        private Exporter exporter;
 
 	public ProxyTrustImpl() {
 	    try {
@@ -365,13 +379,20 @@ class LocalLease implements Lease, Seria
 		if (exporter == null) {
 		    return; // configuration isn't secure
 		}
-		proxy = (ProxyTrust) exporter.export(this);
+                this.exporter = exporter;
+		
 	    } catch (Exception e) {
 		throw new RuntimeException("Problem creating verifier", e);
 	    }
 	}
+        
+        public synchronized void export() throws ExportException {
+            if (exporter != null){
+                proxy = (ProxyTrust) exporter.export(this);
+            }
+        }
 
-	public ProxyTrust getProxy() {
+	public synchronized ProxyTrust getProxy() {
 	    return proxy;
 	}
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoteListener.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoteListener.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoteListener.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoteListener.java Thu May 23 13:35:41 2013
@@ -36,6 +36,7 @@ import java.io.Serializable;
 
 import com.sun.jini.qa.harness.QATestEnvironment;
 import com.sun.jini.qa.harness.QAConfig;
+import java.rmi.server.ExportException;
 
 /**
  * Remote listener impl to be sub-classed by a class which actually does work
@@ -44,20 +45,27 @@ class RemoteListener
     implements RemoteEventListener, ServerProxyTrust, Serializable
 {
     private Object proxy;
+    private final Exporter exporter;
 
     RemoteListener() throws RemoteException {
+        Exporter exporter = null;
 	try {
-	    Exporter exporter = QAConfig.getDefaultExporter();
+	    exporter = QAConfig.getDefaultExporter();
 	    Configuration c = QAConfig.getConfig().getConfiguration();
 	    if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
 		exporter = (Exporter) c.getEntry("test",
 						 "normListenerExporter", 
 						 Exporter.class);
 	    }
-	    proxy = exporter.export(this); 
+	    
 	} catch (ConfigurationException e) {
 	    throw new RemoteException("Configuration problem", e);
 	}
+        this.exporter = exporter;
+    }
+    
+    public synchronized void export() throws ExportException{
+        proxy = exporter.export(this); 
     }
 
     public Object writeReplace() throws ObjectStreamException {

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoveExactlyOneTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoveExactlyOneTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoveExactlyOneTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RemoveExactlyOneTest.java Thu May 23 13:35:41 2013
@@ -159,7 +159,9 @@ public class RemoveExactlyOneTest extend
 
 	// Create and register listeners
 	warningListener = new WarningListener(failureFails?null:throwThis);
+        warningListener.export();
 	failureListener = new BaseListener(failureFails?throwThis:null);
+        failureListener.export();
 
 	MarshalledObject handback = new MarshalledObject(new Long(3));
 	logger.log(Level.FINER, "setting expiration warning listener");

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewAtTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewAtTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewAtTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewAtTest.java Thu May 23 13:35:41 2013
@@ -117,6 +117,7 @@ public class RenewAtTest extends TestBas
 	// Create the object that will serve as the landlord
 	final RenewAtOwner owners[] = new RenewAtOwner[8];
 	final LeaseBackEndImpl home = new LeaseBackEndImpl(owners.length);
+        home.export();
 	int j = 0;
 
 	// Desired exp before end of test, desired renewal < max grant

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewalFailureTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewalFailureTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewalFailureTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/norm/RenewalFailureTest.java Thu May 23 13:35:41 2013
@@ -132,6 +132,7 @@ public class RenewalFailureTest extends 
 
 	// Register for failure events
 	final OurListener listener = new OurListener();
+        listener.export();
 	final MarshalledObject handback = new MarshalledObject(new Long(347));
 	EventRegistration reg = 
 	    set.setRenewalFailureListener(listener, handback);
@@ -157,6 +158,7 @@ public class RenewalFailureTest extends 
 	logger.log(Level.INFO, "Creating leases and adding them to set");
 
 	home = new LeaseBackEndImpl(17);
+        home.export();
 	createAndRegisterLease(
 	    new RemoteException("Synthetic RemoteException"), false, set);
 	createAndRegisterLease(

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/ARemoteInterfaceImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/ARemoteInterfaceImpl.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/ARemoteInterfaceImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/ARemoteInterfaceImpl.java Thu May 23 13:35:41 2013
@@ -27,6 +27,7 @@ import net.jini.export.Exporter;
 import net.jini.security.TrustVerifier;
 import net.jini.security.proxytrust.ServerProxyTrust;
 import java.io.ObjectStreamException;
+import java.rmi.server.ExportException;
 
 /**
  *
@@ -39,6 +40,7 @@ public class ARemoteInterfaceImpl
 {
     private String rtn;
     private Object proxy;
+    private Exporter exporter;
 
     public ARemoteInterfaceImpl(Configuration c, String s) throws RemoteException {
 	Exporter exporter = QAConfig.getDefaultExporter();
@@ -51,15 +53,19 @@ public class ARemoteInterfaceImpl
 		throw new RemoteException("Bad configuration", e);
 	    }
 	}
-	proxy = exporter.export(this);
+	this.exporter = exporter;
         rtn = s;
     }
+    
+    public synchronized void export() throws ExportException {
+        proxy = exporter.export(this);
+    }
 
-    public Object writeReplace() throws ObjectStreamException {
+    public synchronized Object writeReplace() throws ObjectStreamException {
         return proxy;
     }
 
-    public TrustVerifier getProxyVerifier() {
+    public synchronized TrustVerifier getProxyVerifier() {
 	return new BasicProxyTrustVerifier(proxy);
     }
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/JavaSpaceAuditor.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/JavaSpaceAuditor.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/JavaSpaceAuditor.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/JavaSpaceAuditor.java Thu May 23 13:35:41 2013
@@ -418,7 +418,7 @@ public class JavaSpaceAuditor implements
                                                      tmpl, 
 						     listener, 
 						     handback);
-
+            passThrough.export();
             /*
              * Note if ether of these would happen the space.notify call
              * would throw an IllegalArgumentException

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MatchTestBase.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MatchTestBase.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MatchTestBase.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MatchTestBase.java Thu May 23 13:35:41 2013
@@ -83,6 +83,7 @@ public abstract class MatchTestBase exte
 	    new ARemoteInterfaceImpl(getConfig().getConfiguration(),
 				     "The quick brown fox"
 				     + " jumps over the lazy dog");
+        ((ARemoteInterfaceImpl)aRemoteMatch.aRI).export();
 	writeList.add(aRemoteMatch);
         ChildOfStringMatch aChildStringEntry = new ChildOfStringMatch(true);
         aChildStringEntry.aString = "BAR";

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MonitoredSpaceListener.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MonitoredSpaceListener.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MonitoredSpaceListener.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/MonitoredSpaceListener.java Thu May 23 13:35:41 2013
@@ -55,6 +55,12 @@ import net.jini.security.proxytrust.Serv
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
 
 import com.sun.jini.qa.harness.QAConfig;
+import java.rmi.server.ExportException;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 public class MonitoredSpaceListener
     implements RemoteEventListener, ServerProxyTrust, Serializable
@@ -110,6 +116,9 @@ public class MonitoredSpaceListener
                                            // Registration object
     private boolean wrongSource = false; // event with the wrong source
     private boolean early = false; // event before seq num in registation
+    
+    private final Exporter exporter;
+    private final AccessControlContext acContext;
 
     /**
      * Create a <code>MonitoredSpaceListener</code> that will pass the
@@ -135,7 +144,8 @@ public class MonitoredSpaceListener
 	    					    "spaceLoginContext",
 	    					    LoginContext.class);
 	    }
-	    proxy = exporter.export(this);
+            acContext = AccessController.getContext();
+            this.exporter = exporter;
 	    if (context != null) {
 		context.login();
 	    }
@@ -148,12 +158,27 @@ public class MonitoredSpaceListener
         this.client = client;
         handBack = regObject;
     }
+    
+    public synchronized void export() throws ExportException {
+        try {
+            proxy = AccessController.doPrivileged(new PrivilegedExceptionAction(){
+
+                @Override
+                public Object run() throws ExportException {
+                    return exporter.export(MonitoredSpaceListener.this);
+                }
+                
+            }, acContext);
+        } catch (PrivilegedActionException ex) {
+            throw (ExportException) ex.getException();
+        }
+    }
 
-    public Object writeReplace() throws ObjectStreamException {
+    public synchronized Object writeReplace() throws ObjectStreamException {
         return proxy;
     }
 
-    public TrustVerifier getProxyVerifier() {
+    public synchronized TrustVerifier getProxyVerifier() {
 	return new BasicProxyTrustVerifier(proxy);
     }
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NotifyTestUtil.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NotifyTestUtil.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NotifyTestUtil.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/NotifyTestUtil.java Thu May 23 13:35:41 2013
@@ -81,11 +81,13 @@ class NotifyTestUtil {
     void registerForNotify(Entry tmpl)
             throws TransactionException, RemoteException, java.io.IOException {
 	try {
+            TestSpaceListener tsl = 
+                    new TestSpaceListener(config.getConfiguration(), tmpl);
+            tsl.export();
 	    EventRegistration er = 
 		space.notify(tmpl,
 			     null, 
-			     new TestSpaceListener(config.getConfiguration(), 
-			                           tmpl),
+			     tsl,
 			     Lease.ANY, 
 			     new MarshalledObject(tmpl));
 	    QAConfig c = QAConfig.getConfig();

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/TestSpaceListener.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/TestSpaceListener.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/TestSpaceListener.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/matching/TestSpaceListener.java Thu May 23 13:35:41 2013
@@ -41,6 +41,7 @@ import net.jini.security.proxytrust.Serv
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
 
 import com.sun.jini.qa.harness.QAConfig;
+import java.rmi.server.ExportException;
 
 /**
  * Simple listener that prints message to log when an event is received
@@ -53,6 +54,7 @@ class TestSpaceListener
 
     final private Entry tmpl;
     private Object proxy;
+    private final Exporter exporter;
 
     /**
      * Create a new TestSpaceListener that dumps to the pasted stream
@@ -64,18 +66,22 @@ class TestSpaceListener
 		exporter =
 		(Exporter) c.getEntry("test", "outriggerListenerExporter", Exporter.class);
 	    }
-	    proxy = exporter.export(this);
+	    this.exporter = exporter;
 	} catch (ConfigurationException e) {
 	    throw new IllegalArgumentException("Bad configuration" + e);
 	}
         this.tmpl = tmpl;
     }
+    
+    public synchronized void export() throws ExportException {
+        proxy = exporter.export(this);
+    }
 
-    public Object writeReplace() throws ObjectStreamException {
+    public synchronized Object writeReplace() throws ObjectStreamException {
         return proxy;
     }
 
-    public TrustVerifier getProxyVerifier() {
+    public synchronized TrustVerifier getProxyVerifier() {
 	return new BasicProxyTrustVerifier(proxy);
     }
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/notify/ThrowRuntimeException.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/notify/ThrowRuntimeException.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/notify/ThrowRuntimeException.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/impl/outrigger/notify/ThrowRuntimeException.java Thu May 23 13:35:41 2013
@@ -50,6 +50,7 @@ import net.jini.security.proxytrust.Serv
 
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
 import com.sun.jini.qa.harness.Test;
+import java.rmi.server.ExportException;
 
 /**
  * Check to see how space deals with RuntimeException being thrown by
@@ -81,6 +82,7 @@ public class ThrowRuntimeException exten
         private long lastSeqNum = -1;
         final private boolean throwRuntime;
 	private Object proxy;
+        private final Exporter exporter;
 
         /** Simple constructor */
         Listener(Configuration c, 
@@ -92,18 +94,22 @@ public class ThrowRuntimeException exten
 		    exporter =
 		    (Exporter) c.getEntry("test", "outriggerListenerExporter", Exporter.class);
 		}
-		proxy = exporter.export(this);
+		this.exporter = exporter;
 	    } catch (ConfigurationException e) {
 		throw new RemoteException("Bad configuration", e);
 	    }
             this.throwRuntime = throwRuntime;
         }
+        
+        public synchronized void export() throws ExportException{
+            proxy = exporter.export(this);
+        }
 
-        public Object writeReplace() throws ObjectStreamException {
+        public synchronized Object writeReplace() throws ObjectStreamException {
 	    return proxy;
 	}
 
-	public TrustVerifier getProxyVerifier() {
+	public synchronized TrustVerifier getProxyVerifier() {
 	    return new BasicProxyTrustVerifier(proxy);
 	}
 
@@ -111,7 +117,7 @@ public class ThrowRuntimeException exten
          * Return the sequence number of the last event received, if
          * no event has been received return -1
          */
-        long lastEvent() {
+        synchronized long lastEvent() {
             return lastSeqNum;
         }
 
@@ -158,7 +164,9 @@ public class ThrowRuntimeException exten
             JavaSpace.class});
 	Configuration c = getConfig().getConfiguration();
         final Listener listener1 = new Listener(c, true);
+        listener1.export();
         final Listener listener2 = new Listener(c, false);
+        listener2.export();
         final JavaSpace space = (JavaSpace) services[0];
         final Entry aEntry = new UninterestingEntry();
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/DiscoveryServiceUtil.java Thu May 23 13:35:41 2013
@@ -46,6 +46,7 @@ import net.jini.security.TrustVerifier;
 import net.jini.security.proxytrust.ServerProxyTrust;
 
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
+import java.rmi.server.ExportException;
 
 /**
  * This class contains a set of static methods that provide general-purpose
@@ -63,7 +64,7 @@ public class DiscoveryServiceUtil {
     public static class BasicEventListener 
 	implements RemoteEventListener, ServerProxyTrust, Serializable 
     {
-
+        private final Exporter exporter;
 	private Object proxy;
 
         public BasicEventListener() throws RemoteException {
@@ -79,9 +80,11 @@ public class DiscoveryServiceUtil {
 		    throw new RemoteException("Configuration problem", e);
 		}
 	    }
-            synchronized (this){
-                proxy = exporter.export(this);
-            }
+            this.exporter = exporter;
+        }
+        
+        public synchronized void export() throws ExportException{
+            proxy = exporter.export(this);
         }
 
 	private synchronized Object writeReplace() throws ObjectStreamException {

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RememberingRemoteListener.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RememberingRemoteListener.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RememberingRemoteListener.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RememberingRemoteListener.java Thu May 23 13:35:41 2013
@@ -48,8 +48,8 @@ public class RememberingRemoteListener e
     /**
      * holds the events and their arrival times
      */
-    private ArrayList events = new ArrayList();
-    private ArrayList arrivalTimes = new ArrayList();
+    private final ArrayList events = new ArrayList();
+    private final ArrayList arrivalTimes = new ArrayList();
 
     /**
      * Constructor requiring an exporter to export the listener.
@@ -61,7 +61,7 @@ public class RememberingRemoteListener e
      */ 
     public RememberingRemoteListener(Exporter exporter) throws RemoteException {
 	super(exporter);
-    }
+    } 
     
     // inherit javadoc from parent class
     public synchronized void notify(RemoteEvent theEvent) 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RemoteListener.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RemoteListener.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RemoteListener.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/share/RemoteListener.java Thu May 23 13:35:41 2013
@@ -30,6 +30,8 @@ import com.sun.jini.proxy.BasicProxyTrus
 
 import java.io.ObjectStreamException;
 import java.io.Serializable;
+import java.io.WriteAbortedException;
+import java.rmi.server.ExportException;
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -47,14 +49,24 @@ class RemoteListener implements RemoteEv
     protected static Logger logger = 
         Logger.getLogger("com.sun.jini.qa.harness");
 
-    protected Object proxy;
+    private Object proxy;
+    private final Exporter exporter;
 
     RemoteListener(Exporter exporter) throws RemoteException {
-	proxy = exporter.export(this);
+	this.exporter = exporter;
+    }
+    
+    private Object getProxy() throws ExportException{
+        if (proxy == null) proxy = exporter.export(this);
+        return proxy;
     }
 
-    public Object writeReplace() throws ObjectStreamException {
-	return proxy;
+    public synchronized Object writeReplace() throws ObjectStreamException {
+        try {
+            return getProxy();
+        } catch (ExportException ex) {
+            throw new WriteAbortedException("Unable to export proxy", ex);
+        }
     }
 
     public synchronized void notify(RemoteEvent theEvent)
@@ -62,7 +74,11 @@ class RemoteListener implements RemoteEv
     {
     }
 
-    public TrustVerifier getProxyVerifier() {
-	return new BasicProxyTrustVerifier(proxy);
+    public synchronized TrustVerifier getProxyVerifier() {
+        try {
+            return new BasicProxyTrustVerifier(getProxy());
+        } catch (ExportException ex) {
+            throw new IllegalStateException("Unable to export proxy", ex);
+        }
     }
 }

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/AbstractBaseTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/AbstractBaseTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/AbstractBaseTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/AbstractBaseTest.java Thu May 23 13:35:41 2013
@@ -87,6 +87,7 @@ import net.jini.security.proxytrust.Serv
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
 import com.sun.jini.qa.harness.Test;
 import com.sun.jini.test.share.LookupServices;
+import java.rmi.server.ExportException;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -726,9 +727,10 @@ abstract public class AbstractBaseTest e
 	implements RemoteEventListener, ServerProxyTrust, Serializable
     {
 
-        private RegistrationInfo regInfo;
+        private final RegistrationInfo regInfo;
         private Object proxy;
-	private ProxyPreparer registrarPreparer;
+	private final ProxyPreparer registrarPreparer;
+        private final Exporter exporter;
         public LDSEventListener(RegistrationInfo regInfo)
 	    throws RemoteException
         {
@@ -736,7 +738,7 @@ abstract public class AbstractBaseTest e
             this.regInfo = regInfo;
 	    Configuration c = getConfig().getConfiguration();
 	    Exporter exporter = QAConfig.getDefaultExporter();
-	    registrarPreparer = new BasicProxyPreparer();
+	    ProxyPreparer registrarPreparer = new BasicProxyPreparer();
 	    if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
 		try {
 		    exporter = (Exporter) c.getEntry("test",
@@ -750,8 +752,13 @@ abstract public class AbstractBaseTest e
 		    throw new RemoteException("Configuration error", e);
 		}
 	    }
-	    proxy = exporter.export(this);
+	    this.exporter = exporter;
+            this.registrarPreparer = registrarPreparer;
         }//end constructor
+        
+        public synchronized void export() throws ExportException{
+            proxy = exporter.export(this);
+        }
 
 	public Object writeReplace() throws ObjectStreamException {
 	    return proxy;
@@ -1266,6 +1273,7 @@ abstract public class AbstractBaseTest e
                                                         iHandback);
         LDSEventListener listener =
                                new AbstractBaseTest.LDSEventListener(regInfo);
+        listener.export();
         LookupDiscoveryRegistration ldsReg = null;
 	try {
 	    ldsReg = discoverySrvc.register(groupsToDiscover,

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLease.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLease.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLease.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLease.java Thu May 23 13:35:41 2013
@@ -83,9 +83,11 @@ public class CancelLease extends Abstrac
     public Test construct(QAConfig config) throws Exception {
         super.construct(config);
         String[] expectedGroups = getGroupsToDiscover();
+        DiscoveryServiceUtil.BasicEventListener listener = new DiscoveryServiceUtil.BasicEventListener();
+        listener.export();
         reg = DiscoveryServiceUtil.getRegistration
                                 (discoverySrvc,
-                                 new DiscoveryServiceUtil.BasicEventListener(),
+                                 listener,
                                  expectedGroups);
         String[] currentGroups = reg.getGroups();
         if( !GroupsUtil.compareGroupSets(currentGroups,expectedGroups,Level.OFF) ) {

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLeaseMap.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLeaseMap.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLeaseMap.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/CancelLeaseMap.java Thu May 23 13:35:41 2013
@@ -93,9 +93,11 @@ public class CancelLeaseMap extends Abst
         long  durs[]  = new long[reg.length];
         String[] expectedGroups = getGroupsToDiscover();
         for(int i=0;i<reg.length;i++) {
+            DiscoveryServiceUtil.BasicEventListener listener = new DiscoveryServiceUtil.BasicEventListener();
+            listener.export();
             reg[i] = DiscoveryServiceUtil.getRegistration
                                (discoverySrvc,
-                                new DiscoveryServiceUtil.BasicEventListener(),
+                                listener,
                                 expectedGroups);
             String[] currentGroups = reg[i].getGroups();
             if( !GroupsUtil.compareGroupSets(currentGroups,expectedGroups,Level.OFF) ) {

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLease.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLease.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLease.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLease.java Thu May 23 13:35:41 2013
@@ -69,9 +69,11 @@ public class RenewLease extends Abstract
      */
     public Test construct(QAConfig config) throws Exception {
         super.construct(config);
+        DiscoveryServiceUtil.BasicEventListener listener = new DiscoveryServiceUtil.BasicEventListener();
+        listener.export();
         reg = DiscoveryServiceUtil.getRegistration
                                (discoverySrvc,
-                                new DiscoveryServiceUtil.BasicEventListener());
+                                listener);
         long duration = DiscoveryServiceUtil.expirationToDuration
                                           ((getPreparedLease(reg)).getExpiration(),
                                            System.currentTimeMillis());

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLeaseMap.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLeaseMap.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLeaseMap.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/discoveryservice/lease/RenewLeaseMap.java Thu May 23 13:35:41 2013
@@ -86,9 +86,11 @@ public class RenewLeaseMap extends Abstr
         reg = new LookupDiscoveryRegistration[expectedDurations.length];
         lease = new Lease[expectedDurations.length];
         for(int i=0;i<reg.length;i++) {
+            DiscoveryServiceUtil.BasicEventListener listener = new DiscoveryServiceUtil.BasicEventListener();
+            listener.export();
             reg[i] = DiscoveryServiceUtil.getRegistration
                                (discoverySrvc,
-                                new DiscoveryServiceUtil.BasicEventListener());
+                                listener);
             lease[i] = getPreparedLease(reg[i]);
             long duration = DiscoveryServiceUtil.expirationToDuration
                                                  (lease[i].getExpiration(),

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/NotifyCounter.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/NotifyCounter.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/NotifyCounter.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/NotifyCounter.java Thu May 23 13:35:41 2013
@@ -40,6 +40,7 @@ import net.jini.security.proxytrust.Serv
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
 
 import com.sun.jini.qa.harness.QAConfig;
+import java.rmi.server.ExportException;
 
 /**
  * This auxilary class listens for notify events and counts them.
@@ -54,13 +55,15 @@ public class NotifyCounter
     protected final Entry template;
 
     /** Time for which this listener will count events */
-    protected volatile long leaseTime;
+    protected final long leaseTime;
 
     /** number of events */
     private long maxEvNum;
 
     /** the proxy */
-    private final Object proxy;
+    private Object proxy;
+    
+    private final Exporter exporter;
 
     private volatile static Configuration configuration;
 
@@ -74,6 +77,21 @@ public class NotifyCounter
 	}
 	return NotifyCounter.configuration;
     }
+    
+    private static Exporter getExporter(Configuration c) throws RemoteException{
+        Exporter exporter = QAConfig.getDefaultExporter();
+	if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
+	    try {
+		exporter = (Exporter) c.getEntry("test",
+						 "outriggerListenerExporter",
+						 Exporter.class);
+	    } catch (ConfigurationException e) {
+		throw new RemoteException("Configuration Error", e);
+	    }
+	}
+        return exporter;
+    }
+    
 
     /**
      * Constructor with no arguments, set template to null, and lease time to 0.
@@ -96,28 +114,26 @@ public class NotifyCounter
      */
     public NotifyCounter(Entry template, long leaseTime)
             throws RemoteException {
-	Configuration c = getConfiguration();
-	Exporter exporter = QAConfig.getDefaultExporter();
-	if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
-	    try {
-		exporter = (Exporter) c.getEntry("test",
-						 "outriggerListenerExporter",
-						 Exporter.class);
-	    } catch (ConfigurationException e) {
-		throw new RemoteException("Configuration Error", e);
-	    }
-	}
-	proxy = exporter.export(this);
+	this(template, leaseTime, getExporter(getConfiguration()));
+	export(); //Export is called after private constructor freezes final fields.
+    }
+    
+    private NotifyCounter(Entry template, long leaseTime, Exporter exporter){
         maxEvNum = 0;
+        this.exporter = exporter;
         this.template = template;
         this.leaseTime = leaseTime;
     }
+    
+    private synchronized void export() throws ExportException{
+        proxy = exporter.export(this);
+    }
 
-    public Object writeReplace() throws ObjectStreamException {
+    public synchronized Object writeReplace() throws ObjectStreamException {
 	return proxy;
     }
 
-    public TrustVerifier getProxyVerifier() {
+    public synchronized TrustVerifier getProxyVerifier() {
 	return new BasicProxyTrustVerifier(proxy);
     }
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/ParticipantImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/ParticipantImpl.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/ParticipantImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/ParticipantImpl.java Thu May 23 13:35:41 2013
@@ -39,6 +39,7 @@ import net.jini.security.proxytrust.Serv
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
 
 import com.sun.jini.qa.harness.QAConfig;
+import java.rmi.server.ExportException;
 
 /**
  * This class is needed to prevent normal committing operation.
@@ -53,7 +54,7 @@ public class ParticipantImpl implements 
 
 
     private static Configuration configuration;
-
+    private final Exporter exporter;
     private Object proxy;
 
     public static void setConfiguration(Configuration configuration) {
@@ -82,14 +83,18 @@ public class ParticipantImpl implements 
 		throw new RemoteException("Configuration Error", e);
 	    }
 	}
-	proxy = exporter.export(this);
+	this.exporter = exporter;
+    }
+    
+    public synchronized void export() throws ExportException{
+        proxy = exporter.export(this);
     }
 
-    public Object writeReplace() throws ObjectStreamException {
+    public synchronized Object writeReplace() throws ObjectStreamException {
 	return proxy;
     }
 
-    public TrustVerifier getProxyVerifier() {
+    public synchronized TrustVerifier getProxyVerifier() {
 	return new BasicProxyTrustVerifier(proxy);
     }
 

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TestEventListener05.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TestEventListener05.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TestEventListener05.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TestEventListener05.java Thu May 23 13:35:41 2013
@@ -34,6 +34,7 @@ import java.rmi.RemoteException;
 
 import com.sun.jini.qa.harness.QAConfig;
 import com.sun.jini.proxy.BasicProxyTrustVerifier;
+import java.rmi.server.ExportException;
 
 
 public class TestEventListener05 implements RemoteEventListener,
@@ -44,10 +45,15 @@ public class TestEventListener05 impleme
 
     private Object proxy;
 
-    private ArrayList notifications = new ArrayList();
+    private final ArrayList notifications;
+    private final Exporter exporter;
 
     public TestEventListener05() throws RemoteException {
-        Configuration c = getConfiguration();
+        this(getExporter(getConfiguration()));
+        export(); // Exported after final freeze of private constructor.
+    }
+    
+    private static Exporter getExporter(Configuration c) throws RemoteException{
         Exporter exporter = QAConfig.getDefaultExporter();
         if (c instanceof com.sun.jini.qa.harness.QAConfiguration) {
             try {
@@ -58,32 +64,41 @@ public class TestEventListener05 impleme
                 throw new RemoteException("Configuration Error", e);
             }
         }
-        proxy = exporter.export(this);
+        return exporter;
+    }
+    
+    private TestEventListener05(Exporter exporter){
+        this.exporter = exporter;
+        notifications = new ArrayList();
     }
 
-    public void notify(RemoteEvent theEvent) throws UnknownEventException,
+    private synchronized void export() throws ExportException{
+        proxy = exporter.export(this);
+    }
+    
+    public synchronized void notify(RemoteEvent theEvent) throws UnknownEventException,
                                                     java.rmi.RemoteException
     {
         notifications.add(theEvent);
     }
 
-    public List getNotifications() {
-        return notifications;
+    public synchronized List getNotifications() {
+        return new ArrayList(notifications);
     }
 
-    public Object writeReplace() throws ObjectStreamException {
+    public synchronized Object writeReplace() throws ObjectStreamException {
         return proxy;
     }
 
-    public TrustVerifier getProxyVerifier() {
+    public synchronized TrustVerifier getProxyVerifier() {
         return new BasicProxyTrustVerifier(proxy);
     }
 
-    public static void setConfiguration(Configuration configuration) {
+    public static synchronized void setConfiguration(Configuration configuration) {
         TestEventListener05.configuration = configuration;
     }
 
-    public static Configuration getConfiguration() {
+    public static synchronized Configuration getConfiguration() {
         if (TestEventListener05.configuration == null) {
             throw new IllegalStateException("Configuration not set");
         }

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeIfExistsTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeIfExistsTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeIfExistsTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeIfExistsTest.java Thu May 23 13:35:41 2013
@@ -118,6 +118,7 @@ public class TransactionCommitTakeIfExis
          * will prevent normal commit completion
          */
         TransactionParticipant tp = new ParticipantImpl();
+        ((ParticipantImpl)tp).export();
         ((ServerTransaction) txn).join(tp, System.currentTimeMillis());
 
         // run thread which will prevent normal commit completion

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionCommitTakeTest.java Thu May 23 13:35:41 2013
@@ -118,6 +118,7 @@ public class TransactionCommitTakeTest e
          * will prevent normal commit completion
          */
         TransactionParticipant tp = new ParticipantImpl();
+        ((ParticipantImpl)tp).export();
         ((ServerTransaction) txn).join(tp, System.currentTimeMillis());
 
         // run thread which will prevent normal commit completion

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeIfExistsTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeIfExistsTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeIfExistsTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeIfExistsTest.java Thu May 23 13:35:41 2013
@@ -137,6 +137,7 @@ public class SnapshotTransactionCommitTa
          * will prevent normal commit completion
          */
         TransactionParticipant tp = new ParticipantImpl();
+        ((ParticipantImpl)tp).export();
         ((ServerTransaction) txn).join(tp, System.currentTimeMillis());
 
         // run thread which will prevent normal commit completion

Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeTest.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeTest.java?rev=1485700&r1=1485699&r2=1485700&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeTest.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/snapshot/SnapshotTransactionCommitTakeTest.java Thu May 23 13:35:41 2013
@@ -136,6 +136,7 @@ public class SnapshotTransactionCommitTa
          * will prevent normal commit completion
          */
         TransactionParticipant tp = new ParticipantImpl();
+        ((ParticipantImpl)tp).export();
         ((ServerTransaction) txn).join(tp, System.currentTimeMillis());
 
         // run thread which will prevent normal commit completion