// locals are a tiny bit faster
final boolean firstPiecePriorityL =firstPiecePriority;
final boolean completionPriorityL =completionPriority;
final DMPieceMap pieceMap = diskManager.getPieceMap();
try
{
final boolean rarestOverride = calcRarestAllowed() < 1;
// calculate all base (starting) priorities for all pieces needing requesting
final int nbConnects =peerControl.getNbPeers() +peerControl.getNbSeeds();
for (int i =0; i <nbPieces; i++)
{
final DiskManagerPiece dmPiece =dmPieces[i];
if (dmPiece.isDone())
continue; // nothing to do for pieces not needing requesting
int startPriority =Integer.MIN_VALUE;
final DMPieceList pieceList =pieceMap.getPieceList(dmPiece.getPieceNumber());
final int pieceListSize =pieceList.size();
for (int j =0; j <pieceListSize; j++)
{
final DiskManagerFileInfoImpl fileInfo =pieceList.get(j).getFile();
final long downloaded =fileInfo.getDownloaded();