@@ -0,0 +1,1931 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.facebook.presto.spi.classloader;%0A%0Aimport com.facebook.presto.spi.ConnectorInsertTableHandle;%0Aimport com.facebook.presto.spi.ConnectorOutputTableHandle;%0Aimport com.facebook.presto.spi.ConnectorPageSink;%0Aimport com.facebook.presto.spi.ConnectorPageSinkProvider;%0A%0Aimport static java.util.Objects.requireNonNull;%0A%0Apublic final class ClassLoaderSafeConnectorPageSinkProvider%0A        implements ConnectorPageSinkProvider%0A%7B%0A    private final ConnectorPageSinkProvider delegate;%0A    private final ClassLoader classLoader;%0A%0A    public ClassLoaderSafeConnectorPageSinkProvider(ConnectorPageSinkProvider delegate, ClassLoader classLoader)%0A    %7B%0A        this.delegate = requireNonNull(delegate, %22delegate is null%22);%0A        this.classLoader = requireNonNull(classLoader, %22classLoader is null%22);%0A    %7D%0A%0A    @Override%0A    public ConnectorPageSink createPageSink(ConnectorOutputTableHandle outputTableHandle)%0A    %7B%0A        try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) %7B%0A            return delegate.createPageSink(outputTableHandle);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public ConnectorPageSink createPageSink(ConnectorInsertTableHandle insertTableHandle)%0A    %7B%0A        try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) %7B%0A            return delegate.createPageSink(insertTableHandle);%0A        %7D%0A    %7D%0A%7D%0A

Add ClassLoaderSafeConnectorPageSinkProvider