use of org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote.NotificationTuple in project felix by apache.
the class RMIConnectionInvoker method addNotificationListeners.
public Integer[] addNotificationListeners(ObjectName[] names, MarshalledObject[] filters, Subject[] delegates) throws InstanceNotFoundException, IOException {
ArrayList ids = new ArrayList();
for (int i = 0; i < names.length; ++i) {
ObjectName name = names[i];
MarshalledObject filter = filters[i];
NotificationFilter f = (NotificationFilter) RMIMarshaller.unmarshal(filter, server.getClassLoaderFor(name), defaultLoader);
Integer id = notificationHandler.generateListenerID(name, f);
NotificationListener listener = notificationHandler.getServerNotificationListener();
server.addNotificationListener(name, listener, f, id);
notificationHandler.addNotificationListener(id, new NotificationTuple(name, listener, f, id));
ids.add(id);
}
return (Integer[]) ids.toArray(new Integer[ids.size()]);
}
use of org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote.NotificationTuple in project felix by apache.
the class ClientInvoker method removeNotificationListener.
public void removeNotificationListener(ObjectName observed, NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
Integer[] ids = notificationHandler.getNotificationListeners(new NotificationTuple(observed, listener));
if (ids == null)
throw new ListenerNotFoundException("Could not find listener " + listener);
connection.removeNotificationListeners(observed, ids, delegate);
notificationHandler.removeNotificationListeners(ids);
}
use of org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote.NotificationTuple in project felix by apache.
the class ClientInvoker method addNotificationListener.
public void addNotificationListener(ObjectName observed, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, IOException {
NotificationTuple tuple = new NotificationTuple(observed, listener, filter, handback);
if (notificationHandler.contains(tuple))
return;
MarshalledObject f = null;
try {
f = RMIMarshaller.marshal(filter);
} catch (NotSerializableException x) {
// Invoke the filter on client side
tuple.setInvokeFilter(true);
}
Integer[] ids = connection.addNotificationListeners(new ObjectName[] { observed }, new MarshalledObject[] { f }, new Subject[] { delegate });
notificationHandler.addNotificationListener(ids[0], tuple);
}
use of org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote.NotificationTuple in project felix by apache.
the class ClientInvoker method removeNotificationListener.
public void removeNotificationListener(ObjectName observed, NotificationListener listener, NotificationFilter filter, Object handback) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
Integer id = notificationHandler.getNotificationListener(new NotificationTuple(observed, listener, filter, handback));
if (id == null)
throw new ListenerNotFoundException("Could not find listener " + listener + " with filter " + filter + " and handback " + handback);
Integer[] ids = new Integer[] { id };
connection.removeNotificationListeners(observed, ids, delegate);
notificationHandler.removeNotificationListeners(ids);
}
use of org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote.NotificationTuple in project felix by apache.
the class RMIConnectionInvoker method removeNotificationListeners.
public void removeNotificationListeners(ObjectName name, Integer[] listenerIDs, Subject delegate) throws InstanceNotFoundException, ListenerNotFoundException, IOException {
for (int i = 0; i < listenerIDs.length; ++i) {
Integer id = listenerIDs[i];
NotificationTuple tuple = notificationHandler.getNotificationListener(id);
server.removeNotificationListener(name, tuple.getNotificationListener(), tuple.getNotificationFilter(), tuple.getHandback());
notificationHandler.removeNotificationListener(id);
}
}
Aggregations