single TN, because an arbitrary serializer might not know
how to serialize a single TN (for example, it's an XML
serializer that can serialize an NR containing a TN but not
a TN on its own). */
for (int i = 0; i < tns.length; i++) {
TargetedNotification tn = tns[i];
NotificationResult trialnr =
new NotificationResult(0, 0, new TargetedNotification[] {tn});
try {
serialization.wrap(trialnr);
tnList.add(tn);
} catch (IOException e) {
logger.warning("purgeUnserializable",
"cannot serialize notif: " + tn);
logger.fine("purgeUnserializable", e);
final Integer listenerID = tn.getListenerID();
final Notification badNotif = tn.getNotification();
final String notifType = JMXConnectionNotification.NOTIFS_LOST;
final String notifMessage = "Not serializable: " + badNotif;
Notification goodNotif =
new JMXConnectionNotification(notifType,
badNotif.getSource(),
clientId,
badNotif.getSequenceNumber(),
notifMessage,
ONE_LONG);
/* Our implementation has the convention that a NOTIFS_LOST
has a userData that says how many notifs were lost. */
tn = new TargetedNotification(goodNotif, listenerID);
trialnr =
new NotificationResult(0, 0,
new TargetedNotification[] {tn});
try {
serialization.wrap(trialnr);