Hi,
this sounds strange, the event admin impl is using a thread pool, so
it's ok that the thread stays around after it has delivered the event.
It will be reused for one of the next events. The pool has a limit, so
you shouldn't get more threads than that limit.
I'm wondering what this has to do with CPU though? If you create a
thread dump are these threads executing something or really just waiting
in the pool?
Regards
Carsten
David Daniel wrote
> I am registering an event handler with the evenadmin.
>
> pingRegistration = bc.registerService(
> EventHandler.class.getName(), new PingEventHandler(), p);
>
>
> private class PingEventHandler implements EventHandler {
>
> @Override
> public synchronized void handleEvent(Event event) {
> String userId = "";
> for (String name : event.getPropertyNames()) {
> if (name.equals("type")) {
> if
> (event.getProperty(name).equals(PingDTO.class.getCanonicalName())) {
> userId = (String)event.getProperty("userId");
> }
> }
> }
> if (!userId.isEmpty()) {
> IUser pingedUser = UserManager.this.getUser(userId);
> pingedUser.setLastActive(LocalDateTime.now());
> pingedUser.getId().ifPresent(id -> {
> UserManager.this.put(pingedUser);
> });
> }
> }
>
> }
>
> Things seem to run through all the code ok but after each ping event a new
> thread is created for the EventHandler and it never gets destroyed but only
> parked. Because of that my program quickly uses up all the cpu on the
> box. Is there a way to have the Executer that runs the eventHandles clear
> the thread when it is done or am I doing something wrong and have a loop
> that I am just missing.
>
> Thanks for any help,
> David
>
--
Carsten Ziegeler
Adobe Research Switzerland
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]