test/java/rmi/reliability/juicer/AppleUserImpl.java
Print this page
*** 57,76 ****
--- 57,78 ----
* @library ../../testlibrary
*
* @build Apple AppleEvent AppleImpl AppleUserImpl
* @build Orange OrangeEcho OrangeEchoImpl OrangeImpl
* @build ApplicationServer
+ * @build TestLibrary
*
* @run main/othervm/policy=security.policy AppleUserImpl -seconds 30
*
* @author Peter Jones, Nigel Daley
*/
import java.rmi.RemoteException;
import java.rmi.NoSuchObjectException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.registry.LocateRegistry;
+ import java.rmi.registry.Registry;
import java.util.Random;
import java.util.logging.Logger;
import java.util.logging.Level;
/**
*** 78,88 ****
* "apple user" objects exported by the server. The application server
* passes each of its remote "apple" objects to an apple user, and an
* AppleUserThread is created for each apple.
*/
public class AppleUserImpl extends UnicastRemoteObject implements AppleUser {
!
private static final Logger logger =
Logger.getLogger("reliability.appleuser");
private static int threadNum = 0;
private static long testDuration = 0;
private static int maxLevel = 7;
--- 80,90 ----
* "apple user" objects exported by the server. The application server
* passes each of its remote "apple" objects to an apple user, and an
* AppleUserThread is created for each apple.
*/
public class AppleUserImpl extends UnicastRemoteObject implements AppleUser {
! static int REGISTRY_PORT = -1;
private static final Logger logger =
Logger.getLogger("reliability.appleuser");
private static int threadNum = 0;
private static long testDuration = 0;
private static int maxLevel = 7;
*** 306,317 ****
try {
user = new AppleUserImpl();
synchronized (user) {
// create new registry and bind new AppleUserImpl in registry
! LocateRegistry.createRegistry(2006);
! LocateRegistry.getRegistry(2006).rebind("AppleUser",user);
// start the other server if applicable
if (othervm) {
// the other server must be running in a separate process
logger.log(Level.INFO, "Application server must be " +
--- 308,321 ----
try {
user = new AppleUserImpl();
synchronized (user) {
// create new registry and bind new AppleUserImpl in registry
! Registry registry = TestLibrary.createRegistryOnUnusedPort();
! REGISTRY_PORT = TestLibrary.getRegistryPort(registry);
! LocateRegistry.getRegistry(REGISTRY_PORT).rebind("AppleUser",
! user);
// start the other server if applicable
if (othervm) {
// the other server must be running in a separate process
logger.log(Level.INFO, "Application server must be " +