|
Well, I don’t really like it and I don’t think it should be part of core HiveMind, but you can feel free to implement it yourself.� I don’t like it because you really have to be careful what you’re doing when you start using asynchronous calls like this seamlessly.� Clients have no idea that the call goes on asynchronously!� I see the merits of what you’re proposing, but I think making it very explicit (using a service point and implementing Runnable or providing some reflective mechanism) is a bit safer.� It’s one thing to manage what specific INSTANCE of an implementation object is used behind the scenes to carry out the logic of a method call (the job of a service model), but it’s a completely different thing to seamlessly switch the method call to asynchronous behind the scenes.� Not only that, but you have to make sure your methods are ALL void methods in your service interface.� Also, what do you do with exceptions that are thrown during execution of the service method?� What about transactions?
-----Original Message-----
El lun, 25-10-2004 a las 10:37, James Carman escribi�: What if the service interface’s method returns something? How can it be asynchronous?
I agree that the Executor interface could be used as a service itself, but to use that idea as a service model doesn’t work IMHO. My suggestion would be to expose the Executor (or actually ExecutorService in JDK 5.0) interface as a service in your registry (as you’ve already done it seems) and let other services use it. A service model itself cannot be asynchronous, as it is a mechanism for performing a method call (which is inherently synchronous) on an object. Even when you call the Executor.execute() method, it’s a synchronous call. The method does what it’s supposed to do (adds the Runnable to a queue or something) and returns.
|
- Pooled Service Model enhancements Jean-Francois Poilpret
- Re: Pooled Service Model enhancements Bob Arnott
- Re: Pooled Service Model enhancements Marcus Brito
- RE: Pooled Service Model enhancements James Carman
- RE: Pooled Service Model enhancements Pablo Lalloni
- RE: Pooled Service Model enhanceme... James Carman
- RE: Pooled Service Model enha... Pablo Lalloni
- RE: Pooled Service Model ... James Carman
- RE: Pooled Service Mo... Jean-Francois Poilpret
- Re: Pooled Service Mo... Howard Lewis Ship
