Home > Articles > Programming > Java

This chapter is from the book

1.6 EJB products

To construct EJB applications, you will need an EJB server, or something that includes an EJB server. This section discusses the features you can expect an EJB server to have—in addition to support for the EJB Specification, of course—and lists some products that are currently available.

1.6.1 Features of EJB products

The EJB architecture was developed to support large, critical (high reliability), distributed applications. It is the responsibility of the EJB server vendor to provide a product that allows this goal to be met. The EJB Specification has little to say about the ways in which it will do this. In practice, containers normally use some or all of the following strategies.

Load sharing

In many large systems, a single server—however powerful—will not be able to support the total load of the application. In any case, one large system is less effective than two smaller ones at handling failures. In practice, therefore, all commercial EJB products are able to distribute load between servers.

Gotcha!

Strictly speaking, to claim J2EE compliance for a product, a vendor must be able to produce the results of standard J2EE compliance tests. Not all vendors do so, but this does not necessarily mean the product is noncompliant or inadequate. Moreover, even demonstrable compliance says little about the product's support for load balancing, fault tolerance, or other features likely to be important in an enterprise application. What is worse, some of the compatibility tests are not very demanding and are easy to pass. This allows some vendors to claim compliance and yet have a product that is weak in certain areas. In short, don't assume that all EJB products that carry the stamp 'J2EE compliant' are equivalent. Determine the features that are important to your projects, and ask vendors what support is provided for each feature.

As a client's first access to an EJB service is via a name-service lookup, coarse-grained load sharing can be implemented at the point in which the EJB's factory object is looked up (more about factory objects later). Each successive request for the same EJB factory can be directed to a different server, with the EJB itself distributed on all the servers. This process can be governed by the name lookup service (on the server), or by the client. In the latter case, typically the work will be done in a proxy on the client, so that the developer does not have to code the client differently.

Such a strategy is straightforward to implement and can work reasonably well where the number of clients is large and the load imposed by each client relatively small. With a small number of demanding clients, load can easily get out of balance, as there is no opportunity for rebalancing once the factory object has been located.

Alternatively, we can balance at the method call level, if EJBs are pooled or the instance variables of unpooled EJBs can be synchronized across servers. This allows more rapid adaptation to changes in load, but is complex to implement.

In practice, load sharing is much more complicated than it first appears. The reason is that some EJB components—notably stateful session EJBs—have state that is meaningful to a client. This means that requests from the client cannot be distributed arbitrarily. Instead, they must either be bound to the server on which that client's state is stored, or we must provide a method for synchronizing the state across servers. This issue will be discussed in more detail later, when we look at failover strategies.

Needless to say, the method of load balancing will depend on the server vendor but, if you follow the rules set out in the EJB Specification and the guidance given in this book, this should not present a problem.

Resource pooling

The most common form of resource pooling is database connection pooling, which is supported by all commercial EJB products. This topic is discussed in detail in Chapter 8. The purpose of resource pooling is to allow large numbers of Java objects to have access to a small number of instances of a shared resource. In the case of database connections, these are computationally expensive to open and resource-hungry to maintain. A connection pooling scheme allows the mapping of a large number of 'virtual' connections onto a much smaller number of real connections to the database. The J2EE scheme defines a method for access to shared resources that abstracts away from the underlying resource management system. This means that, to a large extent, the Java code required to interact with the resource is the same as it would be without the application server. However, resource pooling schemes work best if the code does not hinder their operation, so an understanding of their operation is advantageous.

Failover and redundancy

In critical applications, we need to be sure that if a single server fails, the application itself can continue to operate, albeit at reduced performance. Any load sharing system will allow a degree of fault tolerance; it is the ability to handle a failure with no loss of service that distinguishes such a scheme from true 'failover.' In order to achieve a failover with no loss of service, clients must continue to be able to interact with the EJB application without interruption. This is straightforward for EJBs that have no client state, but where state is involved there is more to it. We have already seen that we could avoid the problem of state in load sharing simply by binding incoming client requests to the server that is carrying the client's state. For failover, this simply won't do: We must find a way to synchronize the state.

The problem is that, unlike servlets (page 549), EJBs do not keep their state in nice, neat packets. The state of an EJB is in its instance variables, and the instance variables of its instance variables, and so on. Synchronizing these efficiently is a far from straightforward job. Happily, it's a job for the server vendor, not for the application developer.

A number of EJB products are now able to offer failover support for stateful session beans. Typically, the EJB instance that is most up-to-date has to be serialized, and the serialized version recreated on each participating server. For maximum reliability, this needs to happen after every method call that changes an instance variable. Clearly, this could be very ine3cient if used carelessly.

1.6.2 Integration

Many enterprise-scale EJB products also offer impressive support for other distributed component technologies, notably CORBA. In addition, an EJB product is likely to be a part of a larger application server that includes some or all of the following:

  • support for other J2EE components, such as servlets and JSPs;

  • a distributed transaction manager;

  • a relational database;

  • a directory server;

  • a messaging service.

In addition, many products provide vendor-specific extensions that allow EJBs to integrate with popular back-end systems like SAP R/3. The problem with vendor-specific extensions is, of course, that the EJBs that use them are not portable across servers. JCA is starting to alleviate this problem, by providing a cross-platform technique for interfacing with arbitrary data sources.

1.6.3 Platform support

If an EJB server is written entirely in Java (a few are), then it may be possible to produce a truly platform-independent product. In reality, this is unusual. Most products either include native machine code components or communicate with other services that are themselves platform-specific. In practice, vendors typically support a small number of platforms, often limited to Sun Solaris on Sparc platforms, and Microsoft Windows NT on Intel-based PCs. Only a few vendors (notably IBM) support an impressively large range of platforms. At the time of writing, support for Microsoft Windows 2000 and Linux, for example, was scant.

1.6.4 Vendors and products

There are a number of products on the market that support EJB applications, as well as a number of open source EJB servers. However, there are relatively few dedicated EJB servers commercially available. Normally, one has to buy a product that supports EJBs as part of a wider set of functionality. Commercial products that support EJBs tend to fall into two groups.

  • Database engines with EJB support. Many vendors with strong reputations in the relational database field are producing EJB products that integrate with their databases. Typical examples are Oracle's 8i and 9i and, to a certain extent, IBM's WebSphere.

  • Well-established application servers whose vendors have embraced the J2EE model and adapted their products to support EJB. Examples include the SunONE Application Server4from Sun Microsystems, and products from Pra-mati and Gemstone.

Another group, which is currently small but likely to expand, is products from vendors of development tools and IDEs (e.g., Borland's Inprise).

Knowing a product's background gives some clue to the areas in which it is likely to excel. For example, a product from a database vendor should be able to offer a high degree of optimization of database performance. A product from an IDE vendor should o3er ease of development. Of course, all products, regardless of heritage, should support the functionality required by the EJB Specification.

Table 1.1 lists some of the products available that include support for EJB 1.1 or later. This list was probably not exhaustive at the time it was written, and it certainly won't be exhaustive by the time you read it.

When considering the price of an EJB product, bear in mind that a product that supports the full range of J2EE services (servlets, JSP, etc.) is almost certainly going to be more expensive that a dedicated EJB server. If it includes a database and a distributed transaction manager as well, then it is likely to be very expensive indeed.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020