Apache9 commented on code in PR #1970:
URL:
https://github.com/apache/incubator-pegasus/pull/1970#discussion_r1563596827
##########
java-client/src/main/java/org/apache/pegasus/security/KerberosProtocol.java:
##########
@@ -50,19 +50,20 @@ class KerberosProtocol implements AuthProtocol {
// request. The JAAS framework defines the term "subject" to represent the
source of a request. A
// subject may be any entity, such as a person or a service.
private Subject subject;
- private String serviceName;
- private String serviceFqdn;
- private String keyTab;
- private String principal;
+ private final String serviceName;
+ private final String serviceFqdn;
+ private final String keyTab;
+ private final String principal;
final int CHECK_TGT_INTEVAL_SECONDS = 10;
final ScheduledExecutorService service =
Executors.newSingleThreadScheduledExecutor(
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
- Thread t = new Thread(r);
+ Thread t = new Thread(r, "TGT renew for pegasus");
Review Comment:
Better introduce a unique suffix or prefix, otherwise if there are multiple
client you will see multiple threads with the same name.
##########
java-client/src/main/java/org/apache/pegasus/rpc/interceptor/ReplicaSessionInterceptorManager.java:
##########
@@ -49,4 +49,10 @@ public boolean onSendMessage(ReplicaSession session, final
ReplicaSession.Reques
}
return true;
}
+
+ public void close() {
Review Comment:
And please add the `@Override` annotation for this method as it is inherited
from the Closeable interface.
##########
java-client/src/main/java/org/apache/pegasus/security/KerberosProtocol.java:
##########
@@ -96,11 +97,23 @@ public boolean isAuthRequest(final
ReplicaSession.RequestEntry entry) {
}
private void scheduleCheckTGTAndRelogin() {
+ Runnable checkTGTAndReLogin =
Review Comment:
Could still use lambda here.
```
service.scheduleAtFixedRate(
() -> {
try {
checkTGTAndRelogin();
} catch (Exception e) {
logger.warn(
"check TGT and ReLogin kerberos failed , will retry after
{} seconds.",
CHECK_TGT_INTEVAL_SECONDS,
e);
}
}
CHECK_TGT_INTEVAL_SECONDS,
CHECK_TGT_INTEVAL_SECONDS,
TimeUnit.SECONDS);
```
##########
java-client/src/main/java/org/apache/pegasus/rpc/interceptor/ReplicaSessionInterceptor.java:
##########
@@ -27,4 +27,6 @@ public interface ReplicaSessionInterceptor {
// The behavior when rpc session is sending a message.
// @returns false if this message shouldn't be sent.
boolean onSendMessage(ReplicaSession session, final
ReplicaSession.RequestEntry entry);
+
+ void close();
Review Comment:
You missed this interface.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]