KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > remote > rmi > RMIRemoteNotificationServerHandler


1 package mx4j.remote.rmi;
2
3 import java.util.Map JavaDoc;
4 import java.util.ArrayList JavaDoc;
5
6 import javax.management.remote.TargetedNotification JavaDoc;
7
8 import mx4j.remote.DefaultRemoteNotificationServerHandler;
9 import mx4j.remote.MX4JRemoteUtils;
10 import mx4j.log.Logger;
11
12 /**
13  *
14  * @version $Revision: 1.2 $
15  */

16 class RMIRemoteNotificationServerHandler extends DefaultRemoteNotificationServerHandler
17 {
18    RMIRemoteNotificationServerHandler(Map JavaDoc environment)
19    {
20       super(environment);
21    }
22
23    protected TargetedNotification JavaDoc[] filterNotifications(TargetedNotification JavaDoc[] notifications)
24    {
25       Logger logger = null;
26       ArrayList JavaDoc list = new ArrayList JavaDoc();
27       for (int i = 0; i < notifications.length; ++i)
28       {
29          TargetedNotification JavaDoc notification = notifications[i];
30          if (MX4JRemoteUtils.isTrulySerializable(notification))
31          {
32             list.add(notification);
33          }
34          else
35          {
36             if (logger == null) logger = getLogger();
37             if (logger.isEnabledFor(Logger.INFO)) logger.info("Cannot send notification " + notification + " to the client: it is not serializable");
38          }
39       }
40       return (TargetedNotification JavaDoc[])list.toArray(new TargetedNotification JavaDoc[list.size()]);
41    }
42 }
43
Popular Tags