users@hk2.java.net

Question about Provider

From: Mingtao Zhang <mingtao.zhang_at_oracle.com>
Date: Thu, 17 Apr 2014 15:12:48 -0700 (PDT)

Hi,

 

Have a question about exception handling in HK2.

 

I have C inject into B then inject into A. So the constructor looks like

@Inject

A(B)

@Inject

B(C)

 

C has a provider (Factory<C>), I am able to catch an exception inside the .provide() method. If I don't catch it, looks like HK2 is ignoring the exception.

 

My target is to log Provider generated exceptions in a central place. I have looked at https://hk2.java.net/2.3.0-b04/events.html#The_Default_TopicDistributionService, which requires a "event firing".

 

Is there a good way to do that?

 

Thanks in advance!

 

Best Regards,

Mingtao