Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set01/NotifyOnEntrySrvcReg.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set01/NotifyOnEntrySrvcReg.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set01/NotifyOnEntrySrvcReg.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set01/NotifyOnEntrySrvcReg.java Thu May 30 08:13:59 2013 @@ -57,7 +57,7 @@ public class NotifyOnEntrySrvcReg extend private static boolean SHOW_TIMINGS = false; /** Class which handles all events sent by the lookup service */ - public class Listener extends BasicListener + private class Listener extends BasicListener implements RemoteEventListener { public Listener() throws RemoteException { @@ -66,18 +66,20 @@ public class NotifyOnEntrySrvcReg extend /** Method called remotely by lookup to handle the generated event. */ public void notify(RemoteEvent ev) { ServiceEvent srvcEvnt = (ServiceEvent)ev; - evntVec.addElement(srvcEvnt); - try { - QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple) - (srvcEvnt.getRegistrationObject().get()); - - receivedTuples.addElement(new QATestUtils.SrvcAttrTuple - (srvcItems,tmplAttrs, - tuple.getSrvcObj(), - tuple.getAttrObj(), - srvcEvnt.getTransition())); - } catch (Throwable e) { - logger.log(Level.INFO, "Unexpected exception", e); + synchronized (NotifyOnEntrySrvcReg.this){ + evntVec.addElement(srvcEvnt); + try { + QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple) + (srvcEvnt.getRegistrationObject().get()); + + receivedTuples.addElement(new QATestUtils.SrvcAttrTuple + (srvcItems,tmplAttrs, + tuple.getSrvcObj(), + tuple.getAttrObj(), + srvcEvnt.getTransition())); + } catch (Throwable e) { + logger.log(Level.INFO, "Unexpected exception", e); + } } } } @@ -133,7 +135,7 @@ public class NotifyOnEntrySrvcReg extend * @exception QATestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i,j,k,n; int transitionMask = ServiceRegistrar.TRANSITION_NOMATCH_MATCH; @@ -159,6 +161,7 @@ public class NotifyOnEntrySrvcReg extend super.construct(sysConfig); /* create the event handler */ listener = new Listener(); + ((BasicListener) listener).export(); /* retrieve the proxies to the lookup service */ proxy = super.getProxy(); /* load each of the attribute classes and create a non-initialized @@ -232,7 +235,7 @@ public class NotifyOnEntrySrvcReg extend * lookup service. * @exception QATestException usually indicates test failure */ - public void run() throws Exception { + public synchronized void run() throws Exception { int i=0; int j=0; int k=0; @@ -246,7 +249,7 @@ public class NotifyOnEntrySrvcReg extend } } QATestUtils.verifyEventTuples - (receivedTuples,expectedTuples,maxNMsToWaitForEvents,SHOW_TIMINGS); + (receivedTuples,expectedTuples,maxNMsToWaitForEvents,SHOW_TIMINGS, this); QATestUtils.verifyEventItems(evntVec); } @@ -258,7 +261,7 @@ public class NotifyOnEntrySrvcReg extend * @exception QATestException will usually indicate an "unresolved" * condition because at this point the test has completed. */ - public void tearDown() { + public synchronized void tearDown() { try { unexportListener(listener, true); } finally {
Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredAddAttributes.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredAddAttributes.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredAddAttributes.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredAddAttributes.java Thu May 30 08:13:59 2013 @@ -55,7 +55,7 @@ public class ExpiredAddAttributes extend private long leaseStartTime; private Entry[] attrEntries; - public Test construct(QAConfig sysConfig) throws Exception + public synchronized Test construct(QAConfig sysConfig) throws Exception { super.construct(sysConfig); attrEntries = super.createAttributes(ATTR_CLASSES); @@ -67,8 +67,8 @@ public class ExpiredAddAttributes extend } /** Executes the current QA test. */ - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doAddAttributes(); } Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseCancel.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseCancel.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseCancel.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseCancel.java Thu May 30 08:13:59 2013 @@ -89,10 +89,11 @@ public class ExpiredEventLeaseCancel ext * @exception QATestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i; super.construct(sysConfig); listener = new Listener(); + ((BasicListener) listener).export(); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); proxy = super.getProxy(); @@ -114,8 +115,8 @@ public class ExpiredEventLeaseCancel ext return this; } - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doLeaseCancel(); } Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseRenew.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseRenew.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseRenew.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredEventLeaseRenew.java Thu May 30 08:13:59 2013 @@ -89,10 +89,11 @@ public class ExpiredEventLeaseRenew exte * @exception QATestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i; super.construct(sysConfig); listener = new Listener(); + ((BasicListener) listener).export(); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); proxy = super.getProxy(); @@ -114,8 +115,8 @@ public class ExpiredEventLeaseRenew exte return this; } - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doLeaseRenew(); } Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapCancel.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapCancel.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapCancel.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapCancel.java Thu May 30 08:13:59 2013 @@ -92,10 +92,11 @@ public class ExpiredLeaseMapCancel exten * @exception QATestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i; super.construct(sysConfig); listener = new Listener(); + ((BasicListener) listener).export(); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); proxy = super.getProxy(); @@ -118,8 +119,8 @@ public class ExpiredLeaseMapCancel exten return this; } - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doLeaseMapCancel(); if (!leaseMap.isEmpty()) throw new TestException("map is not empty"); Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapRenew.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapRenew.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapRenew.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredLeaseMapRenew.java Thu May 30 08:13:59 2013 @@ -92,10 +92,11 @@ public class ExpiredLeaseMapRenew extend * @exception TestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i; super.construct(sysConfig); listener = new Listener(); + ((BasicListener) listener).export(); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); proxy = super.getProxy(); @@ -118,8 +119,8 @@ public class ExpiredLeaseMapRenew extend return this; } - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doLeaseMapRenew(); if (!leaseMap.isEmpty()) throw new TestException("Map is not empty"); Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredModifyAttributes.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredModifyAttributes.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredModifyAttributes.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredModifyAttributes.java Thu May 30 08:13:59 2013 @@ -55,7 +55,7 @@ public class ExpiredModifyAttributes ext private Entry[] modAttrs; private int attrsLen; - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { super.construct(sysConfig); attrEntries = super.createAttributes(ATTR_CLASSES); modAttrs = new Entry[attrEntries.length]; @@ -70,8 +70,8 @@ public class ExpiredModifyAttributes ext } /** Executes the current QA test. */ - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doModifyAttributes(); } Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseCancel.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseCancel.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseCancel.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseCancel.java Thu May 30 08:13:59 2013 @@ -53,7 +53,7 @@ public class ExpiredServiceLeaseCancel e private int nInstances = 0; private long leaseStartTime; - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { super.construct(sysConfig); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); @@ -69,8 +69,8 @@ public class ExpiredServiceLeaseCancel e } /** Executes the current QA test. */ - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doLeaseCancel(); } Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseRenew.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseRenew.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseRenew.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredServiceLeaseRenew.java Thu May 30 08:13:59 2013 @@ -53,7 +53,7 @@ public class ExpiredServiceLeaseRenew ex private int nInstances = 0; private long leaseStartTime; - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { super.construct(sysConfig); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); @@ -68,8 +68,8 @@ public class ExpiredServiceLeaseRenew ex } /** Executes the current QA test. */ - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doLeaseRenew(); } Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredSetAttributes.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredSetAttributes.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredSetAttributes.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/ExpiredSetAttributes.java Thu May 30 08:13:59 2013 @@ -55,7 +55,7 @@ public class ExpiredSetAttributes extend private long leaseStartTime; private Entry[] attrEntries; - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { super.construct(sysConfig); attrEntries = super.createAttributes(ATTR_CLASSES); nInstances = super.getNInstances(); @@ -66,8 +66,8 @@ public class ExpiredSetAttributes extend } /** Executes the current QA test. */ - public void run() throws Exception { - QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000); + public synchronized void run() throws Exception { + QATestUtils.computeDurAndWait(leaseStartTime, leaseDuration + 1000, this); doSetAttributes(); } Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapCancel.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapCancel.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapCancel.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapCancel.java Thu May 30 08:13:59 2013 @@ -90,10 +90,11 @@ public class LeaseMapCancel extends QATe * @exception QATestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i; super.construct(sysConfig); listener = new Listener(); + ((BasicListener) listener).export(); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); proxy = super.getProxy(); @@ -117,7 +118,7 @@ public class LeaseMapCancel extends QATe } /** Executes the current QA test. */ - public void run() throws Exception { + public synchronized void run() throws Exception { QATestUtils.verifyLeases(srvcLeases, leaseStartTime + leaseDuration); QATestUtils.verifyLeases(evntLeases, Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapRenew.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapRenew.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapRenew.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/LeaseMapRenew.java Thu May 30 08:13:59 2013 @@ -102,10 +102,11 @@ public class LeaseMapRenew extends QATes * @exception TestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i; super.construct(sysConfig); listener = new Listener(); + ((BasicListener) listener).export(); nInstances = super.getNInstances(); srvcItems = super.createServiceItems(TEST_SRVC_CLASSES); proxy = super.getProxy(); @@ -163,10 +164,10 @@ public class LeaseMapRenew extends QATes * : : : : : * L0 L1 L2 L3 L4 */ - public void run() throws Exception { + public synchronized void run() throws Exception { for(int i =0; i<loopCount; i++) { logger.log(Level.FINEST, "renewLeaseWait: " + i); - QATestUtils.computeDurAndWait(leaseStartTime, leaseWaitTime); + QATestUtils.computeDurAndWait(leaseStartTime, leaseWaitTime, this); logger.log(Level.FINEST, "doRenewLease"); leaseStartTime = QATestUtils.getCurTime(); leaseMap.renewAll(); @@ -177,7 +178,7 @@ public class LeaseMapRenew extends QATes if (!mapCopy.equals(leaseMap)) throw new TestException("map contents changed"); logger.log(Level.FINEST, "lookupwait"); - QATestUtils.computeDurAndWait(leaseStartTime, halfDurationTime); + QATestUtils.computeDurAndWait(leaseStartTime, halfDurationTime, this); logger.log(Level.FINEST, "dolookup"); QATestUtils.doLookup(srvcItems, srvcIDTmpls, proxy ); logger.log(Level.FINEST, "lookup successful"); Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyExceptionTest.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyExceptionTest.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyExceptionTest.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyExceptionTest.java Thu May 30 08:13:59 2013 @@ -34,7 +34,7 @@ public abstract class NotifyExceptionTes protected RemoteEventListener listener; /** Do-nothing remote event listener */ - public class Listener extends BasicListener + private class Listener extends BasicListener implements RemoteEventListener { public Listener() throws RemoteException { @@ -51,9 +51,10 @@ public abstract class NotifyExceptionTes * * Creates the lookup service and a do-nothing remote event listener. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { super.construct(sysConfig); listener = new Listener(); + ((BasicListener) listener).export(); return this; } @@ -63,7 +64,7 @@ public abstract class NotifyExceptionTes * Unexports the listener and then performs any remaining standard * cleanup duties. */ - public void tearDown() { + public synchronized void tearDown() { try { unexportListener(listener, true); } finally { Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnAttrSet.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnAttrSet.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnAttrSet.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnAttrSet.java Thu May 30 08:13:59 2013 @@ -55,7 +55,7 @@ import java.io.IOException; public class NotifyOnAttrSet extends QATestRegistrar { /** Class which handles all events sent by the lookup service */ - public class Listener extends BasicListener + private class Listener extends BasicListener implements RemoteEventListener { public Listener() throws RemoteException { @@ -68,7 +68,7 @@ public class NotifyOnAttrSet extends QAT } } - protected Vector evntVec = new Vector(); + protected final Vector evntVec = new Vector(); private ServiceItem[] srvcItems ; private ServiceRegistration[] srvcRegs ; @@ -121,6 +121,7 @@ public class NotifyOnAttrSet extends QAT super.construct(sysConfig); /* create a single event handler to process all received events */ listener = new Listener(); + ((BasicListener) listener).export(); /* load and instantiate a set of initialized (non-null fields) * attribute classes */ @@ -205,7 +206,7 @@ public class NotifyOnAttrSet extends QAT * i_th service. * @exception QATestException usually indicates test failure */ - public void run() throws Exception { + public synchronized void run() throws Exception { int i,j,k; int nExpectedEvnts = 0; for(i=0; i<srvcRegs.length; i++) { @@ -216,7 +217,8 @@ public class NotifyOnAttrSet extends QAT /* give the Listener a chance to collect all events */ try { - Thread.sleep(deltaTListener); + QATestUtils.waitDeltaT( deltaTListener, this); +// Thread.sleep(deltaTListener); } catch (InterruptedException e) { } QATestUtils.verifyEventVector(evntVec,nExpectedEvnts, @@ -229,7 +231,7 @@ public class NotifyOnAttrSet extends QAT * Unexports the listener and then performs any remaining standard * cleanup duties. */ - public void tearDown() { + public synchronized void tearDown() { try { unexportListener(listener, true); } finally { Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnComboAttrSet.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnComboAttrSet.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnComboAttrSet.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/lookupservice/test_set02/NotifyOnComboAttrSet.java Thu May 30 08:13:59 2013 @@ -58,7 +58,7 @@ public class NotifyOnComboAttrSet extend private static boolean SHOW_TIMINGS = false; /** Class which handles all events sent by the lookup service */ - public class Listener extends BasicListener + private class Listener extends BasicListener implements RemoteEventListener { public Listener() throws RemoteException { @@ -67,18 +67,20 @@ public class NotifyOnComboAttrSet extend /** Method called remotely by lookup to handle the generated event. */ public void notify(RemoteEvent ev) { ServiceEvent srvcEvnt = (ServiceEvent)ev; - evntVec.addElement(srvcEvnt); - try { - QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple) - (srvcEvnt.getRegistrationObject().get()); - - receivedTuples.addElement(new QATestUtils.SrvcAttrTuple - (srvcItems,tmplAttrs, - tuple.getSrvcObj(), - tuple.getAttrObj(), - srvcEvnt.getTransition())); - } catch (Exception e) { - logger.log(Level.INFO, "Unexpected exception in listener", e); + synchronized (NotifyOnComboAttrSet.this){ + evntVec.addElement(srvcEvnt); + try { + QATestUtils.SrvcAttrTuple tuple = (QATestUtils.SrvcAttrTuple) + (srvcEvnt.getRegistrationObject().get()); + + receivedTuples.addElement(new QATestUtils.SrvcAttrTuple + (srvcItems,tmplAttrs, + tuple.getSrvcObj(), + tuple.getAttrObj(), + srvcEvnt.getTransition())); + } catch (Exception e) { + logger.log(Level.INFO, "Unexpected exception in listener", e); + } } } } @@ -141,7 +143,7 @@ public class NotifyOnComboAttrSet extend * @exception QATestException will usually indicate an "unresolved" * condition because at this point the test has not yet begun. */ - public Test construct(QAConfig sysConfig) throws Exception { + public synchronized Test construct(QAConfig sysConfig) throws Exception { int i,j,k; int transitionMask = ServiceRegistrar.TRANSITION_MATCH_NOMATCH | ServiceRegistrar.TRANSITION_NOMATCH_MATCH @@ -169,6 +171,7 @@ public class NotifyOnComboAttrSet extend super.construct(sysConfig); /* create the event handler */ listener = new Listener(); + ((BasicListener) listener).export(); /* load and create an initialized instance (non-null fields) of each * of the attribute classes; which will be added to each registered * service @@ -278,7 +281,7 @@ public class NotifyOnComboAttrSet extend * lookup service. * @exception QATestException usually indicates test failure */ - public void run() throws Exception { + public synchronized void run() throws Exception { int i=0; for (i=0;i<nSrvcs;i++) { setStateAttrInfo(i,tmplAttrs,newState); @@ -290,7 +293,7 @@ public class NotifyOnComboAttrSet extend srvcRegs[i].setAttributes(attrEntries); } QATestUtils.verifyEventTuples - (receivedTuples,expectedTuples,maxNMsToWaitForEvents,SHOW_TIMINGS); + (receivedTuples,expectedTuples,maxNMsToWaitForEvents,SHOW_TIMINGS, this); QATestUtils.verifyEventItems(evntVec); } @@ -300,7 +303,7 @@ public class NotifyOnComboAttrSet extend * Unexports the listener and then performs any remaining standard * cleanup duties. */ - public void tearDown() { + public synchronized void tearDown() { unexportListener(listener, true); super.tearDown(); } Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/ClassServer.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/ClassServer.java?rev=1487782&r1=1487781&r2=1487782&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/ClassServer.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/ClassServer.java Thu May 30 08:13:59 2013 @@ -172,19 +172,19 @@ public class ClassServer extends Thread Logger.getLogger("com.sun.jini.tool.ClassServer"); /** Server socket to accept connections on */ - private ServerSocket server; + private final ServerSocket server; /** Directories to serve from */ - private String[] dirs; + private final String[] dirs; /** Map from String (JAR root) to JarFile[] (JAR class path) */ - private Map map; + private final Map<String, JarFile[]> map; /** Verbosity flag */ private volatile boolean verbose; /** Stoppable flag */ - private boolean stoppable; + private final boolean stoppable; /** Read permission on dir and all subdirs, for each dir in dirs */ - private FilePermission[] perms; + private final FilePermission[] perms; /** Life cycle control */ - private LifeCycle lifeCycle; + private final LifeCycle lifeCycle; /** * Construct a server that does not support network shutdown. @@ -308,10 +308,12 @@ public class ClassServer extends Thread ioe.initCause(be); throw ioe ; } - if (!trees) + if (!trees) { + map = null; return; - map = new HashMap(); - Map jfmap = new HashMap(); + } + map = new HashMap<String, JarFile[]>(); + Map<String,JarFile> jfmap = new HashMap<String,JarFile>(); for (int i = 0; i < dirs.length; i++) { String[] files = new File(dirs[i]).list(); if (files == null) @@ -323,7 +325,7 @@ public class ClassServer extends Thread String name = jar.substring(0, jar.length() - 4); if (map.containsKey(name)) continue; - List jflist = new ArrayList(1); + List<JarFile> jflist = new ArrayList<JarFile>(1); addJar(jar, jflist, jfmap); map.put(name, jflist.toArray(new JarFile[jflist.size()])); } @@ -372,10 +374,10 @@ public class ClassServer extends Thread } /** Add transitive Class-Path JARs to jflist. */ - private void addJar(String jar, List jflist, Map jfmap) + private void addJar(String jar, List<JarFile> jflist, Map<String,JarFile> jfmap) throws IOException { - JarFile jf = (JarFile) jfmap.get(jar); + JarFile jf = jfmap.get(jar); if (jf != null) { if (jflist.contains(jf)) { return;
