All Examples All Cluster Examples This Example
Class examples.cluster.ejb.Client
java.lang.Object
|
+----examples.cluster.ejb.Client
- public class Client
- extends Object
This class illustrates load balancing and failover
using a container-managed JDBC EntityBean.
You'll need to have a properly configured database with
the appropriate tables loaded before running this example.
- It starts a loop, performs repeated balance lookups, deposits,
withdrawls and transfers into two accounts
- If a transaction fails, it checks if the transaction was
actually committed; if not, it retries the transaction
- It then displays statistics showing which servers performed each invocation
The client demonstrates:
- Writing a client to take advantage of load balancing and failover in
a clustered setting
- Container-managed persistence
- How to search the JNDI tree for an appropriate container
- Application-defined exceptions
- Author:
- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
-
getInitialContext()
- Gets an initial context for the current user, password and url.
-
main(String[])
- Runs this example from the command line.
main
public static void main(String args[])
- Runs this example from the command line. Example:
java examples.cluster.ejb.Client "t3://localhost:7001" scott tiger
The parameters are optional, but if any are supplied,
they are interpreted in this order:
- Parameters:
- url - URL such as "t3://localhost:7001" of a Server or Cluster
- user - User name, default null
- password - User password, default null
getInitialContext
public static Context getInitialContext() throws Exception
- Gets an initial context for the current user, password and url.
- Returns:
- Context
- Throws: Exception
- if there is
an error in getting the Context
All Examples All Cluster Examples This Example