97 AccessController.doPrivileged(
98 new PrivilegedExceptionAction<Boolean>() {
99 public Boolean run() throws InstanceNotFoundException {
100 return mbeanServer.isInstanceOf(name, broadcasterClass);
101 }
102 });
103 if (!instanceOf) {
104 throw new IllegalArgumentException("The specified MBean [" +
105 name + "] is not a " +
106 "NotificationBroadcaster " +
107 "object.");
108 }
109 } catch (PrivilegedActionException e) {
110 throw (InstanceNotFoundException) extractException(e);
111 }
112
113 final Integer id = getListenerID();
114
115 // 6238731: set the default domain if no domain is set.
116 ObjectName nn = name;
117 if (name.getDomain() == null || name.getDomain().equals("")) {
118 try {
119 nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(),
120 name.getKeyPropertyList());
121 } catch (MalformedObjectNameException mfoe) {
122 // impossible, but...
123 IOException ioe = new IOException(mfoe.getMessage());
124 ioe.initCause(mfoe);
125 throw ioe;
126 }
127 }
128
129 synchronized (listenerMap) {
130 IdAndFilter idaf = new IdAndFilter(id, filter);
131 Set<IdAndFilter> set = listenerMap.get(nn);
132 // Tread carefully because if set.size() == 1 it may be the
133 // Collections.singleton we make here, which is unmodifiable.
134 if (set == null)
135 set = Collections.singleton(idaf);
136 else {
137 if (set.size() == 1)
|
97 AccessController.doPrivileged(
98 new PrivilegedExceptionAction<Boolean>() {
99 public Boolean run() throws InstanceNotFoundException {
100 return mbeanServer.isInstanceOf(name, broadcasterClass);
101 }
102 });
103 if (!instanceOf) {
104 throw new IllegalArgumentException("The specified MBean [" +
105 name + "] is not a " +
106 "NotificationBroadcaster " +
107 "object.");
108 }
109 } catch (PrivilegedActionException e) {
110 throw (InstanceNotFoundException) extractException(e);
111 }
112
113 final Integer id = getListenerID();
114
115 // 6238731: set the default domain if no domain is set.
116 ObjectName nn = name;
117 if (name.getDomain() == null || name.getDomain().isEmpty()) {
118 try {
119 nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(),
120 name.getKeyPropertyList());
121 } catch (MalformedObjectNameException mfoe) {
122 // impossible, but...
123 IOException ioe = new IOException(mfoe.getMessage());
124 ioe.initCause(mfoe);
125 throw ioe;
126 }
127 }
128
129 synchronized (listenerMap) {
130 IdAndFilter idaf = new IdAndFilter(id, filter);
131 Set<IdAndFilter> set = listenerMap.get(nn);
132 // Tread carefully because if set.size() == 1 it may be the
133 // Collections.singleton we make here, which is unmodifiable.
134 if (set == null)
135 set = Collections.singleton(idaf);
136 else {
137 if (set.size() == 1)
|