public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException { try { delegate.addNotificationListener(name, listener, filter, handback); } catch(IOException e) { throw new RuntimeException(e); } }
public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException { try { delegate.addNotificationListener(name, listener, filter, handback); } catch(IOException e) { throw new RuntimeException(e); } }
protected void subscribeTracker(GcTracker tracker) throws IOException, JMException { mserver.addNotificationListener(tracker.name, LISTENER, null, tracker); tracker.capture(); // resync poll/push }
private synchronized void addNotificationListener(ObjectName name, int listenerId, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { NotificationProxy proxy = new NotificationProxy(listenerId); server.getMBeanServerConnection().addNotificationListener(name, proxy, filter, handback); Association association = new Association(); association.name = name; association.listener = proxy; association.filter = filter; association.handback = handback; listeners.put(listenerId, association); }
private synchronized void addNotificationListener(ObjectName name, int listenerId, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { NotificationProxy proxy = new NotificationProxy(listenerId); server.getMBeanServerConnection().addNotificationListener(name, proxy, filter, handback); Association association = new Association(); association.name = name; association.listener = proxy; association.filter = filter; association.handback = handback; listeners.put(listenerId, association); }
/** * Registers the specified {@code NotificationListener}. * <p>Ensures that an {@code MBeanServerConnection} is configured and attempts * to detect a local connection if one is not supplied. */ public void prepare() { if (this.server == null) { this.server = this.connector.connect(this.serviceUrl, this.environment, this.agentId); } try { this.actualObjectNames = getResolvedObjectNames(); if (this.actualObjectNames != null) { if (logger.isDebugEnabled()) { logger.debug("Registering NotificationListener for MBeans " + Arrays.asList(this.actualObjectNames)); } for (ObjectName actualObjectName : this.actualObjectNames) { this.server.addNotificationListener( actualObjectName, getNotificationListener(), getNotificationFilter(), getHandback()); } } } catch (IOException ex) { throw new MBeanServerNotFoundException( "Could not connect to remote MBeanServer at URL [" + this.serviceUrl + "]", ex); } catch (Exception ex) { throw new JmxException("Unable to register NotificationListener", ex); } }
/** * Registers the specified {@code NotificationListener}. * <p>Ensures that an {@code MBeanServerConnection} is configured and attempts * to detect a local connection if one is not supplied. */ public void prepare() { if (this.server == null) { this.server = this.connector.connect(this.serviceUrl, this.environment, this.agentId); } try { this.actualObjectNames = getResolvedObjectNames(); if (this.actualObjectNames != null) { if (logger.isDebugEnabled()) { logger.debug("Registering NotificationListener for MBeans " + Arrays.asList(this.actualObjectNames)); } for (ObjectName actualObjectName : this.actualObjectNames) { this.server.addNotificationListener( actualObjectName, getNotificationListener(), getNotificationFilter(), getHandback()); } } } catch (IOException ex) { throw new MBeanServerNotFoundException( "Could not connect to remote MBeanServer at URL [" + this.serviceUrl + "]", ex); } catch (Exception ex) { throw new JmxException("Unable to register NotificationListener", ex); } }
remoteNotificationManager.addNotificationListener(name, listenerId, filter, handback); } else { server.getMBeanServerConnection().addNotificationListener(name, listener, filter, handback);
remoteNotificationManager.addNotificationListener(name, listenerId, filter, handback); } else { server.getMBeanServerConnection().addNotificationListener(name, listener, filter, handback);
/** * Registers the notification listener with the specified ObjectNames. */ @Override protected void doStart() { if (!this.listenerRegisteredOnStartup.get()) { return; } this.logger.debug("Registering to receive notifications"); try { Assert.notNull(this.server, "MBeanServer is required."); Assert.notNull(this.mBeanObjectNames, "An ObjectName is required."); Collection<ObjectName> objectNames = this.retrieveMBeanNames(); if (objectNames.size() < 1) { this.logger.error("No MBeans found matching ObjectName pattern(s): " + Arrays.asList(this.mBeanObjectNames)); } for (ObjectName objectName : objectNames) { this.server.addNotificationListener(objectName, this, this.filter, this.handback); } } catch (InstanceNotFoundException e) { throw new IllegalStateException("Failed to find MBean instance.", e); } catch (IOException e) { throw new IllegalStateException("IOException on MBeanServerConnection.", e); } }
// Get a reference to the target MBeanServer MBeanServerConnection server = ManagementFactory.getPlatformMBeanServer(); MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter(); filter.enableAllObjectNames(); server.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, new MBeanEventListener(), filter, null);
/** * Register a notification listener which listens for registration and deregistration of MBeans at a certain server * * @param pServer server to register to * @param pListener listener to register * @param pObjectNameToFilter object name which should be listen for. If null, listens for any MBean registration */ public static void addMBeanRegistrationListener(MBeanServerConnection pServer, NotificationListener pListener, ObjectName pObjectNameToFilter) { MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter(); if (pObjectNameToFilter == null) { filter.enableAllObjectNames(); } else { filter.enableObjectName(pObjectNameToFilter); } try { pServer.addNotificationListener(getMBeanServerDelegateName(), pListener, filter, null); } catch (InstanceNotFoundException e) { throw new IllegalStateException("Cannot find " + getMBeanServerDelegateName() + " in server " + pServer,e); } catch (IOException e) { throw new IllegalStateException("IOException while registering notification listener for " + getMBeanServerDelegateName(),e); } }
public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException { try { delegate.addNotificationListener(name, listener, filter, handback); } catch(IOException e) { throw new RuntimeException(e); } }
@Override public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { //throw new UnsupportedOperationException("GemfireMBeanServerConnection does not implement this opeation "); MBeanServerConnection server = ManagementUtil.getPlatformMBeanServer(); server.addNotificationListener(name, listener, filter, handback); }
@Override public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException { //throw new UnsupportedOperationException("GemfireMBeanServerConnection does not implement this opeation "); MBeanServerConnection server = ManagementUtil.getPlatformMBeanServer(); server.addNotificationListener(name, listener, filter, handback); }
public ClusterMBeanObserver(String domain) throws InstanceNotFoundException, IOException, MalformedObjectNameException, NullPointerException { // Get a reference to the target MBeanServer _domain = domain; _server = ManagementFactory.getPlatformMBeanServer(); MBeanServerNotificationFilter filter = new MBeanServerNotificationFilter(); filter.enableAllObjectNames(); _server.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this, filter, null); }
protected void addNotificationListener(final Object[] args) throws IOException, InstanceNotFoundException { final NotificationListener listener = (NotificationListener) args[ 0]; final NotificationFilter filter = (NotificationFilter) (args.length <= 1 ? null : args[ 1]); final Object handback = args.length <= 1 ? null : args[ 2]; getMBeanServerConnection().addNotificationListener( getObjectName(), listener, filter, handback); }
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) { try { mirror.getMBeanServerConnection() .addNotificationListener(getRemoteObjectName(), new NotificationIntercepter(listener), filter, handback); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
public FeaturesServiceMBean createFeaturesServiceMBeanProxy( MBeanServerConnection mbsc) throws MalformedObjectNameException, NullPointerException, InstanceNotFoundException, IOException { echo("\n>>> Create FeatureService MBean <<<"); ObjectName mbeanName = new ObjectName( "org.apache.karaf:type=features,name=trun"); FeaturesServiceMBean featuresServiceMBeanProxy = JMX.newMBeanProxy( mbsc, mbeanName, FeaturesServiceMBean.class, true); echo("\n>>> Add notification listener to FeatureService MBean <<<"); mbsc.addNotificationListener(mbeanName, clientListener, null, null); return featuresServiceMBeanProxy; }
public Integer addNotificationListener(ObjectName name, Object filter, Subject delegate) throws InstanceNotFoundException, IOException { Integer id = notificationHandler.generateListenerID(name, null); NotificationListener listener = notificationHandler.getServerNotificationListener(); getServer().addNotificationListener(name, listener, null, id); notificationHandler.addNotificationListener(id, new NotificationTuple(name, listener, null, id)); return id; }