// "modprinc -maxlife 3mins <principal>" in kadmin.
t = new Thread(new Runnable() {
public void run() {
LOG.info("TGT refresh thread started.");
while (true) { // renewal thread's main loop. if it exits from here, thread will exit.
KerberosTicket tgt = getTGT();
long now = System.currentTimeMillis();
long nextRefresh;
Date nextRefreshDate;
if (tgt == null) {
nextRefresh = now + MIN_TIME_BEFORE_RELOGIN;
nextRefreshDate = new Date(nextRefresh);
LOG.warn("No TGT found: will try again at " + nextRefreshDate);
} else {
nextRefresh = getRefreshTime(tgt);
long expiry = tgt.getEndTime().getTime();
Date expiryDate = new Date(expiry);
if ((isUsingTicketCache) && (tgt.getEndTime().equals(tgt.getRenewTill()))) {
LOG.error("The TGT cannot be renewed beyond the next expiry date: " + expiryDate + "." +
"This process will not be able to authenticate new SASL connections after that " +
"time (for example, it will not be authenticate a new connection with a Zookeeper " +
"Quorum member). Ask your system administrator to either increase the " +
"'renew until' time by doing : 'modprinc -maxrenewlife " + principal + "' within " +