--
You received this message because you are subscribed to the Google Groups "Activate Persistence Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to activate-persist...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The asyncTransactionalChain is designed to be used when using queries that produce other futures.If the transaction doesn’t have a query the method to be used is asyncTransactional, so your code would be:asyncTransactional {new MyEntity("Pierre")}Let me know if the explanation clarifies. :)
Cheers,--Flavio W. BrasilOn Friday, December 12, 2014 at 12:41 PM, lbedu...@gmail.com wrote:
Hello,--I am new to Activate framework and I am testing Activate async support.It seems to work great except that I had a hard time making an async transactionI lost 1 hour fighting with a net.fwbrasil.radon.RequiredTransactionExceptionasyncTransactionalChain { implicit context =>.... more work inside the transaction ...new MyEntity("Pierre").... more work inside the transaction ...}Turned out I had to delimit the Entity creation with a future :import scala.concurrent._asyncTransactionalChain { implicit context =>.... more work inside the transaction ...future { new MyEntity("Pierre") }.... more work inside the transaction ...}I don't know if it's really that OK nor if a rollback would work (have to test it) but it's the only solution I found to create a new Entity inside the asyncTransaction.Maybe the doc should explain this (maybe I am tired and missed the example too:)RegardsLaurent
You received this message because you are subscribed to the Google Groups "Activate Persistence Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to activate-persistence+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to activate-persistence+unsubscrib...@googlegroups.com.
On Saturday, December 13, 2014 at 9:32 AM, Laurent Bedubourg wrote:
Hello,I did a few more tests (playing with undertow) and it occurred to me that there's another thread which calls the future onResult callback.In fact it looks like the API / driver use the scala future API on top of the java nio Future api.If I understood correctly the former uses threads to handle concurrency whereas the later only works with Listeners which are invoked by one nio thread when some data is ready to process.1/ I am a little bit afraid of the extra complexity of creating threads for each SQL(or other) request/transaction whereas NIO is designed to avoid that. Am I too paranoid ? :)
2/ when I create a new Entity, I imagine that there are database queries triggered by the constructor? Hence the thread is probably locked to await replies. I understood that async API should never lock the current thread. Maybe an Entity factory should be used instead of direct constructor call?