Hello,
On 13.10.2010, at 17:06, Bigard Olivier wrote:
> Hi,
>
>
>
> When using iPojo 1.6.4 with annotations, the method you implement can
> throw Java exceptions like following:
>
>
>
> @Validate
>
> public void validate() throws Exception
>
> {
>
> throw new Exception("My Exception");
>
> }
>
> a kind of error
>
> When executing this method, iPojo will first catch the Exception in the
> "stateChanged(int)" method of the "LifecycleCallbackHandler" class.
>
> This method will log an error and throw a new Exception that will
> finally be caught by the "setState(int)" method of the "InstanceManager"
> class.
>
> This method will stop the current iPojo instance.
>
>
>
> This mechanism is perfect, but is it possible to customize iPojo to be
> able to do more in this use-case?
>
> For example in our case: sending an Alert to someone indicating that the
> start sequence of this Bundle failed...
>
> This could be achieved by iPojo by sending a specific OSGi Event
> indicating the cause of the error.
>
> What do you think about this?
What I do, and what I recommend, is to create a kind of error-detector. It's a
component (or a plain osgi bundle) which check the configuration of the
platform.
For example, it checks that all instances are valid, all expected instance are
created, services exposed... You can rely on the Architecture service to know
these informations. When a error is detected,
the detector can do whatever you want (Event, Mail, Jabber, Twitter ...).
An other way is to rely on the Log Service. The error you described, logs a
message in the OSGi Log Service is available. So you can detect issues by
listening the log (using a LogServiceListener).
Regards,
Clement
>
>
>
> Thanks
>
> Olivier
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]