questions about multithreading and aop calls

classic Classic list List threaded Threaded
1 message Options
Tammy Dugan Tammy Dugan
Reply | Threaded
Open this post in threaded view

questions about multithreading and aop calls

I have the following AOP method:

public void afterReturning(Object returnValue, Method method,
            Object[] args, Object target) throws Throwable
        if (method.getName().equals("messageProcessed"))
                if (method.getParameterTypes()[0].getName().compareTo(
                        "org.openmrs.Encounter") == 0)
                    org.openmrs.Encounter encounter =
(org.openmrs.Encounter) args[0];
                    Thread thread = new Thread(new
            } catch (Exception e)

        if (method.getName().equals("fileProcessed"))
            TeleformFileState tfState = (TeleformFileState) args[0];
            Thread thread = new Thread(new ProcessFile(tfState));

This method is failing because the thread that I create appears to die
when I return from the AOP call. I want each of these AOP calls to
execute in a separate threads. One idea I had was to have a static
thread manager class that just keeps a handle on the thread objects I
create so they are not killed when the AOP call returns. The static
class would then periodically purge any threads that are no longer
running. Is this a viable solution or is there a better way to do this?




To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]