Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Enrolling Sync Remote Operations in a Transaction

Hello,

I have two PUs each of which provides a remote method. The remote method implementations each act on a local space. Each method implementation is transactional using a local transaction manager. I have a non-PU client that calls first one and then the other. They both execute fine, each under its own transaction.

Now I want to execute both of them under the same transaction. I use namespace to create a distributed transaction manager and attach it to the two proxies used by the client to invoke the remote methods. I mark the client method (which is in a bean that is managed by the Spring application context) as @Transactional, and specify annotation-driven transactions in the context file, referring explicitly to the distributed transaction manager I created. As far as I can tell from the documentation:

====== Transactional Execution

Sync remoting supports transactional execution of services. On the client side, if there is an ongoing declarative transaction during the service invocation (a Space based transaction), the service will be executed under the same transaction. The transaction itself is passed to the server and any Space related operations (performed using GigaSpace) will be executed under the same transaction. The transaction lifecycle itself is controlled on the client side (declaratively) and is committed / rolled back only on the client side. (Note, exceptions on the server side will simply propagate to the client side, and will cause a rollback only if the client "decides" so.)

When using broadcast with sync remoting, a declarative distributed transaction must be used and not a local (or JTA one). Also note, the GigaSpace instance that is used internally by the sync remoting invocation must be configured with a transaction manager (as is the case for enabling transaction execution with any other GigaSpace based operation).

this is what I am supposed to do. When I run the client, I see that mahalo starts but the two remote methods execute as before, each under its own independent local transaction.

I also tried switching the transaction managers used by the remote methods to distributed, although each operates on one single-partitioned space. The results are the same except that the two independent transactions under which the two remote method operate are Jini instead of Local.

What am I missing? How do I get the two RMI invocations to execute under a single distributed transaction under the control of my non-PU client?

I'm attaching the code in case you can't spot the problem from the description above.

Thanks for your help.

-Dan

Enrolling Sync Remote Operations in a Transaction

Hello,

I have two PUs each of which provides a remote method. The remote method implementations each act on a local space. Each method implementation is transactional using a local transaction manager. I have a non-PU client that calls first one and then the other. They both execute fine, each under its own transaction.

Now I want to execute both of them under the same transaction. I use namespace to create a distributed transaction manager and attach it to the two proxies used by the client to invoke the remote methods. I mark the client method (which is in a bean that is managed by the Spring application context) as @Transactional, and specify annotation-driven transactions in the context file, referring explicitly to the distributed transaction manager I created. As far as I can tell from the documentation:

====== Transactional Execution

Sync remoting supports transactional execution of services. On the client side, if there is an ongoing declarative transaction during the service invocation (a Space based transaction), the service will be executed under the same transaction. The transaction itself is passed to the server and any Space related operations (performed using GigaSpace) will be executed under the same transaction. The transaction lifecycle itself is controlled on the client side (declaratively) and is committed / rolled back only on the client side. (Note, exceptions on the server side will simply propagate to the client side, and will cause a rollback only if the client "decides" so.)

When using broadcast with sync remoting, a declarative distributed transaction must be used and not a local (or JTA one). Also note, the GigaSpace instance that is used internally by the sync remoting invocation must be configured with a transaction manager (as is the case for enabling transaction execution with any other GigaSpace based operation).

this is what I am supposed to do. When I run the client, I see that mahalo starts but the two remote methods execute as before, each under its own independent local transaction.

I also tried switching the transaction managers used by the remote methods to distributed, although each operates on one single-partitioned space. The results are the same except that the two independent transactions under which the two remote method operate are Jini instead of Local.

What am I missing? How do I get the two RMI invocations to execute under a single distributed transaction under the control of my non-PU client?

I'm attaching the code in case you can't spot the problem from the description above.

Thanks for your help.

-Dan