class UnifiedListenerManager {

    public synchronized void attachListener(@NonNull DownloadTask task,
                                            @NonNull DownloadListener listener) {
        final int id = task.getId();
        ArrayList<DownloadListener> listenerList = realListenerMap.get(id);
        if (listenerList == null) {
            listenerList = new ArrayList<>();
            realListenerMap.put(id, listenerList);
        }

        if (!listenerList.contains(listener)) {
            listenerList.add(listener);
            if (listener instanceof ListenerAssist) {
                ((ListenerAssist) listener).setAlwaysRecoverAssistModelIfNotSet(true);
            }
        }
    }

    public  UnifiedListenerManager();

}