• ↑↓ to navigate
  • ↵ to open
  • ⟶ to select
  • ⌘ ⌥ ↵ to open in a panel
  • ←→ to navigate
  • esc to dismiss
⌘ '
keyboard shortcuts

The Problem

When the EJB container needs to reduce the pool size and destroy a bean instance, how does the bean clean up its association with the EntityContext?

Core Idea

unsetEntityContext() is called by the container right before destroying a bean instance. It allows the bean to release any resources acquired in setEntityContext().

How It Works

  • Container decides to remove a bean instance from the pool
  • Container calls unsetEntityContext() to disassociate the bean from its context
  • Bean should release any resources (connections, references)
  • Bean instance becomes eligible for garbage collection

Key Properties

  • Called when container wants to shrink the pool
  • Bean should clean up resources acquired in setEntityContext()
  • Context is set to null after this call

Visual Explanation

unsetEntityContext__ A Unsetentitycontext() Input B Unsetentitycontext() Core Mechanism A->B triggers C Unsetentitycontext() Output B->C produces

Semantic Network

semantic_unsetEntityContext__ THIS Unsetentitycontext() REL1 Related Concept THIS--REL1 related REL2 Builds Into THIS--REL2 builds into

Edge Cases & Gotchas

  • Don’t perform database operations—call ejbRemove() first if needed