1 package org.jacorb.notification.servant; 2 3 22 23 import java.util.ArrayList ; 24 import java.util.Collections ; 25 26 import org.jacorb.notification.interfaces.FilterStage; 27 28 32 33 abstract public class FilterStageListManager { 34 35 public interface List { 36 void add(FilterStage d); 37 } 38 39 41 private final Object lock_ = new Object (); 42 43 private java.util.List checkedList_ = Collections.EMPTY_LIST; 44 45 private boolean sourceModified_; 46 47 private java.util.List readOnlyView_ = Collections.EMPTY_LIST; 48 49 51 public void actionSourceModified() { 52 synchronized(lock_) { 53 sourceModified_ = true; 54 } 55 } 56 57 58 public java.util.List getList() { 59 synchronized(lock_) { 60 if (sourceModified_) { 61 final java.util.List _newList = new ArrayList (); 62 63 List _listProxy = new List () { 64 public void add(FilterStage d) { 65 if (!d.isDisposed()) { 66 _newList.add(d); 67 } 68 } 69 }; 70 71 fetchListData(_listProxy); 72 73 checkedList_ = _newList; 74 readOnlyView_ = Collections.unmodifiableList(checkedList_); 75 sourceModified_ = false; 76 } 77 sortCheckedList(checkedList_); 78 79 return readOnlyView_; 80 } 81 } 82 83 protected void sortCheckedList(java.util.List list) 84 { 85 } 87 88 abstract protected void fetchListData(List listProxy); 89 } 90 | Popular Tags |