The JEE containers provide a wrapper around your source code.
Typical containers are the classic EJB data bean, and, the message driven bean. To a certain extent servlets and portlets can also be regarded as containers.
What the container provides a large number of services:-
- invocation -- your code gets loaded and started when required.
- transactional context -- most container code occurs in an ACID transaction context.
- configuration -- things like JDBC connections are passed to you by the container.
- security -- the container will restrict access to your code and data to authorized users.
- scalability -- since the container is in charge of scheduling it can automatically fire up extra copies if the load gets heavy, or, can be statically configured to run several instances in parallel.
- Encapsulation. Your program exposes a single interface to the container. However, externally it may expose this interface in a variety of forms (Corba,WSDL,JSM etc.).
- Common services. such as logging, services exposed by other EJBs. etc.