Distributed applications need middleware services: security, transactions, threading, network communication. Who should write this code—the application developer or the infrastructure?
- Explicit Middleware: Developer manually writes code for networking, security, threading. You control everything but spend 80% of your time on infrastructure.
- Implicit Middleware: The EJB container automatically handles middleware services. Developer writes only business logic; the server manages security, transactions, and networking behind the scenes.
| Aspect | Explicit Middleware | Implicit Middleware (EJB) |
|---|---|---|
| Networking | Developer writes socket/RMI code | Container generates stubs/skeletons |
| Security | Developer checks permissions in code | Container intercepts and checks roles |
| Transactions | Developer begins/commits transactions | Container manages via deployment descriptor |
| Threading | Developer manages thread pools | Container manages bean pooling |
- Implicit middleware = Productivity: Developer focuses on business value, not infrastructure
- EJB Container is the implicit middleware provider: It intercepts calls and adds services
- Declarative approach: In EJB, you declare requirements in
ejb-jar.xml—container implements them - Vendor-specific: Each container provider (JBoss, WebLogic) implements the implicit middleware differently
- Built from: Middleware, EJB Container
- Builds into: Transactions, JNDI (both provided implicitly)
- Contrasts with: RMI (explicit—you write all networking code)
- Related: CMT vs BMT
- Debugging is harder with implicit middleware: When something fails, is it your code or the container?
- Less control: You can’t fine-tune threading or connection pools—container decides
- Vendor lock-in: Implicit middleware behavior varies across vendors (though standard APIs stay same)