Skip to content

Commit 18545c5

Browse files
committed
Handle SocketException on writes
Those exceptions are skipped when automatic connection recovery is on. [#159130745] References #106
1 parent 70d7f27 commit 18545c5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/main/java/com/rabbitmq/perf/AgentBase.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.slf4j.LoggerFactory;
2222

2323
import java.io.IOException;
24+
import java.net.SocketException;
2425
import java.util.function.Predicate;
2526

2627
/**
@@ -83,7 +84,16 @@ protected void dealWithWriteOperation(WriteOperation writeOperation, Recovery.Re
8384
writeOperation.call();
8485
} catch (ShutdownSignalException e) {
8586
handleShutdownSignalExceptionOnWrite(recoveryProcess, e);
86-
// connection recovery is in progress, we ignore the exception if this point is reached
87+
} catch (SocketException e) {
88+
if (recoveryProcess.isEnabled()) {
89+
if (LOGGER.isDebugEnabled()) {
90+
LOGGER.debug(
91+
"Socket exception in write, recovery process is enabled, ignoring to let connection recovery carry on"
92+
);
93+
}
94+
} else {
95+
throw e;
96+
}
8797
}
8898
}
8999

0 commit comments

Comments
 (0)