/*
* 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.
*/
/**
* The ApplicationServer class provides the other server side of the "juicer"
* stress test of RMI.
*/
/** number of remote Apple objects to export */
private final int numApples;
private final int registryPort;
}
this.registryHost = registryHost;
this.registryPort = registryPort;
}
/*
* On initialization, export remote objects and register
* them with server.
*/
public void run() {
try {
int i = 0;
/*
* Locate apple user object in registry. The lookup will
* occur until it is successful or fails LOOKUP_ATTEMPTS times.
* These repeated attempts allow the ApplicationServer
* to be started before the AppleUserImpl.
*/
for (i = 0; i < LOOKUP_ATTEMPTS; i++) {
try {
break; //successfully obtained AppleUser
} catch (Exception e) {
exc = e;
}
}
return;
}
/*
* Create and export apple implementations.
*/
try {
for (i = 0; i < numApples; i++) {
}
} catch (RemoteException e) {
"Failed to create AppleImpl #" + (i + 1) + ":", e);
user.reportException(e);
return;
}
/*
* Hand apple objects to apple user.
*/
try {
for (i = 0; i < numApples; i++) {
}
} catch (RemoteException e) {
user.reportException(e);
return;
}
} catch (Exception e) {
}
}
private static void usage() {
"which contains AppleUser.");
"on.");
}
int num = DEFAULT_NUMAPPLES;
int port = -1;
// parse command line args
try {
i++;
i++;
i++;
} else {
usage();
}
}
if (port == -1) {
usage();
throw new RuntimeException("Port must be specified.");
}
} catch (Throwable t) {
usage();
throw new RuntimeException("TEST FAILED: Bad argument");
}
// start the client server
// main should exit once all exported remote objects are gc'd
}
}