users@concurrency-ee-spec.java.net

[jsr236-spec users] Re: Fw: multiple tasks in a single transaction

From: Nathan Rauh <naterauh_at_us.ibm.com>
Date: Tue, 3 Mar 2015 11:36:27 -0600

JSR 236 does not currently provide a behavior where the transaction of the
submitting thread is propagated to tasks. In order for it to be possible
to do what you are asking, the specification would need to add an option
like USE_TRANSACTION_OF_SUBMITTING_THREAD for the TRANSACTION execution
property. The option you mentioned, USE_TRANSACTION_OF_EXECUTION_THREAD,
is primarily useful for invoking contextual proxies (from a
ContextService) within the transaction of the current thread of execution,
rather than for executors because typical executors run tasks on separate
threads, probably from a thread pool, in which case the thread of
execution does not have an existing transaction.

Should we consider adding this capability in a future version of the spec?

Nathan Rauh
____________________________________________
Software Engineer, WebSphere Application Server
IBM Rochester Bldg 030-2 C310
3605 Highway 52N
Rochester, MN 55901-7802



From: Frederick W Rowe/Raleigh/IBM
To: Nathan Rauh/Rochester/IBM_at_IBMUS
Date: 03/03/2015 11:10 AM
Subject: Fw: [jsr236-spec users] multiple tasks in a single
transaction


fyi


Regards,

Fred Rowe

WebSphere Architect
Senior Software Engineer
IBM Systems (formally IBM Software Group)
frowe_at_us.ibm.com
----- Forwarded by Frederick W Rowe/Raleigh/IBM on 03/03/2015 10:08 AM
-----

From: <frolovmx_at_gmail.com>
To: users_at_concurrency-ee-spec.java.net
Date: 03/03/2015 02:30 AM
Subject: [jsr236-spec users] multiple tasks in a single transaction



Prior to JSR236 In my application computed multiple I/O and CPU
intensive tasks sequentially in a single long running transaction.

I'm not sure whether JSR-236 can help me to execute some of the tasks
in parallel.

The main requirement of my application is to execute all tasks in a
single transaction.

Currently the transaction is started by container when client calls an
@Remote or @Webservice @Stateless EJB method.

What I already tried is to create tasks/threads in EJB method using
ManagedExecutorService, ContextService and
USE_TRANSACTION_OF_EXECUTION_THREAD property. But the tasks are always
executed without existing transaction.

Is it possible with JSR-236 to execute multiple tasks in parallel in a
one single transaction?