|
Hi,
What about replacing anonymous inner noop AsyncCallback with EmptyAsyncCallback? Just to make a codebase a little bit nicer. // Bad Object value = invocation.proceed(new AsyncCallback() { public void done(boolean doneSync) { // nnop } }, sync); // Good Object value = invocation.proceed(new EmptyAsyncCallback(), sync); Patch attached in Jira issue [1] if you like the idea. Laters. [1] https://issues.apache.org/jira/browse/CAMEL-5379 -- Henryk Konsek http://henryk-konsek.blogspot.com |
|
On Tue, Jun 19, 2012 at 9:09 AM, Henryk Konsek <[hidden email]> wrote:
> Hi, > > What about replacing anonymous inner noop AsyncCallback with > EmptyAsyncCallback? Just to make a codebase a little bit nicer. > > // Bad > Object value = invocation.proceed(new AsyncCallback() { > public void done(boolean doneSync) { // nnop } > }, sync); > > // Good > Object value = invocation.proceed(new EmptyAsyncCallback(), sync); > > Patch attached in Jira issue [1] if you like the idea. > > Laters. > > [1] https://issues.apache.org/jira/browse/CAMEL-5379 > > -- > Henryk Konsek > http://henryk-konsek.blogspot.com We should probably name it NoopAsyncCallback as IMHO thats a better name. Also we may consider a single static instance as its just a noop, eg like Collections.emptyList() does. -- Claus Ibsen ----------------- FuseSource Email: [hidden email] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen |
|
> We should probably name it NoopAsyncCallback as IMHO thats a better name.
I'm used to naming Noop- callbacks as Empty-ones but Noop sounds fine as well :) . > Also we may consider a single static instance as its just a noop, eg > like Collections.emptyList() does. I thought about it but decided to make patch as simple as possible. BTW I thought also about utility like this: AsyncCallbacks.noop(); AsyncCallbacks.log(exchange); // callback that logs to SLF4J that exchange has been processed. -- Henryk Konsek http://henryk-konsek.blogspot.com |
|
On Wed, Jun 20, 2012 at 5:00 PM, Henryk Konsek <[hidden email]> wrote:
>> We should probably name it NoopAsyncCallback as IMHO thats a better name. > > I'm used to naming Noop- callbacks as Empty-ones but Noop sounds fine > as well :) . > >> Also we may consider a single static instance as its just a noop, eg >> like Collections.emptyList() does. > > I thought about it but decided to make patch as simple as possible. > > BTW I thought also about utility like this: > > AsyncCallbacks.noop(); > AsyncCallbacks.log(exchange); // callback that logs to SLF4J that > exchange has been processed. > Well I dont like adding more classes to the root package, there is plenty already. And this is frankly not end user API, but for component developers. So it should be in a sub package such as support. And not used as much as you can see, its only like 5 components or so you refactored. > -- > Henryk Konsek > http://henryk-konsek.blogspot.com -- Claus Ibsen ----------------- FuseSource Email: [hidden email] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen |
|
> Well I dont like adding more classes to the root package, there is
> plenty already. Yeah, we could stick just to the NoopAsyncCallback. The Jira issue is on your side so just apply it when you think it's appropriate moment. Laters. -- Henryk Konsek http://henryk-konsek.blogspot.com |
| Powered by Nabble | Edit this page |
