MyFetchingEventForwarder.java 1.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
/*
 * MyList.java
 *
 * Created on Oct 23, 2007, 2:45:57 PM
 *
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author sjiang
 */

import java.io.IOException;
import java.util.ArrayList;
import javax.management.event.FetchingEventForwarder;

public class MyFetchingEventForwarder extends FetchingEventForwarder {

    public MyFetchingEventForwarder() {
        super(1000);
        shared = this;
        setList(myList);
    }

    public void setAgain() {
        setList(myList);
    }

    public void setClientId(String clientId) throws IOException {
        used = true;
        super.setClientId(clientId);
    }

    public boolean isUsed() {
        return used;
    }

    private class MyList<TargetedNotification>
            extends ArrayList<TargetedNotification> {

        public boolean add(TargetedNotification e) {
            used = true;

            return super.add(e);
        }
    }

    public MyList myList = new MyList();
    public static MyFetchingEventForwarder shared;
    private boolean used = false;
}