I'm using j-interop to monitor the Windows Event Log of a server.
I do it by using 2 threads:
one executing "ExecQuery" once, and then terminates (to read old events)
and one executing "ExecNotificationQuery", with a timeout of 10 seconds, repeatedly.
The problem I'm having is as follows:
The ExecQuery can take about 2 minutes to come back with a response (if I use RETURN_IMMEDIATELY flag, then the first call to next on the enumerator takes about 2 minutes), and in the meanwhile the thread calling "ExecNotificationQuery" is hanging (the function doesn't return after the timeout, nor it returns when a new event is logged).
Each of the threads creates a new JIComServer object and issues createInstance on it with a new JISession.
Do you have any idea what the bottleneck could be?
Help would be greatly appreciated.
I am not sure how the WMI server is organized internally. We opening multiple connections to the same server (WMI) makes sure that no resource contention on the client side occurs however on the server side it may well be synchronized (COM Apartments). j-Interop will just instantiate the COM server, the apartment in which to run is decided via a registry key (not sure which one though).
hope this helps,