On 17.02.2009, at 09:05, Carsten Ziegeler wrote:
yanshaozhiGmail wrote:
HI everyone:
how can I set the event's time of timeout , a service often be
joined to backlist . however it's important for us how can a handle
it?
log as : org.apache.felix.eventadmin EventAdmin: Blacklisting
ServiceReference [[org.osgi.service.event.EventHandler] |
Bundle(com.gopha.ekm.dms.photo.services [4])] due to timeout!
By default the Felix EventAdmin implementation has a timeout of 5000
ms.
Your event handler has to return from the handle event method in this
time frame. I'm not sure what the best solution is, but we usually
just
acknowledge the receive of an event and handle it asynchronously by
for
example either starting a background thread in the handle event method
or by putting the event into a queue which is processed by a running
background thread.
You can also change the timeout value for the Felix event admin
implementation by setting the property to a corresponding value:
org.apache.felix.eventadmin.Timeout
See here for how to see properties:
http://felix.apache.org/site/apache-felix-usage-documentation.html#ApacheFelixUsageDocumentation-configuringfelix
(If you're using Sling, you can also add this property to the
sling.properties file).
An other way is to create a processing thread that process events.
So, when a data is received, you just add the event into a list and
notify the thread. So, you don't process the event in the event admin
thread and so you will not be blacklisted. This way avoid setting an
arbitrary time.
Regards,
Clement
HTH
Carsten
--
Carsten Ziegeler
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]