/// <summary>Register a listener which forward node notifications via the driver</summary> /// <param name="jmx">holds the connection to the driver's JMX server</param> /// <param name="selector">specifies the nodes from which notifications are forwarded</param> /// <param name="mbeanName">the name of the node MBean for which notifications are forwarded</param> /// <param name="listener">the listener to register</param> /// <param name="handback">an arbitrary object provided when the listerner was registered</param> /// <returns>A unique id under which the listener is registered</returns> public static string RegisterFowrwardingNotificationListener(this JMXDriverConnectionWrapper jmx, NodeSelector selector, string mbeanName, BaseDotnetNotificationListener listener, object handback) { NotificationListener javaListener = new DotnetNotificationListenerWrapper(new DotnetNotificationDispatcher(listener, handback)); String id = jmx.registerForwardingNotificationListener(selector, mbeanName, javaListener, null, null); //Console.WriteLine("added forwarding notification listener " + listener + " to " + jmx + " with id=" + id); return(id); }
/// <summary>Initialize this job event disptacher</summary> /// <param name="listener">the <see cref="BaseDotnetJobListener"/> to which the events are dispatched</param> /// <param name="handback">an arbitrary object provided when the listerner was registered</param> /// <param name="verbose">if <code>true</code>, then this instance will print a console message upon each event notification. /// This is intended as a debugging help.</param> public DotnetNotificationDispatcher(BaseDotnetNotificationListener listener, object handback, bool verbose) { this.listener = listener; this.handback = handback; this.verbose = verbose; }
/// <summary>Register a notification listener with the specified MBean.</summary> /// <param name="proxy">a proxy to the MBean</param> /// <param name="listener">the listener to register</param> /// <param name="handback"></param> public static void AddNotificationListener(this AbstractMBeanStaticProxy proxy, BaseDotnetNotificationListener listener, object handback) { //Console.WriteLine("adding notification listener " + listener + " to " + proxy); proxy.addNotificationListener(new DotnetNotificationListenerWrapper(new DotnetNotificationDispatcher(listener, handback)), null, null); }
/// <summary>Initialize this job event disptacher</summary> /// <param name="listener">the <see cref="BaseDotnetJobListener"/> to which the events are dispatched</param> /// <param name="handback">an arbitrary object provided when the listerner was registered</param> public DotnetNotificationDispatcher(BaseDotnetNotificationListener listener, object handback) { this.listener = listener; this.handback = handback; }