code: public static Matcher matcher(
              Pattern pattern,
              CharSequence charSequence,
              long timeoutInMilliseconds
      ) {
          // Substitute in our exploding CharSequence implementation.
          if (!(charSequence instanceof TimeLimitedCharSequence)) {
              charSequence = new TimeLimitedCharSequence(
                      charSequence,
                      timeoutInMilliseconds,
                      pattern,
                      charSequence
              );
          }
  
          return pattern.matcher(charSequence);
      }
docs: Generate a Matcher instance that will throw if used or still
  in use more than timeoutInMilliseconds after its instantiation.
  <p>
  Use the instance immediately and then discard it.
  
  @param pattern               The Pattern instance.
  @param charSequence          The CharSequence to operate on.
  @param timeoutInMilliseconds Throw after this timeout is reached.
  @return a matcher