@Override public boolean isShortLived() { return inner.isShortLived(); }
/** * If an option is short-lived, this method returns the number of queries for which the option is valid. * Please read the note at {@link #isShortLived} * * @return number of queries for which the option should be valid */ public int getTtl() { if (!isShortLived()) { throw new UnsupportedOperationException("This option is not short-lived."); } return 0; }
@Override boolean setLocalOption(final OptionValue value) { final boolean set = super.setLocalOption(value); if (!set) { return false; } final String name = value.getName(); final OptionValidator validator = getValidator(name); // if set, validator must exist. final boolean shortLived = validator.isShortLived(); if (shortLived) { final int start = session.getQueryCount() + 1; // start from the next query final int ttl = validator.getTtl(); final int end = start + ttl; shortLivedOptions.put(name, new ImmutablePair<>(start, end)); } return true; }