Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to suppress all the default output from MBassador? #107

Closed
chhh opened this issue Apr 2, 2015 · 6 comments
Closed

How to suppress all the default output from MBassador? #107

chhh opened this issue Apr 2, 2015 · 6 comments
Milestone

Comments

@chhh
Copy link

chhh commented Apr 2, 2015

When i just create a new bus, and publish something to it, STDOUT gets the following:

WARN: No error handler configured to handle exceptions during publication. Error handlers can be added to any instance of AbstractPubSubSupport or via BusConfiguration. Falling back to console logger.

I'd like to suppress that, but can't find the docs on how to do it.
PS: Sorry for publishing in the bug tracker, just didn't know a better way to ask the question reliably.

@chhh
Copy link
Author

chhh commented Apr 2, 2015

To elaborate on this, I've tried:

BusConfiguration busConfiguration = new BusConfiguration(); busConfiguration.addConfigurationErrorHandler(new ConfigurationErrorHandler() { @Override public void handle(ConfigurationError error) { } }); MBassador<Object> bus = new MBassador<>(busConfiguration);
but this gives me a NullPointerException.

@davidsowerby
Copy link
Contributor

#106 may help you - it is about this issue, and the options to address it.

@chhh
Copy link
Author

chhh commented Apr 3, 2015

thx, that helped

@chhh
Copy link
Author

chhh commented Apr 3, 2015

I also wanted to ask if there is a particular reason to make the bus templated?

  • Question 1: is there any penalty/disadvantage of making MBassador<Object> insteand of MBassador<SomeEventSupertype>?
  • Question 2: i'm using it with Netbeans Platform's Lookup mechanism, which is like a HashMap, but allows you to retrieve objects by their class. So if I do something like someLookup.lookupAll(MBassador.class) I will get a Collection<? extends MBassador>, the type will surely be erased. Or if I get a bus as an OSGi service, there is no way to find out the type. The type seems to be redundant anyway... But if it's not, then, I guess, it should be provided as a separate Class<T> argument to the constructor, so that type checking could be done at dispatch?

It's not that it's not working, but one gets all those "rawtypes" and "unchecked" warnings, like if you're compiling some Java 1.4 era code with JDK7.

@bennidi
Copy link
Owner

bennidi commented Jun 16, 2015

My apologies for taking ages in replying. I was drawn into Node.js development lately so I gave my Java projects little attention. I will have time to take care of mbassador issues now. Particularly I will address the issues regarding configuration.

@davidsowerby Thanks for answering.
@chhh Regarding your last question/comment. Generally speaking generics allow you to constrain your types which is helpful when you simply not expect a client (aka another programmer) to stuff anything else than string values into your bus. Types get erased only if they are not part of the signature of the class. If you subclass T<S> you will have the type of S available via the reflection API. If you don't care about the generic type then why not just declare it <?> OR <Object>.

@bennidi bennidi added this to the 1.2.2 milestone Jun 17, 2015
@bennidi
Copy link
Owner

bennidi commented Jun 17, 2015

Fixed and reviewed.

@bennidi bennidi closed this as completed Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants