@@ -132,7 +132,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher implements I
132132
133133 private static final int STATUS_DESTROYED = 2 ;
134134
135- private static final Log log = LogFactory .getLog (SecretLeaseContainer .class );
135+ @ SuppressWarnings ("FieldMayBeFinal" ) // allow setting via reflection.
136+ private static Log logger = LogFactory .getLog (SecretLeaseContainer .class );
136137
137138 private final List <RequestedSecret > requestedSecrets = new CopyOnWriteArrayList <>();
138139
@@ -608,14 +609,14 @@ private LeaseRenewalScheduler getRenewalSchedulder(RequestedSecret secret) {
608609
609610 private static void logRenewalCandidate (RequestedSecret requestedSecret , Lease lease , String action ) {
610611
611- if (log .isDebugEnabled ()) {
612+ if (logger .isDebugEnabled ()) {
612613
613614 if (lease .hasLeaseId ()) {
614- log .debug (String .format ("Secret %s with Lease %s qualified for %s" , requestedSecret .getPath (),
615+ logger .debug (String .format ("Secret %s with Lease %s qualified for %s" , requestedSecret .getPath (),
615616 lease .getLeaseId (), action ));
616617 }
617618 else {
618- log .debug (String .format ("Secret %s with cache hint is qualified for %s" , requestedSecret .getPath (),
619+ logger .debug (String .format ("Secret %s with cache hint is qualified for %s" , requestedSecret .getPath (),
619620 action ));
620621 }
621622 }
@@ -784,7 +785,8 @@ protected void doRevokeLease(RequestedSecret requestedSecret, Lease lease) {
784785 */
785786 static class LeaseRenewalScheduler {
786787
787- private static final Log log = org .apache .commons .logging .LogFactory .getLog (LeaseRenewalScheduler .class );
788+ @ SuppressWarnings ("FieldMayBeFinal" ) // allow setting via reflection.
789+ private static Log logger = LogFactory .getLog (LeaseRenewalScheduler .class );
788790
789791 private final TaskScheduler taskScheduler ;
790792
@@ -812,13 +814,13 @@ static class LeaseRenewalScheduler {
812814 void scheduleRenewal (RequestedSecret requestedSecret , RenewLease renewLease , Lease lease , Duration minRenewal ,
813815 Duration expiryThreshold ) {
814816
815- if (log .isDebugEnabled ()) {
817+ if (logger .isDebugEnabled ()) {
816818 if (lease .hasLeaseId ()) {
817- log .debug (String .format ("Scheduling renewal for secret %s with lease %s, lease duration %d" ,
819+ logger .debug (String .format ("Scheduling renewal for secret %s with lease %s, lease duration %d" ,
818820 requestedSecret .getPath (), lease .getLeaseId (), lease .getLeaseDuration ().getSeconds ()));
819821 }
820822 else {
821- log .debug (String .format ("Scheduling renewal for secret %s, with cache hint duration %d" ,
823+ logger .debug (String .format ("Scheduling renewal for secret %s, with cache hint duration %d" ,
822824 requestedSecret .getPath (), lease .getLeaseDuration ().getSeconds ()));
823825 }
824826 }
@@ -838,17 +840,17 @@ public void run() {
838840 LeaseRenewalScheduler .this .schedules .remove (lease );
839841
840842 if (LeaseRenewalScheduler .this .currentLeaseRef .get () != lease ) {
841- log .debug ("Current lease has changed. Skipping renewal" );
843+ logger .debug ("Current lease has changed. Skipping renewal" );
842844 return ;
843845 }
844846
845- if (log .isDebugEnabled ()) {
847+ if (logger .isDebugEnabled ()) {
846848 if (lease .hasLeaseId ()) {
847- log .debug (String .format ("Renewing lease %s for secret %s" , lease .getLeaseId (),
849+ logger .debug (String .format ("Renewing lease %s for secret %s" , lease .getLeaseId (),
848850 requestedSecret .getPath ()));
849851 }
850852 else {
851- log .debug (String .format ("Renewing secret without lease %s" , requestedSecret .getPath ()));
853+ logger .debug (String .format ("Renewing secret without lease %s" , requestedSecret .getPath ()));
852854 }
853855 }
854856
@@ -860,7 +862,7 @@ public void run() {
860862 LeaseRenewalScheduler .this .currentLeaseRef .compareAndSet (lease , renewLease .renewLease (lease ));
861863 }
862864 catch (Exception e ) {
863- log .error (String .format ("Cannot renew lease %s" , lease .getLeaseId ()), e );
865+ logger .error (String .format ("Cannot renew lease %s" , lease .getLeaseId ()), e );
864866 }
865867 }
866868 };
@@ -876,8 +878,8 @@ private void cancelSchedule(Lease lease) {
876878 ScheduledFuture <?> scheduledFuture = this .schedules .get (lease );
877879 if (scheduledFuture != null ) {
878880
879- if (log .isDebugEnabled ()) {
880- log .debug (
881+ if (logger .isDebugEnabled ()) {
882+ logger .debug (
881883 String .format ("Canceling previously registered schedule for lease %s" , lease .getLeaseId ()));
882884 }
883885
0 commit comments