< prev index next >

test/sun/rmi/rmic/newrmic/equivalence/AppleUserImpl.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 236                 }
 237             }
 238             if (durationString == null) {
 239                 durationString = testDuration + " milliseconds";
 240             }
 241         } catch (Throwable t) {
 242             usage();
 243         }
 244 
 245         AppleUserImpl user = null;
 246         try {
 247             user = new AppleUserImpl();
 248         } catch (RemoteException e) {
 249             //TestLibrary.bomb("Failed to create AppleUser", e);
 250         }
 251 
 252         synchronized (user) {
 253             int port = -1;
 254             // create new registry and bind new AppleUserImpl in registry
 255             try {
 256                 Registry registry = TestLibrary.createRegistryOnUnusedPort();
 257                 port = TestLibrary.getRegistryPort(registry);
 258                 Naming.rebind("rmi://localhost:" + port + "/AppleUser",user);
 259             } catch (RemoteException e) {
 260                 //TestLibrary.bomb("Failed to bind AppleUser", e);
 261             } catch (java.net.MalformedURLException e) {
 262                 //TestLibrary.bomb("Failed to bind AppleUser", e);
 263             }
 264 
 265             // start the other server if available
 266             try {
 267                 Class app = Class.forName("ApplicationServer");
 268                 java.lang.reflect.Constructor appConstructor =
 269                         app.getDeclaredConstructor(new Class[] {Integer.TYPE});
 270                 server = new Thread((Runnable) appConstructor.newInstance(port));
 271             } catch (ClassNotFoundException e) {
 272                 // assume the other server is running in a separate process
 273                 logger.log(Level.INFO, "Application server must be " +
 274                     "started in separate process");
 275             } catch (Exception ie) {
 276                 //TestLibrary.bomb("Could not instantiate server", ie);


   1 /*
   2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 236                 }
 237             }
 238             if (durationString == null) {
 239                 durationString = testDuration + " milliseconds";
 240             }
 241         } catch (Throwable t) {
 242             usage();
 243         }
 244 
 245         AppleUserImpl user = null;
 246         try {
 247             user = new AppleUserImpl();
 248         } catch (RemoteException e) {
 249             //TestLibrary.bomb("Failed to create AppleUser", e);
 250         }
 251 
 252         synchronized (user) {
 253             int port = -1;
 254             // create new registry and bind new AppleUserImpl in registry
 255             try {
 256                 Registry registry = TestLibrary.createRegistryOnEphemeralPort();
 257                 port = TestLibrary.getRegistryPort(registry);
 258                 Naming.rebind("rmi://localhost:" + port + "/AppleUser",user);
 259             } catch (RemoteException e) {
 260                 //TestLibrary.bomb("Failed to bind AppleUser", e);
 261             } catch (java.net.MalformedURLException e) {
 262                 //TestLibrary.bomb("Failed to bind AppleUser", e);
 263             }
 264 
 265             // start the other server if available
 266             try {
 267                 Class app = Class.forName("ApplicationServer");
 268                 java.lang.reflect.Constructor appConstructor =
 269                         app.getDeclaredConstructor(new Class[] {Integer.TYPE});
 270                 server = new Thread((Runnable) appConstructor.newInstance(port));
 271             } catch (ClassNotFoundException e) {
 272                 // assume the other server is running in a separate process
 273                 logger.log(Level.INFO, "Application server must be " +
 274                     "started in separate process");
 275             } catch (Exception ie) {
 276                 //TestLibrary.bomb("Could not instantiate server", ie);


< prev index next >