Java Code Examples for org.apache.flink.api.common.functions.BroadcastVariableInitializer#initializeBroadcastVariable()
The following examples show how to use
org.apache.flink.api.common.functions.BroadcastVariableInitializer#initializeBroadcastVariable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuntimeUDFContext.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public <T, C> C getBroadcastVariableWithInitializer(String name, BroadcastVariableInitializer<T, C> initializer) { // check if we have an initialized version Object o = this.initializedBroadcastVars.get(name); if (o != null) { return (C) o; } else { List<T> uninitialized = (List<T>) this.uninitializedBroadcastVars.remove(name); if (uninitialized != null) { C result = initializer.initializeBroadcastVariable(uninitialized); this.initializedBroadcastVars.put(name, result); return result; } else { throw new IllegalArgumentException("The broadcast variable with name '" + name + "' has not been set."); } } }
Example 2
Source File: BroadcastVariableMaterialization.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public C getVariable(BroadcastVariableInitializer<T, C> initializer) { if (!materialized) { throw new IllegalStateException("The Broadcast Variable has not yet been materialized."); } if (disposed) { throw new IllegalStateException("The Broadcast Variable has been disposed"); } synchronized (references) { if (transformed == null) { transformed = initializer.initializeBroadcastVariable(data); data = null; } return transformed; } }
Example 3
Source File: RuntimeUDFContext.java From flink with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public <T, C> C getBroadcastVariableWithInitializer(String name, BroadcastVariableInitializer<T, C> initializer) { // check if we have an initialized version Object o = this.initializedBroadcastVars.get(name); if (o != null) { return (C) o; } else { List<T> uninitialized = (List<T>) this.uninitializedBroadcastVars.remove(name); if (uninitialized != null) { C result = initializer.initializeBroadcastVariable(uninitialized); this.initializedBroadcastVars.put(name, result); return result; } else { throw new IllegalArgumentException("The broadcast variable with name '" + name + "' has not been set."); } } }
Example 4
Source File: BroadcastVariableMaterialization.java From flink with Apache License 2.0 | 6 votes |
public C getVariable(BroadcastVariableInitializer<T, C> initializer) { if (!materialized) { throw new IllegalStateException("The Broadcast Variable has not yet been materialized."); } if (disposed) { throw new IllegalStateException("The Broadcast Variable has been disposed"); } synchronized (references) { if (transformed == null) { transformed = initializer.initializeBroadcastVariable(data); data = null; } return transformed; } }
Example 5
Source File: RuntimeUDFContext.java From flink with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public <T, C> C getBroadcastVariableWithInitializer(String name, BroadcastVariableInitializer<T, C> initializer) { // check if we have an initialized version Object o = this.initializedBroadcastVars.get(name); if (o != null) { return (C) o; } else { List<T> uninitialized = (List<T>) this.uninitializedBroadcastVars.remove(name); if (uninitialized != null) { C result = initializer.initializeBroadcastVariable(uninitialized); this.initializedBroadcastVars.put(name, result); return result; } else { throw new IllegalArgumentException("The broadcast variable with name '" + name + "' has not been set."); } } }
Example 6
Source File: BroadcastVariableMaterialization.java From flink with Apache License 2.0 | 6 votes |
public C getVariable(BroadcastVariableInitializer<T, C> initializer) { if (!materialized) { throw new IllegalStateException("The Broadcast Variable has not yet been materialized."); } if (disposed) { throw new IllegalStateException("The Broadcast Variable has been disposed"); } synchronized (references) { if (transformed == null) { transformed = initializer.initializeBroadcastVariable(data); data = null; } return transformed; } }