0
votes

According to below, we can call Java code from javascript adapter.

Calling Java code from a JavaScript adapter
http://www-01.ibm.com/support/knowledgecenter/?lang=en#!/SSZH4A_6.2.0/com.ibm.worklight.dev.doc/devref/t_calling_java_code_from_a_javas.html

We plan to install worklight server on WAS full profile. WAS full profile supports two-phase commit.

Transaction support in WebSphere Application Server< br/> http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/cjta_trans.html?cp=SSAW57_8.5.5%2F3-2-7-3&lang=en

To call java code from adapter, we need to deploy it on "Worklight server". Can we use two-phase commit in java code? Are there any limitations when using java code on worklight server?

Thanks in advance!

1

1 Answers

1
votes

The only limitation I am aware of is that the WAS security context is not propagated to Worklight adapter's thread. But generally speaking, the same capabilities exist and the same servlet API is available.

You can read more about Java Vs JavaScript in adapters, in this question: Worklight Adapters - Java vs JavaScript

That said, two-phase commit was never tested in practice, so it may work and may not work... for the same reason as the security context mentioned above. As a transaction is usually associated with a thread, and that thread is not available for Worklight adapters which are using their own thread pool.

This limitation mentioned above may be removed in a future release of Worklight, which in turn may make it possible to use the two-phase commit feature.