Browse DevX
Sign up for e-mail newsletters from DevX


The COR Pattern Puts Your J2EE Development on the Fast Track

Find out how the "Chain Of Responsibility" pattern can rein in your beans and facades to meet evolving business requirements. Route client requests transparently to EJB server components without hardwiring client/server interactions or worrying about low-level plumbing issues.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

he Chain of Responsibility (COR) pattern is a behavioral pattern for decoupling requests from request handlers. It transparently routes requests to the appropriate handler and can (depending on the dispatching semantics) give multiple handlers an opportunity to handle the request. New handlers may be quickly and easily added to provide increased functionality.

For growing J2EE projects, this pattern can accelerate development by:

  • streamlining the introduction of new services
  • centralizing transaction or security concerns
  • minimizing plumbing overheads
  • reducing the number of Session Beans

The COR pattern provides a dynamic, loosely coupled interface for your client/server communication. It enables server components to be added transparently, without affecting your clients or requiring additional plumbing code. Alternatives such as session facades hardwire client/server interactions, and they provide structure and type-safety but at the expense of flexibility and maintenance. The client must always know which facade to call, so it is never totally decoupled: change a facade signature and the client has to change as well; add a session bean and the facade requires a new method. Your facades can quickly become bloated with too many fine-grained methods. Before long you have class files that are thousands of lines long, difficult to read, slow to load, and hard to maintain. Use the COR pattern to decouple your client/server components so that they can be evolved easily and independently.

With COR, you can fast-track your J2EE development so that your developers spend less time building infrastructure (Beans, facades, facade implementations, and service locators) and more time solving real business problems.

How the COR Pattern Works
The COR manager/dispatcher is responsible for managing a set of related services or request handlers (see Figure 1). Requests are sent to the COR manager and transparently dispatched to the appropriate underlying service. The request is passed to each service, giving the service a chance to process the request. One or more services process the request and return the response to the caller. The chain of services may be short or arbitrarily long.

Figure 1: The Chain of Responsibility Pattern

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date