Unsubscribe From: Thomas Andraschko<mailto:andraschko.tho...@gmail.com> Sent: Thursday, 1 September 2022 11:43 pm To: MyFaces Discussion<mailto:users@myfaces.apache.org> Subject: Re: How to decrease the timeout in Jakarta EE 9.1 CDI Convesation Scope (MyFaces 3.0)
Hi, Conversations are controlled by CDI/openwebbeans, so better ask there fernando cesar de lima <fernandocesarlim...@gmail.com> schrieb am Do., 1. Sept. 2022, 16:59: > Hi, this is Fernando, > > > I am using JSF 3.0 and Conversation Scope in some Managed Beans. The > problem I am facing is to configure the timeout to expire abandoned > conversations. The default 30 minutes is too long for my context and I need > to set this around 10 minutes. I have tried to set the timeout using the > conversation.setTimeout(10000) method, but, even having the TomEE showing > that the correct timeout has been settled, through the > conversation.getTimeout(), it keeps expiring the conversation, and > consequently destroying the managed beans, only after 30 minutes. > > The second approach that I have tried is to create openwebbeans.properties > file inside the META-INF/openwebbeans directory and putting these keys: > > > configuration.ordinal=101 > > org.apache.webbeans.conversation.Conversation.timeoutInterval=10000 > > > Again the results are the same. TomEE shows the correct timeout through the > conversation.getTimeout() method, but keeps expiring the conversation only > after 30 minutes. > > > Following is the code that I have used to test the situation: > > > package estudosjsf; > > import java.io.Serializable; > import java.text.SimpleDateFormat; > import java.util.Date; > > import jakarta.annotation.PostConstruct; > import jakarta.annotation.PreDestroy; > import jakarta.enterprise.context.Conversation; > import jakarta.enterprise.context.ConversationScoped; > import jakarta.inject.Inject; > import jakarta.inject.Named; > > @Named > @ConversationScoped > public class Controller implements Serializable { > > private static final long serialVersionUID = 1L; > > private String text = "This is a simple text"; > > @Inject > private Conversation conversation; > > @PostConstruct > public void create() { > System.out.println("Created at " + new > SimpleDateFormat("HH:mm:ss").format(new Date())); > } > > @PreDestroy > public void destroy() { > System.out.println("Destroyed at " + new > SimpleDateFormat("HH:mm:ss").format(new Date())); > } > > public void begin() { > conversation.begin(); > conversation.setTimeout(10000); > System.out.println(conversation.getTimeout()); > } > > public void end() { > conversation.end(); > } > > public String getText() { > return text; > } > > public void setText(String text) { > this.text = text; > } > > } > > > I really appreciate any help > > Thanks you very much >