What is a "lightweight" container

xiaoxiao2021-03-06  57

source:

http://spring.jactiongroup.net/viewtopic.php?t=825

Perspective lightweight container

Lightweight container "is increasingly becoming one of the keywords of the Java world. So what is

"Lightweight" container?

I have intentionally mention "Lightweigh Containter" in you browsing the recent article or blog.

With the most like a word,

"IOC", "Dependencies Inject", "AOP", etc.

What is "container"?

Say that there is nothing special place, and in our world. The container is a set of managers that provide a series of services, as long as you meet the service requirements of the container (specification)

The container allows you to use management services within the range. When you are popular in Web, HTTP Container provides us with the ability to resolve HTML,

Let our HTML code can be released to the Internet through the HTTP protocol. With the promotion of web applications, the development of dynamic languages, HTTP containers are gradually

You can use the specified interface to explain the special pieces in a special file, such as PHP, ASP, and more. Then let us uncover the cover of the container and see what is (service).

1, life cycle management

- Since it is necessary to manage the running components (or program fragment), at least you can create it when you need it, it is destroyed when you need it.

2, query positioning

- Determine which component or resource you need to call through a certain policy (usually using file name), which is the main job as a manager.

3, configurable

- Provide a static configuration policy. Let the user can control the details of the service. For example, where is the resource, etc.

4, dependency analysis

- If there is a relationship between the components, or need to communicate with each other. So at least to ensure that they are "live". This needs to analyze the dependencies, dynamic management.

5. Communication support from different protocols

- For program pieces, you can do all the calculations, you need to communicate with different systems (platforms), such as using JDBC and data storage databases, with RMI distribution components

6, expand support

- Extended service items are not only required by containers, but also any software needs. For example, add security strategies.

What is "lightweight"?

Since it is "light", it is a comparative "heavy". The typical representative of "heavy" is EJB, EJB provides a series of "heavyweight" enterprise services, and you can make your own components can be very good.

Integrated EJB containers, such as JTA, etc. So, since there is a service container "who wants to", why still need "lightweight"? This is a good problem.

For a comprehensive EJB container, although gives us a complete service strategy, EJB is not Lei Feng, which also brought us a lot of negative effects. People with EJB experience

Deep feeling:

1. Deploy complex, slow operation

2, more inner service, start slow

3, the rules are very large, the space is small

4, difficult to predict (debug)

...

The service of EJB containers is often "buy one get three", don't do it.

I only need JTA, and I really don't need JMS.

So, in this world of "all the garbage that I use," we need "selectable" service containers, let the services that we useless should not stand here.

Optional is one of the targets of a lightweight container.

Where is "lightweight"?

Since the service of the container can be DIY, then it seems to be "light" a lot. However, things are not so simple.

Before you start, let's review a few keywords 1, packaging

Java itself has to take care of the "Running Anywhere" of non-Java programmers and cooperate with the market.

Non-object-oriented characteristic syntax added thereto. "Do you destroy the package?", Called Java's ten years to dispute the most problem.

2, component development

This word is very technical in the circle of the software, but in the hardware range, which hardware is not a component? Your computer is a variety of components,

They integrate with each interface (slot). Even you are seeing a digital TV set-top box is also a standard component.

3, Running Anywhere

This word is accompanied by a cup of black coffee into our world, although it has become "Debug Anywhere", but this has always been our goal.

Lightweight containers are based on these goals.

In the face of the package, the component particle size has always been the biggest problem of SA. According to the EJB model, the EJB component allows us to encapsulate business components into coarse granular business components.

Lightweight container This can define a finer granular component, and even this component has only one object. Decoupling mode represented by Dependency Injection, Di,

Allows the components to rely on the API of the container (running environment). Di as the pipeline of the container, assumes the role of the middle, allowing the user (Component) and the provider unrelated.

For what particle size to design business components, this is determined by the specific needs of the business, and any framework can't help you.

And the technical support for lightweight containers is also absolutely letting you have.

In the face of components, the real components are like U-Disk in your hand, you can enjoy its feature on your USB.

Lightweight containers have initiative to manage the container by reverse control (Inversion of Control, IOC) and manages the inserted components. As long as the component meets the standard, it can be

Lightweight container management.

In the face of Running Anywhere, the lightweight container allows the components to exist in pojo, as long as you have Java.exe, you can run it.

In this way, the component is at all, an independent functional integrated class, which does not require a container to implement test behavior.

The above three points, give us the benefits, but we will benefit from all aspects of reuse, productivity, test (quality), transplantation, etc., this is not more embarrassed.

Status of lightweight container

Currently, the lightweight container has been widely recognized in the Open Source range, and as the basis of the next generation J2EE architecture, there is an advantage of being comparable.

Currently, there are existing lightweight container frameworks, with most of the Open Source community, which gives us a threshold for this technology.

PicoContainer

http://www.picocontainer.org/

Avalon Apache Software License

Homepage

http://avalon.apache.org/

Nanocontainer

http://www.nanocontainer.org/

Peapod

http://www.peapod.org/

Carbon

http://carbon.sourceforge.net/

EXCALIBUR

Http://excalibur.apache.org/index.html

Gravity

http://gravity.dev.java.net

The above Pico is the leader in this in the Type3 (IOC), and the Spring IoC container has become the leader. The IOC container has brought a far-reaching impact on traditional Container (AS EJB).

转载请注明原文地址:https://www.9cbs.com/read-82461.html

New Post(0)