@PreDestroy

Javadoc

The @PreDestroy annotation makes it possible to run cleanup code just after the EJB is taken out of service.

  @PreDestroy
  public void destroy() {
    // put your cleanup code here.
  }