Bug Corrections

Issue when retrieving metrics from multiple jvm.
Corrected using connection object instead of global connection.
Add type parameter to the event object.