use of org.apache.cassandra.distributed.api.IIsolatedExecutor.SerializableFunction in project cassandra by apache.
the class InterceptingExecutorFactory method factory.
<F extends ThreadFactory> F factory(String name, Object extraInfo, ThreadGroup threadGroup, UncaughtExceptionHandler uncaughtExceptionHandler, InterceptibleThreadFactory.MetaFactory<F> factory) {
if (uncaughtExceptionHandler == null)
uncaughtExceptionHandler = transferToInstance.apply((SerializableFunction<Supplier<Boolean>, UncaughtExceptionHandler>) (reportUnchecked) -> (thread, throwable) -> {
if (!(throwable instanceof UncheckedInterruptedException) || reportUnchecked.get())
JVMStabilityInspector.uncaughtException(thread, throwable);
}).apply(() -> !isClosed);
if (threadGroup == null)
threadGroup = this.threadGroup;
else if (!this.threadGroup.parentOf(threadGroup))
throw new IllegalArgumentException();
Runnable onTermination = transferToInstance.apply((SerializableRunnable) FastThreadLocal::removeAll);
LocalTime time = transferToInstance.apply((IIsolatedExecutor.SerializableCallable<LocalTime>) SimulatedTime.Global::current).call();
return factory.create(name, Thread.NORM_PRIORITY, classLoader, uncaughtExceptionHandler, threadGroup, onTermination, time, this, extraInfo);
}
Aggregations