Goals of the @Remove method in stateful EJB

I understand that calling the annotated method @Removetells the EJB container that the client no longer needs an EJB instance with a state and that it can be deleted after the call.

But in the Oracle JEE tutorial, this method is used to "clean up" an instance. See here for example:

@Stateful
public class CartBean implements Cart {
    // ...
    List<String> contents;
    // ...
    @Remove
    public void remove() {
        contents = null;
    }
}

(from https://docs.oracle.com/javaee/6/tutorial/doc/bnbod.html )

The item is List<String> contents;set to null, but I see no reason for this. When an instance is dropped, will it not kill all of these types of links at all?

, -, @Remove @PreDestroy, , , @Remove, EJBContainer.remove(myBean)

@Remove / , , ?

+4
1

@Remove @PreDestroy . @Remove, , , - EJB -, EJB, @PreDestroy, Bean.

, !

+1

Source: https://habr.com/ru/post/1588865/


All Articles