2.3.2.1. Stateful Session Bean Example

@Stateful public class ASessionBean implements ABusinessInterface {

    // Injected reference to standard session context object
    @Resource public SessionContext sessionContext;

    // Method that is called after construction or activation
    @PostConstruct @PostActivate
    public void myInitMethod () { ... }

    // Method that is called before passivation or destruction
    @PreDestroy @PrePassivate
    public void myDoneMethod () { ... }

    // Some business methods ...
    public void myMethodOne (int iArgument) { ... }
    public int myMethodTwo (Object oArgument) { ... }

    // Business method with asynchronous interface
    @Asynchronous public Future<String> myAsynchronousMethod (String sArgument) { ... }

    // Business method that removes the bean instance
    @Remove public void myRemovalMethod () { ... }

    // Interceptor method that can also be in separate interceptor class
    @AroundInvoke
    public Object myInterceptor (InvocationContext inv)
    throws Exception {
        ...
        Object result = inv.proceed ();
        ...
        return (result);
    }
}

Client life cycle view. 

Container life cycle view.