Class KerberosConnection.RenewalTask
- java.lang.Object
-
- org.apache.calcite.avatica.remote.KerberosConnection.RenewalTask
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- KerberosConnection
static class KerberosConnection.RenewalTask extends java.lang.Object implements java.lang.RunnableRunnable for performing Kerberos renewals.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.security.auth.login.Configurationconfprivate javax.security.auth.login.LoginContextcontextprivate java.util.concurrent.atomic.AtomicBooleankeepRunningprivate static org.slf4j.LoggerRENEWAL_LOGprivate longrenewalPeriodprivate javax.security.auth.Subjectsubjectprivate KerberosConnectionutilInstance
-
Constructor Summary
Constructors Constructor Description RenewalTask(KerberosConnection utilInstance, javax.security.auth.login.LoginContext context, javax.security.auth.Subject subject, javax.security.auth.login.Configuration conf, long renewalPeriod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidasyncStop()(package private) voidrenew()Logout and log back in with the Kerberos identity.voidrun()(package private) booleanshouldRenew(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) voidwaitForNextCheck(long renewalPeriod)Wait the given amount of time.
-
-
-
Field Detail
-
RENEWAL_LOG
private static final org.slf4j.Logger RENEWAL_LOG
-
context
private javax.security.auth.login.LoginContext context
-
subject
private javax.security.auth.Subject subject
-
utilInstance
private final KerberosConnection utilInstance
-
conf
private final javax.security.auth.login.Configuration conf
-
renewalPeriod
private final long renewalPeriod
-
keepRunning
private final java.util.concurrent.atomic.AtomicBoolean keepRunning
-
-
Constructor Detail
-
RenewalTask
RenewalTask(KerberosConnection utilInstance, javax.security.auth.login.LoginContext context, javax.security.auth.Subject subject, javax.security.auth.login.Configuration conf, long renewalPeriod)
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.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 millisend- The end time of the ticket's validity in millisnow- 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()
-
-