test/java/rmi/transport/dgcDeadLock/TestImpl.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 34,44 **** import java.rmi.registry.*; import java.rmi.server.*; public class TestImpl extends UnicastRemoteObject implements Test { - static Thread locker = null; static TestImpl foo = null; static TestImpl bar = null; TestImpl() throws RemoteException { --- 34,43 ----
*** 55,78 **** static public void main(String[] args) { Registry registry = null; try { registry = java.rmi.registry.LocateRegistry. ! createRegistry(TestLibrary.REGISTRY_PORT); //export "Foo" foo = new TestImpl(); Naming.rebind("rmi://:" + ! TestLibrary.REGISTRY_PORT + "/Foo", foo); try { //export "Bar" after leases have been expired. bar = new TestImpl(); Naming.rebind("rmi://localhost:" + ! TestLibrary.REGISTRY_PORT + "/Bar", bar); } catch (Exception e) { throw new RemoteException(e.getMessage()); } Thread.sleep(DGCDeadLock.TEST_FAIL_TIME); --- 54,78 ---- static public void main(String[] args) { Registry registry = null; try { + int registryPort = Integer.parseInt(System.getProperty("rmi.registry.port")); registry = java.rmi.registry.LocateRegistry. ! createRegistry(registryPort); //export "Foo" foo = new TestImpl(); Naming.rebind("rmi://:" + ! registryPort + "/Foo", foo); try { //export "Bar" after leases have been expired. bar = new TestImpl(); Naming.rebind("rmi://localhost:" + ! registryPort + "/Bar", bar); } catch (Exception e) { throw new RemoteException(e.getMessage()); } Thread.sleep(DGCDeadLock.TEST_FAIL_TIME);