Java 有状态会话bean和remove()方法

Java 有状态会话bean和remove()方法,java,jakarta-ee,Java,Jakarta Ee,我有一个JavaEE有状态会话bean: @Stateful(passivationCapable=false) public class Session { @Inject private Services services; private Item item; private List<Item> items; .. @Remove public void remove() { // do I have to make this manually? // Or wi

我有一个JavaEE有状态会话bean:

@Stateful(passivationCapable=false)
public class Session {

@Inject
private Services services;

private Item item;
private List<Item> items;

..

@Remove
public void remove() { 
// do I have to make this manually? 
// Or will the container set this automatically to null after `remove` is called?
item = null;
items = null;
services = null;
}
}
@Stateful(钝化能力=false)
公开课{
@注入
私人服务;
私人物品;
私人清单项目;
..
@除去
public void remove(){
//我必须手动进行吗?
//或者在调用'remove'后,容器会自动将其设置为null吗?
item=null;
items=null;
服务=空;
}
}
remove()
-方法将
会话的实例属性设置为
null


我必须手动执行此操作吗?或者在调用
remove
后,容器会自动将其设置为null吗?

调用
remove()
方法后,会话类的实例将消失。不需要将members变量设置为null。但是,如果您确实打开了一个连接,则必须关闭该连接或类似连接。@Mark谢谢。我将接受这一点作为答案。调用
remove()
方法后,会话类的实例将消失。不需要将members变量设置为null。但是,如果您确实打开了一个连接,则必须关闭该连接或类似连接。@Mark谢谢。我会接受这个答案。。