1 9 package org.jboss.mx.remoting; 10 11 import java.io.Serializable ; 12 import java.util.ArrayList ; 13 import java.util.Iterator ; 14 import java.util.List ; 15 16 24 public class NotificationQueue implements Serializable 25 { 26 static final long serialVersionUID = -1185639057427341662L; 27 28 private final String sessionId; 29 private final List notifications = new ArrayList (); 30 31 36 public NotificationQueue(String sessionId) 37 { 38 this.sessionId = sessionId; 39 } 40 41 public String toString() 42 { 43 return "NotificationQueue [sessionId:" + sessionId + ",notifications:" + notifications + "]"; 44 } 45 46 49 public void clear() 50 { 51 notifications.clear(); 52 } 53 54 59 void add(NotificationEntry notification) 60 { 61 synchronized(notifications) 62 { 63 notifications.add(notification); 64 } 65 } 66 67 72 public String getSessionID() 73 { 74 return sessionId; 75 } 76 77 82 public boolean isEmpty() 83 { 84 synchronized(notifications) 85 { 86 return notifications.isEmpty(); 87 } 88 } 89 90 95 public Iterator iterator() 96 { 97 synchronized(notifications) 98 { 99 return notifications.iterator(); 100 } 101 } 102 } 103 | Popular Tags |