Package com.aelitis.azureus.core.util

Examples of com.aelitis.azureus.core.util.CopyOnWriteMap


  {
    listeners_cow.remove(l);
  }
 
  public void addListener(DownloadManagerStateAttributeListener l, String attribute, int event_type) {
    CopyOnWriteMap map_to_use = (event_type == DownloadManagerStateAttributeListener.WILL_BE_READ) ? this.listeners_read_map_cow : this.listeners_write_map_cow;
    CopyOnWriteList lst = (CopyOnWriteList)map_to_use.get(attribute);
    if (lst == null) {
      lst = new CopyOnWriteList();
      map_to_use.put(attribute, lst);
    }
    lst.add(l);
  }
View Full Code Here


    }
    lst.add(l);
  }

  public void removeListener(DownloadManagerStateAttributeListener l, String attribute, int event_type) {
    CopyOnWriteMap map_to_use = (event_type == DownloadManagerStateAttributeListener.WILL_BE_READ) ? this.listeners_read_map_cow : this.listeners_write_map_cow;
    CopyOnWriteList lst = (CopyOnWriteList)map_to_use.get(attribute);
    if (lst != null) {lst.remove(l);}
  }
View Full Code Here

 
  public void addAttributeListener(DownloadAttributeListener listener, TorrentAttribute attr, int event_type) {
    String attribute = convertAttribute(attr);
    if (attribute == null) {return;}
   
    CopyOnWriteMap attr_map = this.getAttributeMapForType(event_type);
    CopyOnWriteList listener_list = (CopyOnWriteList)attr_map.get(attribute);
    boolean add_self = false;
   
    if (listener_list == null) {
      listener_list = new CopyOnWriteList();
      attr_map.put(attribute, listener_list);
    }
    add_self = listener_list.isEmpty();
   
    listener_list.add(listener);
    if (add_self) {
View Full Code Here

  public void removeAttributeListener(DownloadAttributeListener listener, TorrentAttribute attr, int event_type) {
    String attribute = convertAttribute(attr);
    if (attribute == null) {return;}
   
    CopyOnWriteMap attr_map = this.getAttributeMapForType(event_type);
    CopyOnWriteList listener_list = (CopyOnWriteList)attr_map.get(attribute);
    boolean remove_self = false;
     
    if (listener_list != null) {
      listener_list.remove(listener);
      remove_self = listener_list.isEmpty();
View Full Code Here

  public boolean canMoveDataFiles() {
    return download_manager.canMoveDataFiles();
  }
 
  public void attributeEventOccurred(DownloadManager download, String attribute, int event_type) {
    CopyOnWriteMap attr_listener_map = getAttributeMapForType(event_type);

    TorrentAttribute attr = convertAttribute(attribute);
    if (attr == null) {return;}
   
    List listeners = null;
    listeners = ((CopyOnWriteList)attr_listener_map.get(attribute)).getList();

    if (listeners == null) {return;}
 
    for (int i=0; i<listeners.size(); i++) {
      DownloadAttributeListener dal = (DownloadAttributeListener)listeners.get(i);
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.util.CopyOnWriteMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.