Author: peter_firmstone Date: Wed Mar 6 07:30:01 2013 New Revision: 1453178
URL: http://svn.apache.org/r1453178 Log: Refactor: Minor visibility updates, setting variables to volatile and adding synchronisation to collections. Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/AbstractLeaseRenewalServiceTest.java river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/DurationExpirationTest.java Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/AbstractLeaseRenewalServiceTest.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/AbstractLeaseRenewalServiceTest.java?rev=1453178&r1=1453177&r2=1453178&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/AbstractLeaseRenewalServiceTest.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/AbstractLeaseRenewalServiceTest.java Wed Mar 6 07:30:01 2013 @@ -46,6 +46,8 @@ import com.sun.jini.qa.harness.QATestEnv // net.jini import com.sun.jini.qa.harness.Test; +import java.util.Collections; +import java.util.List; import net.jini.config.Configuration; import net.jini.config.ConfigurationException; import net.jini.export.Exporter; @@ -59,12 +61,12 @@ public abstract class AbstractLeaseRenew /** * The test configuration object */ - protected Configuration testConfiguration; + protected volatile Configuration testConfiguration; /** * Holds instances to LRS proxy objects returned from StartService. */ - private ArrayList lrsServices = new ArrayList(); + private final List<LeaseRenewalService> lrsServices = Collections.synchronizedList(new ArrayList<LeaseRenewalService>()); /** * the name of service for which these test are written @@ -74,7 +76,7 @@ public abstract class AbstractLeaseRenew /** * utility class that implements convenience methods */ - protected LeaseRenewalServiceTestUtil rstUtil; + protected volatile LeaseRenewalServiceTestUtil rstUtil; /** * Sets up the testing environment. @@ -111,7 +113,7 @@ public abstract class AbstractLeaseRenew // start each service as requested for (int i = 0; i < numLRS; i++) { logger.log(Level.FINE, "Starting LRS service #" + i); - lrsServices.add(getManager().startService(serviceName)); + lrsServices.add((LeaseRenewalService) getManager().startService(serviceName)); } return this; } @@ -143,7 +145,7 @@ public abstract class AbstractLeaseRenew throw new IllegalArgumentException("Argument index is < 0."); } - return (LeaseRenewalService) lrsServices.get(index); + return lrsServices.get(index); } /** Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/DurationExpirationTest.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/DurationExpirationTest.java?rev=1453178&r1=1453177&r2=1453178&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/DurationExpirationTest.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/renewalservice/DurationExpirationTest.java Wed Mar 6 07:30:01 2013 @@ -47,17 +47,17 @@ public class DurationExpirationTest exte /** * Provides leases for this test. */ - private TestLeaseProvider leaseProvider = null; + private volatile TestLeaseProvider leaseProvider = null; /** * The "land lord" for the leases. Defines lease method behavior. */ - private BasicLeaseOwner leaseOwner = null; + private volatile BasicLeaseOwner leaseOwner = null; /** * The maximum time granted for a lease by a renew operation. */ - private long renewGrant = 0; + private volatile long renewGrant = 0; /** * The default value renewGrant @@ -67,7 +67,7 @@ public class DurationExpirationTest exte /** * The LeaseRenewalManager used for LRS impls that grant only short leases */ - private LeaseRenewalManager lrm = null; + private volatile LeaseRenewalManager lrm = null; /** * Sets up the testing environment.
