File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
raft/src/main/java/org/apache/kafka/raft Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -59,4 +59,11 @@ default Optional<LogOffsetMetadata> highWatermark() {
59
59
* User-friendly description of the state
60
60
*/
61
61
String name ();
62
+
63
+ /**
64
+ * Since all subclasses implement the Closeable interface while none throw any IOException,
65
+ * this implementation is provided to eliminate the need for exception handling in the close operation.
66
+ */
67
+ @ Override
68
+ void close ();
62
69
}
Original file line number Diff line number Diff line change 27
27
28
28
import org .slf4j .Logger ;
29
29
30
- import java .io .IOException ;
31
- import java .io .UncheckedIOException ;
32
30
import java .util .List ;
33
31
import java .util .Optional ;
34
32
import java .util .OptionalInt ;
@@ -736,12 +734,7 @@ private void durableTransitionTo(EpochState newState) {
736
734
737
735
private void memoryTransitionTo (EpochState newState ) {
738
736
if (state != null ) {
739
- try {
740
- state .close ();
741
- } catch (IOException e ) {
742
- throw new UncheckedIOException (
743
- "Failed to transition from " + state .name () + " to " + newState .name (), e );
744
- }
737
+ state .close ();
745
738
}
746
739
747
740
EpochState from = state ;
You can’t perform that action at this time.
0 commit comments