[ http://issues.apache.org/jira/browse/HTTPCORE-8?page=all ]
Roland Weber updated HTTPCORE-8:
--------------------------------
Attachment: 2k6-08-25-core-conn-1.tar
Take 1 on alternative connection interfaces. Note that this is a tar, not a
patch.
I have used class and interface names that do not collide with existing ones.
The idea is to have a few review cycles on the new interface before I have to
modify all code that uses connections. Even so it took several hours longer
than I had expected for a first draft. All classes and interfaces spelled
"connexion" are supposed to be renamed to "connection". (Did you know that
"connexion" is an oldfashioned but correct british spelling?) The code in the
default implementation classes is copied and pasted from existing
implementations. They compile and javadoc, but they have not been tested.
The general idea is to turn the connection into a simple container for a socket
and associated objects. The logic for creating the socket, that is for
establishing the connection, is moved to an "operator" (as in switchboard). The
tricky part is that the operator must be able to modify the connection's state
in ways that should not be available to an application developer. In order to
achieve this, I have defined a third interface with internal operations that
are only exposed to the operator. Here is a list of the new interfaces and
classes:
HttpClientConnexion - container for the connection, replaces
HttpClientConnection and HttpProxyConnection. Knows it's operator and delegates
calls such as open and close there.
HttpClientConnInternal - internal operations for the connection. An instance of
this interface is passed to the operator whenever the connection delegates a
call there.
HttpClientConnOperator - provides logic for opening and closing connections,
uses the connection internal operations
AbstractHttpClientConnection - defines all attributes mandated by the
HttpClientConnexion and HttpClientConnInternal interfaces and implements the
delegation to the operator. Internal operations are implemented by an inner
class. Derived classes can focus on send/receive operations.
impl.DefaultHttpClientConnexion - implements send/receive logic mostly copied
over from DefaultHttpClientConnection and AbstractHttpConnection.
impl.DefaultHttpClientConnOperator - implements socket creation logic mostly
copied over from DefaultHttpClientConnection and DefaultHttpProxyConnection,
and close/shutdown logic copied over from AbstractHttpConnection.
I had some trouble in assigning the responsibility for the stale connection
check (fallback implementation in DHCCOperator, better implementation in
DHCConnexion) and the response availability check (connection, for now). The
hooks that allow for the connection to create receiver/transmitter objects
after the socket has been created by the operator need improvement. Anyway,
you'll get the idea, and I have already spent three evenings with this.
Please let me know what you think. I may find time for minor revisions this
weekend, everything else must wait at least one week, probably two.
cheers,
Roland
> refactor HttpClientConnection and HttpProxyConnection
> -----------------------------------------------------
>
> Key: HTTPCORE-8
> URL: http://issues.apache.org/jira/browse/HTTPCORE-8
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha3
> Reporter: Roland Weber
> Assigned To: Roland Weber
> Attachments: 2k6-08-25-core-conn-1.tar
>
>
> As discussed on the mailing list, separating the responsibility for
> establishing connections from the connection objects could improve the design
> and help with proxy support.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]