Sort Example


Sort example shows a stateless session bean which implements a merge-sort algorithm.  This examples demonstrates the basics of how EJBs are compiled, and run in the EJB container. The example also shows off the RMI over IIOP, and shows how objects are put in the JNDI naming service.
 

Building the example


After setting the environment, build the example:

On Solaris:
    prompt% make

   (Please note that Makefile require a Unix-compatible make utility)

On Windows:

    prompt% make_all

The make files are simple enough that they can be modified by hand if need be.
 

Running the Example

To run the example, you will need to have a VisiBroker Smart Agent running. This handles the initial bootstrap issues (e.g., how the client locates the
naming service, etc.)  Please refer to the VisiBroker documentation for more information on installing and using the Smart Agent.

Start the EJB server with the following command:

    prompt% vbj com.inprise.ejb.Container ejbcontainer sort_beans.jar -jts -jns

    (Please see product documentation for more information about the  commandline flags)

Run the client program as:

    prompt% vbj SortClient
 
 

The client will locate, and call the SortBean to sort a set of varying size vectors, and you will see the input, and sorted output vectors on the cosole,
similiar to:

in:  [1]
out: [1]
in:  [1, 2]
out: [1, 2]
in:  [1, 2, 7, 3, 8, 10, 4, 9, 5, 6]
out: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
in:  [-87, 91, 66, 85, -43, 29, 57, 57, 91, 22, -94, 55, 78, 50, 81, 15, -51, 26, 13, 27, -56, -35, 84, 89, -98]
out: [-98, -94, -87, -56, -51, -43, -35, 13, 15, 22, 26, 27, 29, 50, 55, 57, 57, 66, 78, 81, 84, 85, 89, 91, 91]
in:  [-4, 8.0, 3.0, -6, -4, 4]
out: [-6, -4, -4, 3.0, 4, 8.0]
in:  [this, is, a, test]
out: [a, is, test, this]