/** * Checks a class which is being either serialized or deserialized. * A warning will only be printed once per class per JVM session. */ public static void check(@Nonnull Class<?> clazz) { synchronized (checked) { if (checked.containsKey(clazz)) { return; // fast path } } Channel channel = Channel.current(); if (channel == null) { doCheck(clazz); } else { // May not call methods like Class#isAnonymousClass synchronously, since these can in turn trigger remote class loading. try { channel.executor.submit((Runnable) () -> doCheck(clazz)); } catch (RejectedExecutionException x) { // never mind, we tried } } }