Refactor transport-http response delivery 67/111267/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 4 Apr 2024 14:16:57 +0000 (16:16 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 4 Apr 2024 14:21:45 +0000 (16:21 +0200)
commit6fd1eebd7c8973914339d2923f52e76c86c7d2bb
tree2053014590b9ae74b9b7c32e393b96d8dc72f8ce
parent4f8d13f07d3d2fb6316e394af7035b758414a675
Refactor transport-http response delivery

Using a ListenableFuture brings in lifecycle headache, as the reported
value is retained indefinitely -- forcing us to make copies of the
response.

Rework the APIs in terms of FutureCallback instead -- i.e. we report the
response while having a reference to it and the callback can retain it
if need be (in which case it takes ownership of it).

Also introduce ClientRequestDispatcher to eliminate a bit of duplicate
code.

Change-Id: I350467582b5f5bd67d5241d47a5d4cbaef19adaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
transport/transport-http/src/main/java/org/opendaylight/netconf/transport/http/ClientHttp1RequestDispatcher.java
transport/transport-http/src/main/java/org/opendaylight/netconf/transport/http/ClientHttp2RequestDispatcher.java
transport/transport-http/src/main/java/org/opendaylight/netconf/transport/http/ClientRequestDispatcher.java [new file with mode: 0644]
transport/transport-http/src/main/java/org/opendaylight/netconf/transport/http/HTTPClient.java
transport/transport-http/src/main/java/org/opendaylight/netconf/transport/http/RequestDispatcher.java
transport/transport-http/src/main/java/org/opendaylight/netconf/transport/http/ServerChannelInitializer.java
transport/transport-http/src/test/java/org/opendaylight/netconf/transport/http/HttpClientServerTest.java