Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-25242

[GSS](7.4.z) WEJBHTTP-103 - wildfly-http-client does not preserve transaction Contextuals on invocation

XMLWordPrintable

    • False
    • None
    • False

      The wildfly-http-client library is used to allow EJB client applications to invoke EJB client-related operations using the HTTP protocol. These EJB client invocations may be invoked while in transaction scope, and the invocation thread uses various thread-local Contextuals to manage the transactions, such as LocalTransactionContext, RemoteTransactionContext and ContextTransactionManager.

      The wildfly-http-client library makes use of an HttpTargetContext to send the invocation from client to server and the HttpTargetContext in turn delegates to an HttpConnectionPool to establish the connection, setup the invocation request and send the invocation along this connection. Rather than performing the sending of the request using the calling thread, the HttpConnectionPool method getConnection() will add a connection request to a queue and then call runPending() to run any pending requests held in the queue. The connection for processing the pending request is obtained via UndertowClient.getInstance().connect(lambda expression involving connection, ...)  and once obtained, the lambda expression is called. This lambda performs all of the request setup processing, including checking for transactions and marshalling any transaction state into the payload of the request.

      At present, the thread used to call UndertowClient.getInstance().connect() and the thread used to call the lambda expression are not the same, and the Contextuals associated with the calling thread have been dropped before they can be used to process the request.

      For example:

      14:40:27,602 INFO  [org.wildfly.httpclient.common] (main) HttpConnectionPool: thread before call to UndertowClient.getInstance().connect() = Thread[main,5,main] 
      14:40:27,610 INFO  [org.wildfly.httpclient.common] (XNIO-1 I/O-1) HttpConnectionPool: thread after call to UndertowClient.getInstance().connect() = Thread[XNIO-1 I/O-1,5,main]
      

       

      This mechanism needs to be fixed so that if thread transfers do occur, the contexts are carried over from the old thread to the new thread.

            istudens@redhat.com Ivo Studensky
            flaviarnn Flavia Rainone
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: