original_string: protected function signInWithLock(int $duration = null): Token
      {
          if ($this->store) {
              $factory = new Factory($this->store);
              $factory->setLogger($this->logger);
              $lock = $factory->createLock($this->user->getMpxUsername(), 10);
  
              // Blocking means this will throw an exception on failure.
              $lock->acquire(true);
          }
  
          try {
              // It's possible another thread has signed in for us, so check for a token first.
              $token = $this->tokenCachePool->getToken($this);
          } catch (TokenNotFoundException $e) {
              // We have the lock, and there's no token, so sign in.
              $token = $this->signIn($duration);
          }
  
          return $token;
      }
code: protected function signInWithLock(int $duration = null): Token
      {
          if ($this->store) {
              $factory = new Factory($this->store);
              $factory->setLogger($this->logger);
              $lock = $factory->createLock($this->user->getMpxUsername(), 10);
  
              // Blocking means this will throw an exception on failure.
              $lock->acquire(true);
          }
  
          try {
              // It's possible another thread has signed in for us, so check for a token first.
              $token = $this->tokenCachePool->getToken($this);
          } catch (TokenNotFoundException $e) {
              // We have the lock, and there's no token, so sign in.
              $token = $this->signIn($duration);
          }
  
          return $token;
      }
code_tokens: protected function signInWithLock ( int $ duration = null ) : Token { if ( $ this -> store ) { $ factory = new Factory ( $ this -> store ) ; $ factory -> setLogger ( $ this -> logger ) ; $ lock = $ factory -> createLock ( $ this -> user -> getMpxUsername ( ) , 10 ) ; // Blocking means this will throw an exception on failure. $ lock -> acquire ( true ) ; } try { // It's possible another thread has signed in for us, so check for a token first. $ token = $ this -> tokenCachePool -> getToken ( $ this ) ; } catch ( TokenNotFoundException $ e ) { // We have the lock, and there's no token, so sign in. $ token = $ this -> signIn ( $ duration ) ; } return $ token ; }
docstring: Sign in to mpx, with a lock to prevent sign-in stampedes.
  
  @param int $duration (optional) The number of seconds that the sign-in token should be valid for.
  
  @return Token
docstring_tokens: Sign in to mpx with a lock to prevent sign - in stampedes .