private void printShortWorkerInfo ( List < WorkerInfo > workerInfoList ) { String tier = mCapacityTierInfoMap . firstKey ( ) ; String shortInfoFormat = getInfoFormat ( workerInfoList , true ) ; print ( String . format ( "%n" + shortInfoFormat , "Worker Name" , "Last Heartbeat" , "Storage" , tier ) ) ; for ( WorkerInfo info : workerInfoList ) { long capacityBytes = info . getCapacityBytes ( ) ; long usedBytes = info . getUsedBytes ( ) ; String usedPercentageInfo = "" ; if ( capacityBytes != 0 ) { int usedPercentage = ( int ) ( 100L * usedBytes / capacityBytes ) ; usedPercentageInfo = String . format ( " (%s%%)" , usedPercentage ) ; } print ( String . format ( shortInfoFormat , info . getAddress ( ) . getHost ( ) , info . getLastContactSec ( ) , "capacity" , FormatUtils . getSizeFromBytes ( capacityBytes ) ) ) ; print ( String . format ( shortInfoFormat , "" , "" , "used" , FormatUtils . getSizeFromBytes ( usedBytes ) + usedPercentageInfo ) ) ; } }
Prints worker information when only one tier exists .