public void maybeLookAhead(){
  lock.lock();
  try {
    List<DeterministicKey> keys=maybeLookAhead(externalParentKey,issuedExternalKeys);
    keys.addAll(maybeLookAhead(internalParentKey,issuedInternalKeys));
    if (keys.isEmpty())     return;
    keyLookaheadEpoch++;
    basicKeyChain.importKeys(keys);
  }
  finally {
    lock.unlock();
  }
}

public void maybeLookAhead ( ) { lock . lock ( ) ; try { List < DeterministicKey > keys = maybeLookAhead ( externalParentKey , issuedExternalKeys ) ; keys . addAll ( maybeLookAhead ( internalParentKey , issuedInternalKeys ) ) ; if ( keys . isEmpty ( ) ) return ; keyLookaheadEpoch ++ ; basicKeyChain . importKeys ( keys ) ; } finally { lock . unlock ( ) ; } }
pre - generate enough keys to reach the lookahead size . you can call this if you need to explicitly invoke the lookahead procedure , but it ' s normally unnecessary as it will be done automatically when needed .
