flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #4921: [FLINK-7943] Make ParameterTool thread safe
Date Wed, 08 Nov 2017 14:12:08 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4921#discussion_r149678385
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java
---
    @@ -210,15 +212,44 @@ public static ParameterTool fromSystemProperties() {
     		return fromMap((Map) System.getProperties());
     	}
     
    +	private static final Object placeholder = new Object();
    +
     	// ------------------ ParameterUtil  ------------------------
     	protected final Map<String, String> data;
    -	protected final Map<String, String> defaultData;
    -	protected final Set<String> unrequestedParameters;
    +
    +	// data which is only used on the client and does not need to be transmitted
    +	protected transient Map<String, String> defaultData;
    +	protected transient Map<String, Object> unrequestedParameters;
     
     	private ParameterTool(Map<String, String> data) {
    -		this.data = new HashMap<>(data);
    -		this.defaultData = new HashMap<>();
    -		this.unrequestedParameters = new HashSet<>(data.keySet());
    +		this.data = Collections.unmodifiableMap(new HashMap<>(data));
    +
    +		this.defaultData = new ConcurrentHashMap<>(data.size());
    +
    +		this.unrequestedParameters = new ConcurrentHashMap<>(data.size());
    --- End diff --
    
    Yes I must have changed something. Don't know really what. Will re-address your feedback.


---

Mime
View raw message