1 16 17 18 package org.apache.commons.modeler; 19 20 21 import java.util.HashSet ; 22 23 import javax.management.Notification ; 24 import javax.management.NotificationFilter ; 25 26 27 40 public class FixedNotificationFilter implements NotificationFilter { 41 42 46 private HashSet names = new HashSet (); 47 String namesA[]=null; 48 49 55 public FixedNotificationFilter(String names[]) { 56 super(); 57 } 58 59 64 public String [] getNames() { 65 synchronized (names) { 66 return ((String []) names.toArray(new String [names.size()])); 67 } 68 } 69 70 71 80 public boolean isNotificationEnabled(Notification notification) { 81 82 if (notification == null) 83 return (false); 84 synchronized (names) { 85 if (names.size() < 1) 86 return (true); 87 else 88 return (names.contains(notification.getType())); 89 } 90 91 } 92 93 94 } 95 | Popular Tags |