code: public void setStallThreshold(int periodSecs, int bytesPerSecond) {
          lock.lock();
          try {
              stallPeriodSeconds = periodSecs;
              stallMinSpeedBytesSec = bytesPerSecond;
          } finally {
              lock.unlock();
          }
      }
docs: Configures the stall speed: the speed at which a peer is considered to be serving us the block chain
  unacceptably slowly. Once a peer has served us data slower than the given data rate for the given
  number of seconds, it is considered stalled and will be disconnected, forcing the chain download to continue
  from a different peer. The defaults are chosen conservatively, but if you are running on a platform that is
  CPU constrained or on a very slow network e.g. EDGE, the default settings may need adjustment to
  avoid false stalls.
  
  @param periodSecs How many seconds the download speed must be below blocksPerSec, defaults to 10.
  @param bytesPerSecond Download speed (only blocks/txns count) must be consistently below this for a stall, defaults to the bandwidth required for 10 block headers per second.