You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by "Cameron Lee (JIRA)" <ji...@apache.org> on 2018/09/13 21:14:00 UTC

[jira] [Commented] (SAMZA-899) Re-design the JobModel class to be immutable

    [ https://issues.apache.org/jira/browse/SAMZA-899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16614074#comment-16614074 ] 

Cameron Lee commented on SAMZA-899:
-----------------------------------

+1 on this

Couple other pain points:
 # Some of the methods are named get* even if they aren't pure getters, so Jackson will try to serialize the results of those methods when serializing the job model. Those JSON fields are currently ignored in deserialization to prevent deserialization errors, but that means they are bloating the serialized value.
 # It might be nice to expose the JobModel to application code in case users find some use for it. However, the current implementation (mutability, dynamic calculations) should not be exposed as a public API.

> Re-design the JobModel class to be immutable
> --------------------------------------------
>
>                 Key: SAMZA-899
>                 URL: https://issues.apache.org/jira/browse/SAMZA-899
>             Project: Samza
>          Issue Type: Sub-task
>            Reporter: Jagadish
>            Priority: Major
>
> The current design of the JobModel class takes in a LocalityManager instance. The JobModel class also populates and mutates the container host mappings by reading from the LocalityManager. This state in the class is also mutated by the methods that make a call to populateContainerToHost mappings.
> The JobModel class should *not* know who its LocalityManager is. The JobModel class must merely take in a *final* container-host mapping as a part of its constructor. (as opposed to taking in a LocalityManager and mutating state)
> The JobModel class is currently shared from multiple threads, hence it's dangerous to expose public methods that mutate state without proper synchronization.
> This re-design will ensure that the JobModel will be immutable and merely expose getters. This is important as the JobModel evolves into a standard interface that all systems that integrate with Samza will have to provide. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)