steveniemitz commented on code in PR #22162:
URL: https://github.com/apache/beam/pull/22162#discussion_r915256981
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/options/ProxyInvocationHandler.java:
##########
@@ -671,50 +726,50 @@ private void serializeEntry(
public void serialize(PipelineOptions value, JsonGenerator jgen,
SerializerProvider provider)
throws IOException {
ProxyInvocationHandler handler = (ProxyInvocationHandler)
Proxy.getInvocationHandler(value);
- synchronized (handler) {
- PipelineOptionsFactory.Cache cache =
PipelineOptionsFactory.CACHE.get();
- // We first filter out any properties that have been modified since
- // the last serialization of this PipelineOptions and then verify that
- // they are all serializable.
- Map<String, BoundValue> filteredOptions =
Maps.newHashMap(handler.options);
- Map<String, JsonSerializer<Object>> propertyToSerializer =
- getSerializerMap(cache, handler.knownInterfaces);
- removeIgnoredOptions(cache, handler.knownInterfaces, filteredOptions);
- ensureSerializable(cache, handler.knownInterfaces, filteredOptions,
propertyToSerializer);
-
- // Now we create the map of serializable options by taking the original
- // set of serialized options (if any) and updating them with any
properties
- // instances that have been modified since the previous serialization.
- Map<String, Object> serializableOptions =
Maps.newHashMap(handler.jsonOptions);
- for (Map.Entry<String, BoundValue> entry : filteredOptions.entrySet())
{
- serializableOptions.put(entry.getKey(), entry.getValue().getValue());
- }
+ PipelineOptionsFactory.Cache cache = PipelineOptionsFactory.CACHE.get();
+ // We first filter out any properties that have been modified since
+ // the last serialization of this PipelineOptions and then verify that
+ // they are all serializable.
+ Map<String, BoundValue> filteredOptions =
Maps.newHashMap(handler.options);
+ Set<Class<? extends PipelineOptions>> knownInterfaces =
+ handler.computedProperties.knownInterfaces;
+ Map<String, JsonSerializer<Object>> propertyToSerializer =
+ getSerializerMap(cache, knownInterfaces);
+ removeIgnoredOptions(cache, knownInterfaces, filteredOptions);
+ ensureSerializable(cache, knownInterfaces, filteredOptions,
propertyToSerializer);
Review Comment:
oh yeah I like that idea.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]