jdk/test/javax/management/eventService/MyFetchingEventForwarder.java
changeset 4156 acaa49a2768a
parent 4155 460e37d40f12
child 4159 9e3aae7675f1
equal deleted inserted replaced
4155:460e37d40f12 4156:acaa49a2768a
     1 /*
       
     2  * MyList.java
       
     3  *
       
     4  * Created on Oct 23, 2007, 2:45:57 PM
       
     5  *
       
     6  * To change this template, choose Tools | Templates
       
     7  * and open the template in the editor.
       
     8  */
       
     9 
       
    10 /**
       
    11  *
       
    12  * @author sjiang
       
    13  */
       
    14 
       
    15 import java.io.IOException;
       
    16 import java.util.ArrayList;
       
    17 import javax.management.event.FetchingEventForwarder;
       
    18 
       
    19 public class MyFetchingEventForwarder extends FetchingEventForwarder {
       
    20 
       
    21     public MyFetchingEventForwarder() {
       
    22         super(1000);
       
    23         shared = this;
       
    24         setList(myList);
       
    25     }
       
    26 
       
    27     public void setAgain() {
       
    28         setList(myList);
       
    29     }
       
    30 
       
    31     public void setClientId(String clientId) throws IOException {
       
    32         used = true;
       
    33         super.setClientId(clientId);
       
    34     }
       
    35 
       
    36     public boolean isUsed() {
       
    37         return used;
       
    38     }
       
    39 
       
    40     private class MyList<TargetedNotification>
       
    41             extends ArrayList<TargetedNotification> {
       
    42 
       
    43         public boolean add(TargetedNotification e) {
       
    44             used = true;
       
    45 
       
    46             return super.add(e);
       
    47         }
       
    48     }
       
    49 
       
    50     public MyList myList = new MyList();
       
    51     public static MyFetchingEventForwarder shared;
       
    52     private boolean used = false;
       
    53 }