org.apache.calcite.avatica.remote

## Class KerberosConnection

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

    public class KerberosConnection
    extends Object

A utility to perform Kerberos logins and renewals.

### Field Summary

Fields
`static float` `PERCENT_OF_LIFETIME_TO_RENEW` The percentage of the Kerberos ticket's lifetime which we should start trying to renew it
`static long` `RENEWAL_PERIOD` How long should we sleep between checks to renew the Kerberos ticket

### Constructor Summary

Constructors
Constructor and Description
`KerberosConnection(String principal, File keytab)` Constructs an instance.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static String` `getKrb5LoginModuleName()` Returns the KRB5 LoginModule implementation.
`Subject` `getSubject()`
`static boolean` `isIbmJava()` Returns whether or not the current environment is IBM Java.
`void` `login()` Perform a Kerberos login and launch a daemon thread to periodically perfrom renewals of that Kerberos login.
`void` `stopRenewalThread()` Stops the Kerberos renewal thread if it is still running.

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

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

### Field Detail

#### PERCENT_OF_LIFETIME_TO_RENEW

    public static final float PERCENT_OF_LIFETIME_TO_RENEW

The percentage of the Kerberos ticket's lifetime which we should start trying to renew it

See Also:
  Constant Field Values

#### RENEWAL_PERIOD

    public static final long RENEWAL_PERIOD

How long should we sleep between checks to renew the Kerberos ticket

See Also:
  Constant Field Values

### Constructor Detail

#### KerberosConnection

    public KerberosConnection(String principal,
                              File keytab)

Constructs an instance.

Parameters:
  `principal` - The Kerberos principal
  `keytab` - The keytab containing keys for the Kerberos principal

### Method Detail

#### getSubject

    public Subject getSubject()

#### login

    public void login()

Perform a Kerberos login and launch a daemon thread to periodically perfrom renewals of that Kerberos login. Exceptions are intentionally caught and rethrown as unchecked exceptions as there is nothing Avatica itself can do if the Kerberos login fails.

Throws:
  `RuntimeException` - If the Kerberos login fails

#### stopRenewalThread

    public void stopRenewalThread()

Stops the Kerberos renewal thread if it is still running. If the thread was already started or never started, this method does nothing.

#### isIbmJava

    public static boolean isIbmJava()

Returns whether or not the current environment is IBM Java. Otherwise, assumed to be Oracle Java/OpenJDK.

Returns:
  True if the environment is IBM Java, false otherwise.

#### getKrb5LoginModuleName

    public static String getKrb5LoginModuleName()

Returns the KRB5 LoginModule implementation. This is JVM-vendor dependent.

Returns:
  The class name of the KRB5 LoginModule