/*
* 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 5086470 6358247
* @summary Test type conversion when invoking ThreadMXBean.dumpAllThreads
* through proxy.
*
* @author Mandy Chung
*
* @run main ThreadMXBeanProxy
*/
import javax.management.*;
public class ThreadMXBeanProxy {
ThreadMXBean.class);
if (!mbean.isSynchronizerUsageSupported()) {
return;
}
// wait until myThread acquires mutex and lock owner is set.
try {
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
// validate the local access
throw new RuntimeException("Returned ThreadInfo[] of length=" +
}
// validate the remote access
throw new RuntimeException("Returned ThreadInfo[] of length=" +
}
boolean found = false;
found = true;
}
}
if (!found) {
throw new RuntimeException("No ThreadInfo found for MyThread");
}
}
public MyThread() {
super("MyThread");
}
public void run() {
synchronized (lock) {
synchronized(o) {
try {
o.wait();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
}
" not matched. Expected: " + getName());
}
throw new RuntimeException("Number of locked monitors = " +
" not matched. Expected: " + OWNED_MONITORS);
}
int depth = m.getLockedStackDepth();
stacktrace[depth]);
throw new RuntimeException("LockedStackFrame does not match " +
"stack frame in ThreadInfo.getStackTrace");
}
hcode != m.getIdentityHashCode() ||
throw new RuntimeException("MonitorInfo " + m +
" doesn't match.");
}
throw new RuntimeException("Number of locked syncs = " +
}
" class name not matched. Expected: " + lockName);
}
" IdentityHashCode not matched. Expected: " + hcode);
}
}
}
// Our internal helper class
// Report whether in locked state
protected boolean isHeldExclusively() {
return getState() == 1;
}
// Acquire the lock if state is zero
return true;
}
return false;
}
// Release the lock by setting state to zero
setState(0);
return true;
}
// Provide a Condition
// Deserialize properly
throws IOException, ClassNotFoundException {
s.defaultReadObject();
}
return getExclusiveOwnerThread();
}
}
// The sync object does all the hard work. We just forward to it.
}
}
}
}