11-12-05 12:45 PM
[ http://issues.apache.org/jira/brows...23574
84 ]
dave irving commented on DIRMINA-120:
-------------------------------------
What I thought was something like this:
1) Add a "Callback" interface to IoFuture, and a "setCallback" method. This
allows the result of any IoFuture to be obtained "callback style" (So I can
do my write callbacks... yeah!!).
2) Add a "ConnectListener" interface to ConnectFuture. This is more specific
, and has the methods you mention above. Add a "setConnectListener" method t
o ConnectFuture.
3) Internally, a private adapter class adapts ConnectListeners to Callbacks.
So when you do a setConnectListener, it creates a CallbackAdapter and sets
it as the futures callback.
This means that ConnectFuture can still have a more specific callback interf
ace (succeeded / failed), but we can still get callbacks for any other type
of future.
I'm going to attach the two associated files now....
WDYT?
> Callbacks for IoFutures
> -----------------------
>
> Key: DIRMINA-120
> URL: http://issues.apache.org/jira/browse/DIRMINA-120
> Project: Directory MINA
> Type: Improvement
> Reporter: Trustin Lee
> Assignee: Trustin Lee
> Fix For: 0.9
>
> IoFuture provides only blocking-way ('join' method) for user to find out t
he result of an I/O request. It would be great if users can specify a callb
ack:
> ConnectFuture future = connector.connect(...);
> future.setCallback( new ConnectFuture.Callback() {
> public void connectionEstablished( IoSession session ) {
> }
> public void connectionFailed( Throwable cause ) {
> }
> } );
> There can be a race condition if the connection process ends before a user calls s
etCallback() method, but we can resolve this carefully so users don't notice any iss
ue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secur...nistrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[ Post a follow-up to this message ]
|