jiacheliu3 commented on code in PR #733:
URL: https://github.com/apache/ratis/pull/733#discussion_r967057138
##########
ratis-server-api/src/main/java/org/apache/ratis/server/RaftServer.java:
##########
@@ -168,21 +172,28 @@ class Builder {
private static Method initNewRaftServerMethod() {
final String className = RaftServer.class.getPackage().getName() +
".impl.ServerImplUtils";
final Class<?>[] argClasses = {RaftPeerId.class, RaftGroup.class,
RaftStorage.StartupOption.class,
- StateMachine.Registry.class, RaftProperties.class, Parameters.class};
+ StateMachine.Registry.class, RaftProperties.class, Parameters.class,
Thread.UncaughtExceptionHandler.class};
try {
final Class<?> clazz = ReflectionUtils.getClassByName(className);
- return clazz.getMethod("newRaftServer", argClasses);
+ try {
+ return clazz.getMethod("newRaftServer", argClasses);
+ } catch (NoSuchMethodException e) {
+ final Class<?>[] argClassesNoExHandler = {RaftPeerId.class,
RaftGroup.class, RaftStorage.StartupOption.class,
+ StateMachine.Registry.class, RaftProperties.class,
Parameters.class};
+ return
ReflectionUtils.getClassByName(className).getMethod("newRaftServer",
argClassesNoExHandler);
Review Comment:
This is an ugly attempt to keep backward compatibility. I totally have no
idea how many people have in-house implementations of `RaftServer` and things
may break because of my change. PTAL if this is okay and i'll really appreciate
it if you could point out a better way :)
--
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]