Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.Random;
import java.util.Collection;

import javax.cache.Cache;
import javax.cache.CacheManager;
Expand Down Expand Up @@ -968,7 +969,7 @@ public int getActiveSubClustersCount() throws YarnException {
* @throws YarnException When there is no Active SubCluster,
* an exception will be thrown (No active SubCluster available to submit the request.)
*/
public static SubClusterId getRandomActiveSubCluster(
public SubClusterId getRandomActiveSubCluster(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this still static?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change the places where we call it to call it as static.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your help to review the code! This part of the code can continue to be static, I will modify the code.

Map<SubClusterId, SubClusterInfo> activeSubClusters, List<SubClusterId> blackList)
throws YarnException {

Expand Down Expand Up @@ -1211,4 +1212,19 @@ public boolean deregisterSubCluster(SubClusterId subClusterId,
}
return false;
}

/**
* Get active subclusters.
*
* @return We will return a list of active subclusters as a Collection.
*/
public Collection<SubClusterInfo> getActiveSubClusters() {
try {
Map<SubClusterId, SubClusterInfo> subClusterMap = getSubClusters(true);
return subClusterMap.values();
} catch (Exception e) {
LOG.error("getSubClustersCollection failed.", e);
return null;
}
}
}
Loading