Add warning when transient exception suppression is unavailable due to locale
see
package net.openhft.chronicle.network.internal;
+import net.openhft.chronicle.core.Jvm;
+
import java.io.IOException;
import java.net.SocketException;
+import java.util.Locale;
public final class SocketExceptionUtil {
@@ -20,6 +23,8 @@ public final class SocketExceptionUtil {
* @return true if the exception is one that signifies the connection was reset
*/
public static boolean isAConnectionResetException(IOException e) {
+ Language.warnOnce();
+
return isALinuxJava12OrLessConnectionResetException(e)
|| isAWindowsConnectionResetException(e)
|| isALinuxJava13OrGreaterConnectionResetException(e);
@@ -36,4 +41,18 @@ public final class SocketExceptionUtil {
private static boolean isALinuxJava12OrLessConnectionResetException(IOException e) {
return e.getClass().equals(IOException.class) && "Connection reset by peer".equals(e.getMessage());
}
+
+ private static final class Language {
+ static {
+ if (!Locale.getDefault().getLanguage().equals(Locale.ENGLISH.getLanguage())) {
+ Jvm.warn().on(SocketExceptionUtil.class,
+ "Running under non-English locale '" + Locale.getDefault().getLanguage() +
+ "', transient exceptions will be reported with higher level than necessary.");
+ }
+ }
+
+ static void warnOnce() {
+ // No-op.
+ }
+ }
}
