Java Examples for org.wildfly.transaction.client.RemoteTransactionContext
The following java examples will help you to understand the usage of org.wildfly.transaction.client.RemoteTransactionContext. These source code samples are taken from different open source projects.
Example 1
| Project: jboss-ejb-client-master File: EJBClient.java View source code |
/**
* Get a {@code UserTransaction} object instance which can be used to control transactions on a specific node.
*
* @param targetNodeName the node name
* @return the {@code UserTransaction} instance
* @throws IllegalStateException if the transaction context isn't set or cannot provide a {@code UserTransaction} instance
*/
@Deprecated
@SuppressWarnings("unused")
public static UserTransaction getUserTransaction(String targetNodeName) {
final URI uri;
try (final ServicesQueue queue = EJBClientContext.getCurrent().getDiscovery().discover(EJBClientContext.EJB_SERVICE_TYPE, FilterSpec.equal(EJBClientContext.FILTER_ATTR_NODE, targetNodeName))) {
uri = queue.take();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IllegalStateException(e);
}
if (uri == null) {
throw Logs.MAIN.userTxNotSupportedByTxContext();
}
return RemoteTransactionContext.getInstance().getUserTransaction(uri);
}