/*
* 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 AppleUserImpl class implements the behavior of the remote
* "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
{
}
/**
* Allows the other server process to indicate that it is ready
* to start "juicing".
*/
this.notifyAll();
}
/**
* Allows the other server process to report an exception to this
* process and thereby terminate the test.
*/
synchronized (AppleUserImpl.class) {
AppleUserImpl.class.notifyAll();
}
}
/**
* "Use" supplied apple object. Create an AppleUserThread to
* stress it out.
*/
threadName + ": AppleUserImpl.useApple(): BEGIN");
AppleUserThread t =
t.start();
threadName + ": AppleUserImpl.useApple(): END");
}
/**
* The AppleUserThread class repeatedly invokes calls on its associated
* Apple object to stress the RMI system.
*/
super(name);
}
public void run() {
int orangeNum = 0;
try {
do { // loop until stopTime is reached
/*
* Notify apple with some apple events. This tests
* serialization of arrays.
*/
}
/*
* Request a new orange object be created in
* the application server.
*/
/*
* Create a large message of random ints to pass to orange.
*/
}
/*
* Invoke recursive call on the orange. Base case
* of recursion inverts messgage.
*/
/*
* Verify message was properly inverted and not corrupted
* through all the recursive method invocations.
*/
throw new RuntimeException(
"ERROR: CORRUPTED RESPONSE: " +
"wrong length of returned array " + "(should be " +
}
throw new RuntimeException(
"ERROR: CORRUPTED RESPONSE: " +
" of returned array (should be " +
}
}
try {
} catch (InterruptedException e) {
}
} catch (Exception e) {
status = e;
}
synchronized (AppleUserImpl.class) {
AppleUserImpl.class.notifyAll();
}
}
}
private static void usage() {
"-seconds <seconds>]");
//TestLibrary.bomb("Bad argument");
}
/**
* Entry point for the "juicer" server process. Create and export
* an apple user implementation in an rmiregistry running on localhost.
*/
{
//TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
long startTime = 0;
// parse command line args
try {
if (durationString != null) {
usage();
}
i++;
if (durationString != null) {
usage();
}
i++;
i++;
} else {
usage();
}
}
if (durationString == null) {
}
} catch (Throwable t) {
usage();
}
try {
user = new AppleUserImpl();
} catch (RemoteException e) {
//TestLibrary.bomb("Failed to create AppleUser", e);
}
synchronized (user) {
int port = -1;
// create new registry and bind new AppleUserImpl in registry
try {
} catch (RemoteException e) {
//TestLibrary.bomb("Failed to bind AppleUser", e);
//TestLibrary.bomb("Failed to bind AppleUser", e);
}
// start the other server if available
try {
} catch (ClassNotFoundException e) {
// assume the other server is running in a separate process
"started in separate process");
//TestLibrary.bomb("Could not instantiate server", ie);
}
// wait for other server to call startTest method
try {
"process to start");
} catch (InterruptedException ie) {
//TestLibrary.bomb("AppleUserImpl interrupted", ie);
}
}
// wait for exception to be reported or first thread to complete
try {
"test to complete or exception to be thrown");
synchronized (AppleUserImpl.class) {
AppleUserImpl.class.wait();
}
//TestLibrary.bomb("juicer server reported an exception", status);
} else {
}
} catch (Exception e) {
//TestLibrary.bomb("unexpected exception", e);
} finally {
}
}
}