YARN-10909. AbstractCSQueue: Annotate all methods with VisibleForTesting that are only used by test code. Contributed by JackWangCS, Szilard Nemeth

This commit is contained in:
Jack 2021-10-23 14:47:00 +02:00 committed by Szilard Nemeth
parent 6e57449350
commit 9cfd8d0a83

View File

@ -287,6 +287,7 @@ public boolean hasAccess(QueueACL acl, UserGroupInformation user) {
* Set maximum capacity - used only for testing. * Set maximum capacity - used only for testing.
* @param maximumCapacity new max capacity * @param maximumCapacity new max capacity
*/ */
@VisibleForTesting
void setMaxCapacity(float maximumCapacity) { void setMaxCapacity(float maximumCapacity) {
writeLock.lock(); writeLock.lock();
try { try {
@ -1023,7 +1024,8 @@ Resource getQueueMaxResource(String nodePartition) {
return getEffectiveMaxCapacity(nodePartition); return getEffectiveMaxCapacity(nodePartition);
} }
public boolean hasChildQueues() { @VisibleForTesting
boolean hasChildQueues() {
List<CSQueue> childQueues = getChildQueues(); List<CSQueue> childQueues = getChildQueues();
return childQueues != null && !childQueues.isEmpty(); return childQueues != null && !childQueues.isEmpty();
} }
@ -1608,7 +1610,7 @@ public boolean isInactiveDynamicQueue() {
getAutoExpiredDeletionTime()); getAutoExpiredDeletionTime());
} }
public void updateLastSubmittedTimeStamp() { void updateLastSubmittedTimeStamp() {
writeLock.lock(); writeLock.lock();
try { try {
usageTracker.setLastSubmittedTimestamp(Time.monotonicNow()); usageTracker.setLastSubmittedTimestamp(Time.monotonicNow());
@ -1617,7 +1619,8 @@ public void updateLastSubmittedTimeStamp() {
} }
} }
public long getLastSubmittedTimestamp() { @VisibleForTesting
long getLastSubmittedTimestamp() {
readLock.lock(); readLock.lock();
try { try {
@ -1628,7 +1631,7 @@ public long getLastSubmittedTimestamp() {
} }
@VisibleForTesting @VisibleForTesting
public void setLastSubmittedTimestamp(long lastSubmittedTimestamp) { void setLastSubmittedTimestamp(long lastSubmittedTimestamp) {
writeLock.lock(); writeLock.lock();
try { try {
usageTracker.setLastSubmittedTimestamp(lastSubmittedTimestamp); usageTracker.setLastSubmittedTimestamp(lastSubmittedTimestamp);