/*
* 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 6475157
* @summary Tests deadlock in simultaneous connection and connector-server close
* @author Eamonn McManus
*/
/* This test is somewhat dependent on implementation details. If it suddenly
* starts failing after a rewrite of the RMIConnectorServer code, you should
* consider whether it is still relevant.
*/
public class ConnectorStopDeadlockTest {
if (connectorServer.isActive()) {
}
else
}
}
failure = s;
}
// static MonitorInfo[] threadLocks(Thread t) {
// ThreadMXBean tm = ManagementFactory.getThreadMXBean();
// ThreadInfo[] tis = tm.getThreadInfo(new long[] {t.getId()}, true, true);
// if (tis[0] == null)
// return null;
// else
// return tis[0].getLockedMonitors();
// }
//
// static void showLocks(Thread t) {
// System.out.println("Locks for " + t.getName() + ":");
// MonitorInfo[] mis = threadLocks(t);
// if (mis == null)
// System.out.println(" (no longer exists)");
// else if (mis.length == 0)
// System.out.println(" (none)");
// else {
// for (MonitorInfo mi : mis)
// System.out.println(" " + mi);
// }
// }
// Wait until thread t blocks waiting for a lock held by the calling thread,
// or until it exits.
while (true) {
return;
}
return;
}
}
}
}
}
public void run() {
try {
} catch (Exception e) {
fail(e);
}
}
};
t.setName("connectorServer.stop");
t.start();
waitForBlock(t);
/* If this thread is synchronized on RMIServerImpl, then
* the thread that does connectorServer.stop will acquire
* the clientList lock and then block waiting for the RMIServerImpl
* lock. Our call to super.clientClosed will then deadlock because
* it needs to acquire the clientList lock.
*/
super.clientClosed(conn);
}
}
}