java - UserTransaction.SetTransactionTimeout not working? -


In the following code I am trying to end a transaction time for a specific bean whose deadline method to complete.

The timeout is set to 3 seconds , and the method to complete it takes 5 seconds .

I am using a portable solution that refers to the combination of BMT and determines timeout with the method.

I hope this transaction will cancel me to throw an exception, but

What am I doing wrong?

  @Singleton @ startup @ Transaction Management (transaction management type .bn) public class TimerConclusion {@ Inject Private Youtube Transaction UT; @PostConstruct executes public null () throws exception {ut.begin (); Ut.setTransactionTimeout (3); // transaction should be timeout after 3 seconds System.out.println ("> gt;>> execution ..."); Thread.Sleep (5000); // block ut.commit for 5 seconds; System.out.println ("& gt; completed"); }}  

The method is fully executed:

  17: 00: 12,138 INFO [stdout] (server service thread pool - 85) & gt; & Gt; & Gt; Executed ... 17: 00: 17,139 information [stdout] (server service thread pool - 85) & gt; & Gt; & Gt;  

I am using Wildfire 8.2 and I know about @TransactionTimeout annotation, but it is owned and I would like to know that it is in portable How to control Before setting, the setTransactionTimeout method should be applied.

method, this is because setTransactionTimeout by the current thread Modifies the timeout value associated with the transaction initiated with the start method.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -