示例#1
0
        public void HandleNotification(Notification notification, object handback)
        {
            MBeanServerNotification serverNotification = notification as MBeanServerNotification;

            if (serverNotification != null)
            {
                if (serverNotification.Type == MBeanServerNotification.RegistrationNotification)
                {
                    if (ShouldMapBean(serverNotification.ObjectName))
                    {
                        MapBean(serverNotification.ObjectName);
                    }
                }
                else if (serverNotification.Type == MBeanServerNotification.UnregistrationNotification)
                {
                    if (_externalMappers.ContainsKey(serverNotification.ObjectName))
                    {
                        _typeCache.RemoveTypeMapper(_externalMappers[serverNotification.ObjectName]);
                        _externalMappers.Remove(serverNotification.ObjectName);
                    }
                    else if (_mappedBeans.ContainsKey(serverNotification.ObjectName))
                    {
                        _server.UnregisterMBean(_mappedBeans[serverNotification.ObjectName]);
                        _mappedBeans.Remove(serverNotification.ObjectName);
                    }
                }
            }
        }
示例#2
0
        public void HandleNotification(Notification notification, object handback)
        {
            MBeanServerNotification serverNotification = notification as MBeanServerNotification;

            if (serverNotification != null && serverNotification.Type == MBeanServerNotification.UnregistrationNotification)
            {
                if (_referencingRelations.ContainsKey(serverNotification.ObjectName))
                {
                    _removedBeans.Add(serverNotification.ObjectName);
                }
                if (_purge)
                {
                    PurgeRelations();
                }
                dynamic rel;
                if (_relationBeans.TryGetValue(serverNotification.ObjectName, out rel))
                {
                    RemoveRelation(rel.Id);
                }
            }
        }