org.apache.calcite.avatica.remote

## Class KerberosConnection.RenewalTask

- java.lang.Object
- - org.apache.calcite.avatica.remote.KerberosConnection.RenewalTask

All Implemented Interfaces:
  Runnable

Enclosing class:
  KerberosConnection

    static class KerberosConnection.RenewalTask
    extends Object
    implements Runnable

Runnable for performing Kerberos renewals.

### Field Summary

Fields
`private Configuration` `conf`
`private LoginContext` `context`
`private AtomicBoolean` `keepRunning`
`private static org.slf4j.Logger` `RENEWAL_LOG`
`private long` `renewalPeriod`
`private Subject` `subject`
`private KerberosConnection` `utilInstance`

### Constructor Summary

Constructors
Constructor and Description
`RenewalTask(KerberosConnection utilInstance, LoginContext context, Subject subject, Configuration conf, long renewalPeriod)`

### Method Summary

All Methods Instance Methods Concrete Methods
`(package private) void` `asyncStop()`
`(package private) void` `renew()` Logout and log back in with the Kerberos identity.
`void` `run()`
`(package private) boolean` `shouldRenew(long start, long end, long now)` Computes whether or not the ticket should be renewed based on the lifetime of the ticket and the current time.
`(package private) void` `waitForNextCheck(long renewalPeriod)` Wait the given amount of time.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### RENEWAL_LOG

    private static final org.slf4j.Logger RENEWAL_LOG

#### context

    private LoginContext context

#### subject

    private Subject subject

#### utilInstance

    private final KerberosConnection utilInstance

#### conf

    private final Configuration conf

#### renewalPeriod

    private final long renewalPeriod

#### keepRunning

    private final AtomicBoolean keepRunning

### Constructor Detail

#### RenewalTask

    public RenewalTask(KerberosConnection utilInstance,
                       LoginContext context,
                       Subject subject,
                       Configuration conf,
                       long renewalPeriod)

### Method Detail

#### run

    public void run()

Specified by:
  `run` in interface `Runnable`

#### shouldRenew

    boolean shouldRenew(long start,
                        long end,
                        long now)

Computes whether or not the ticket should be renewed based on the lifetime of the ticket and the current time.

Parameters:
  `start` - The start time of the ticket's validity in millis
  `end` - The end time of the ticket's validity in millis
  `now` - Milliseconds since the epoch
Returns:
  True if renewal should occur, false otherwise

#### renew

    void renew()

Logout and log back in with the Kerberos identity.

#### waitForNextCheck

    void waitForNextCheck(long renewalPeriod)

Wait the given amount of time.

Parameters:
  `renewalPeriod` - The number of milliseconds to wait

#### asyncStop

    void asyncStop()