From: <tho...@us...> - 2014-09-06 17:39:29
|
Revision: 8643 http://sourceforge.net/p/bigdata/code/8643 Author: thompsonbry Date: 2014-09-06 17:39:26 +0000 (Sat, 06 Sep 2014) Log Message: ----------- code cleanup Modified Paths: -------------- branches/SESAME_2_7/bigdata/src/test/com/bigdata/journal/ProxyTestCase.java Modified: branches/SESAME_2_7/bigdata/src/test/com/bigdata/journal/ProxyTestCase.java =================================================================== --- branches/SESAME_2_7/bigdata/src/test/com/bigdata/journal/ProxyTestCase.java 2014-09-06 16:05:56 UTC (rev 8642) +++ branches/SESAME_2_7/bigdata/src/test/com/bigdata/journal/ProxyTestCase.java 2014-09-06 17:39:26 UTC (rev 8643) @@ -144,7 +144,8 @@ */ private int startupActiveThreads = 0; - + + @Override public void setUp() throws Exception { startupActiveThreads = Thread.currentThread().getThreadGroup().activeCount(); @@ -155,58 +156,62 @@ private static boolean s_checkThreads = true; + @Override public void tearDown() throws Exception { getOurDelegate().tearDown(this); - + if (s_checkThreads) { - final ThreadGroup grp = Thread.currentThread().getThreadGroup(); - final int tearDownActiveThreads = grp.activeCount(); - int nremaining = 0; - if (startupActiveThreads != tearDownActiveThreads) { - final Thread[] threads = new Thread[tearDownActiveThreads]; - grp.enumerate(threads); - final StringBuilder info = new StringBuilder(); - boolean first = true; + final ThreadGroup grp = Thread.currentThread().getThreadGroup(); + final int tearDownActiveThreads = grp.activeCount(); + int nremaining = 0; + if (startupActiveThreads != tearDownActiveThreads) { + final Thread[] threads = new Thread[tearDownActiveThreads]; + grp.enumerate(threads); + final StringBuilder info = new StringBuilder(); + boolean first = true; for (Thread t : threads) { if (t == null) continue; - if(!first) - info.append(','); + if (!first) + info.append(','); info.append("[" + t.getName() + "]"); first = false; nremaining++; - } - - final String failMessage = "Threads left active after task" - +": test=" + getName()// - + ", delegate="+getOurDelegate().getClass().getName() - + ", startupCount=" + startupActiveThreads - + ", teardownCount=" + nremaining - + ", thisThread="+Thread.currentThread().getName() - + ", threads: " + info; - + } + + final String failMessage = "Threads left active after task" + + ": test=" + + getName()// + + ", delegate=" + getOurDelegate().getClass().getName() + + ", startupCount=" + startupActiveThreads + + ", teardownCount=" + nremaining + ", thisThread=" + + Thread.currentThread().getName() + ", threads: " + + info; + if (nremaining > startupActiveThreads) - log.error(failMessage); + log.error(failMessage); /* * Wait up to 2 seconds for threads to die off so the next test * will run more cleanly. */ - for (int i = 0; i < 20; i++) { - Thread.sleep(100); - if (grp.activeCount() != startupActiveThreads) - break; - } + for (int i = 0; i < 20; i++) { + Thread.sleep(100); + if (grp.activeCount() != startupActiveThreads) + break; + } - } - + } + } - - super.tearDown(); + + super.tearDown(); + } + @Override public Properties getProperties() { return getOurDelegate().getProperties(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |