src/main/java/org/apache/mesos/hdfs/state/PersistentState.java
// Possibly call removeTask(slaveId, taskId) to avoid iterating through all maps
Possibly call removeTask(slaveId, taskId) to avoid iterating through all maps
Possibly call removeTask ( slaveId taskId ) to avoid iterating through all maps
public void removeTaskId(String taskId) {
    HashMap<String, String> journalNodes = getJournalNodes();
    if (journalNodes.values().contains(taskId)) {
      for (Map.Entry<String, String> entry : journalNodes.entrySet()) {
        if (entry.getValue() != null && entry.getValue().equals(taskId)) {
          journalNodes.put(entry.getKey(), null);
          setJournalNodes(journalNodes);
          HashMap<String, String> journalNodeTaskNames = getJournalNodeTaskNames();
          journalNodeTaskNames.remove(taskId);
          setJournalNodeTaskNames(journalNodeTaskNames);
          Date date = DateUtils.addSeconds(new Date(), conf.getDeadNodeTimeout());
          deadJournalNodeTimeStamp = new Timestamp(date.getTime());
          return;
        }
      }
    }
    HashMap<String, String> nameNodes = getNameNodes();
    if (nameNodes.values().contains(taskId)) {
      for (Map.Entry<String, String> entry : nameNodes.entrySet()) {
        if (entry.getValue() != null && entry.getValue().equals(taskId)) {
          nameNodes.put(entry.getKey(), null);
          setNameNodes(nameNodes);
          HashMap<String, String> nameNodeTaskNames = getNameNodeTaskNames();
          nameNodeTaskNames.remove(taskId);
          setNameNodeTaskNames(nameNodeTaskNames);
          Date date = DateUtils.addSeconds(new Date(), conf.getDeadNodeTimeout());
          deadNameNodeTimeStamp = new Timestamp(date.getTime());
          return;
        }
      }
    }
    HashMap<String, String> dataNodes = getDataNodes();
    if (dataNodes.values().contains(taskId)) {
      for (Map.Entry<String, String> entry : dataNodes.entrySet()) {
        if (entry.getValue() != null && entry.getValue().equals(taskId)) {
          dataNodes.put(entry.getKey(), null);
          setDataNodes(dataNodes);
          Date date = DateUtils.addSeconds(new Date(), conf.getDeadNodeTimeout());
          deadDataNodeTimeStamp = new Timestamp(date.getTime());
          return;
        }
      }
    }
  }
public void removeTaskId ( String taskId ) { HashMap < String , String > journalNodes = getJournalNodes ( ) ; if ( journalNodes . values ( ) . contains ( taskId ) ) { for ( Map . Entry < String , String > entry : journalNodes . entrySet ( ) ) { if ( entry . getValue ( ) != null && entry . getValue ( ) . equals ( taskId ) ) { journalNodes . put ( entry . getKey ( ) , null ) ; setJournalNodes ( journalNodes ) ; HashMap < String , String > journalNodeTaskNames = getJournalNodeTaskNames ( ) ; journalNodeTaskNames . remove ( taskId ) ; setJournalNodeTaskNames ( journalNodeTaskNames ) ; Date date = DateUtils . addSeconds ( new Date ( ) , conf . getDeadNodeTimeout ( ) ) ; deadJournalNodeTimeStamp = new Timestamp ( date . getTime ( ) ) ; return ; } } } HashMap < String , String > nameNodes = getNameNodes ( ) ; if ( nameNodes . values ( ) . contains ( taskId ) ) { for ( Map . Entry < String , String > entry : nameNodes . entrySet ( ) ) { if ( entry . getValue ( ) != null && entry . getValue ( ) . equals ( taskId ) ) { nameNodes . put ( entry . getKey ( ) , null ) ; setNameNodes ( nameNodes ) ; HashMap < String , String > nameNodeTaskNames = getNameNodeTaskNames ( ) ; nameNodeTaskNames . remove ( taskId ) ; setNameNodeTaskNames ( nameNodeTaskNames ) ; Date date = DateUtils . addSeconds ( new Date ( ) , conf . getDeadNodeTimeout ( ) ) ; deadNameNodeTimeStamp = new Timestamp ( date . getTime ( ) ) ; return ; } } } HashMap < String , String > dataNodes = getDataNodes ( ) ; if ( dataNodes . values ( ) . contains ( taskId ) ) { for ( Map . Entry < String , String > entry : dataNodes . entrySet ( ) ) { if ( entry . getValue ( ) != null && entry . getValue ( ) . equals ( taskId ) ) { dataNodes . put ( entry . getKey ( ) , null ) ; setDataNodes ( dataNodes ) ; Date date = DateUtils . addSeconds ( new Date ( ) , conf . getDeadNodeTimeout ( ) ) ; deadDataNodeTimeStamp = new Timestamp ( date . getTime ( ) ) ; return ; } } } }
Possibly call removeTask(slaveId, taskId) to avoid iterating through all maps
Possibly call removeTask ( slaveId taskId ) to avoid iterating through all maps