Fixed some warnings during compilation.

This commit is contained in:
Mosharaf Chowdhury 2011-02-09 12:11:43 -08:00
Родитель 1a73c0d265
Коммит 441462bc7f
1 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -6,6 +6,7 @@ import java.util.{BitSet, Comparator, Random, Timer, TimerTask, UUID}
import java.util.concurrent.{Executors, ThreadFactory, ThreadPoolExecutor}
import scala.collection.mutable.{ListBuffer, Map, Set}
import scala.math
@serializable
class BitTorrentBroadcast[T] (@transient var value_ : T, isLocal: Boolean)
@ -113,7 +114,7 @@ extends Broadcast[T] with Logging {
}
// In the beginning, this is the only known source to Guide
listOfSources = listOfSources + masterSource
listOfSources += masterSource
// Register with the Tracker
BitTorrentBroadcast.registerValue (uuid,
@ -203,7 +204,7 @@ extends Broadcast[T] with Logging {
var blockID = 0
for (i <- 0 until (byteArray.length, blockSize)) {
val thisBlockSize = Math.min (blockSize, byteArray.length - i)
val thisBlockSize = math.min (blockSize, byteArray.length - i)
var tempByteArray = new Array[Byte] (thisBlockSize)
val hasRead = bais.read (tempByteArray, 0, thisBlockSize)
@ -268,7 +269,7 @@ extends Broadcast[T] with Logging {
if (listOfSources.contains(newSourceInfo)) {
listOfSources = listOfSources - newSourceInfo
}
listOfSources = listOfSources + newSourceInfo
listOfSources += newSourceInfo
}
}
@ -435,7 +436,7 @@ extends Broadcast[T] with Logging {
while (hasBlocks < totalBlocks) {
var numThreadsToCreate =
Math.min (listOfSources.size, BitTorrentBroadcast.MaxTxPeers) -
math.min (listOfSources.size, BitTorrentBroadcast.MaxTxPeers) -
threadPool.getActiveCount
while (hasBlocks < totalBlocks && numThreadsToCreate > 0) {
@ -446,7 +447,7 @@ extends Broadcast[T] with Logging {
// Add to peersNowTalking. Remove in the thread. We have to do this
// ASAP, otherwise pickPeerToTalkTo picks the same peer more than once
peersNowTalking.synchronized {
peersNowTalking = peersNowTalking + peerToTalkTo
peersNowTalking += peerToTalkTo
}
}
@ -936,7 +937,7 @@ extends Broadcast[T] with Logging {
i = i - 1
}
selectedSources = selectedSources + curPeer
selectedSources += curPeer
picksLeft = picksLeft - 1
}
@ -1087,7 +1088,10 @@ extends Broadcast[T] with Logging {
class BitTorrentBroadcastFactory
extends BroadcastFactory {
def initialize (isMaster: Boolean) = BitTorrentBroadcast.initialize (isMaster)
def initialize (isMaster: Boolean) = {
BitTorrentBroadcast.initialize (isMaster)
}
def newBroadcast[T] (value_ : T, isLocal: Boolean) =
new BitTorrentBroadcast[T] (value_, isLocal)
}