[Twisted-Python] Java question

Glyph Lefkowitz glyph at divmod.com
Tue May 25 23:59:02 MDT 2004


On Tue, 2004-05-25 at 13:28, Itamar Shtull-Trauring wrote:

> I started some work on improving EIO, originally written by Zooko. It
> doesn't have a concept of Deferreds yet, and some of the APIs will no
> doubt change, but it's a start.

Maybe it's obvious, but a suggestion:

public class DeferredCallback {
	public Object callback(Object result) {}
	public Object errback(Failure failure) {}
}

public class Deferred  {
	public Object defer(DeferredCallback dc) {...}
}

That way,

foo.doIt().defer(new DeferredCallback() { public Object callback(Object
result) {
  doneWithIt();
} public Object errback(Failure f) {
  whatTheHeck();
} };

I think that looks nice.  Might also want a
DeferredCallback.fromRunnable, etc.






More information about the Twisted-Python mailing list