((InitializeOnMaster)format).initializeGlobal(1);
public static void initializeOutputFormatsOnMaster( JobVertex jobVertex, AbstractFormatStub<OperatorID, ?> stub, final Map<OperatorID, String> formatDescriptions) throws RuntimeException { // set user classloader before calling user code final ClassLoader original = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(stub.getClassLoader()); try { Iterator<? extends Pair<OperatorID, ?>> it = stub.getFormat(FormatType.OUTPUT); it.forEachRemaining( (pair) -> { OperatorID key = pair.getKey(); OutputFormat outputFormat = (OutputFormat) pair.getValue(); if (outputFormat instanceof InitializeOnMaster) { try { outputFormat.configure(stub.getParameters(key)); ((InitializeOnMaster) outputFormat).initializeGlobal(jobVertex.getParallelism()); } catch (Throwable t) { throw new RuntimeException("Configuring the OutputFormat (" + "description: " + formatDescriptions.get(key) + ", stubKey: " + key + ") failed: " + t.getMessage(), t); } } } ); } finally { // restore previous classloader Thread.currentThread().setContextClassLoader(original); } }
((InitializeOnMaster) outputFormat).initializeGlobal(getParallelism());
((InitializeOnMaster) outputFormat).initializeGlobal(getParallelism());
((InitializeOnMaster) outputFormat).initializeGlobal(getParallelism());
((InitializeOnMaster)format).initializeGlobal(1);
((InitializeOnMaster)format).initializeGlobal(1);