« Return to Thread: monitoring memory leaks

Re: monitoring memory leaks

by Marcin Szkudlarek :: Rate this Message:

Reply to Author | View in Thread

That helped me a lot. Thanks!

Endre Stølsvik-8 wrote:
Not that I know of.

Here's a hack:

    public static <E> List<ListEventListener<E>>
getListEventListeners(EventList<E> from) throws
IllegalArgumentException {
        Field updatesField;
        try {
            updatesField = AbstractEventList.class.getDeclaredField("updates");
        }
        catch (NoSuchFieldException e) {
            throw new IllegalArgumentException("The EventList [" +
from + "] does not contain an \"updates\" field.");
        }
        updatesField.setAccessible(true);
        ListEventAssembler<E> updates;
        try {
            updates = (ListEventAssembler<E>) updatesField.get(from);
        }
        catch (IllegalAccessException e) {
            throw new AssertionError(e);
        }
        return updates.getListEventListeners();
    }

 « Return to Thread: monitoring memory leaks