/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6222826 6379712
* @summary Test that all monitors will be well started when sharing
* a single thread pool.
* @author Luis-Miguel Alventosa
* @run clean ThreadPoolTest
* @run build ThreadPoolTest
*/
public class ThreadPoolTest {
static int maxPoolSize;
static int nTasks;
// MBean class
private boolean called = false;
inform("getInteger()");
return 0;
}
inform("getDouble()");
return 0.0;
}
inform("getString()");
return "";
}
synchronized(waiter) {
if (!called) {
called = true;
}
}
}
}
// MBean interface
public interface ObservedObjectMBean {
}
/**
* Run test
*/
try {
echo(">>> CREATE MBeanServer");
for (int i = 0; i < nTasks; i++) {
mbeanNames[i] =
monitored[i] = new ObservedObject();
switch (monitorType) {
case 1:
"instance=" + (i + 1));
monitor[i] = new CounterMonitor();
break;
case 2:
"instance=" + (i + 1));
monitor[i] = new GaugeMonitor();
break;
case 3:
"instance=" + (i + 1));
monitor[i] = new StringMonitor();
break;
default:
echo("Unsupported monitor type");
return 1;
}
}
return 1;
}
} finally {
for (int i = 0; i < nTasks; i++)
}
return 0;
}
/*
* Print message
*/
}
/*
* Standalone entry point.
*
* Run the test and report to stdout.
*/
maxPoolSize = 10;
echo(">>> MAXIMUM POOL SIZE = 10 [default value]");
} else {
}
if (error > 0) {
echo(">>> Unhappy Bye, Bye!");
throw new IllegalStateException(
"Test FAILED: Unexpected Maximum Pool Size Overflow!");
} else {
echo(">>> Happy Bye, Bye!");
}
}
private static class Waiter {
}
public void count() {
synchronized(this) {
counted++;
this.notifyAll();
}
}
}
synchronized(this) {
try {
} catch (InterruptedException ire) {
break;
}
}
}
}
private int waitedNB;
}
}