Sanil15 commented on a change in pull request #1227: SAMZA-2404: [SEP-22]
Container Placement Handler for dispatching container placement messages
between metastore and JobCoordinator
URL: https://github.com/apache/samza/pull/1227#discussion_r366552846
##########
File path:
samza-core/src/main/java/org/apache/samza/clustermanager/ClusterBasedJobCoordinator.java
##########
@@ -150,6 +152,13 @@
*/
private final Optional<StreamRegexMonitor> inputStreamRegexMonitor;
+ /**
+ * Container placement action dispatcher and util
+ */
+ private final ContainerPlacementUtil containerPlacementUtil;
Review comment:
**Either rename this to ContainerPlacementMetastoreReader or make all its
methods static so that it is really a Util.
A Util should not be instantiated like this and have a complete lifecycle,**
Sure, let me rename it to ContainerPlacementMetadataStore
**"With this change there two lifecycle objects and a thread hanging in this
class, can the two be merged into a single clean object that encapsulates the
other and the thread?"**
The first implementation was just once class ContainerPlacementHandler that
encapsulated lifecycle of reader/writer and handler, but after discussing with
@prateekm suggested I decided ContainerPlacementHandler into two things one
that is just a Handler & another Metastore reader/writer with its own lifecycle
because of following benefits
1. External controllers do not instantiate the whole
ContainerPlacementHandler, they just instantiate Metastore reader/writer for
issuing actions
2. We can treat ContainePlacementHandler (CPH) & ContainerPlacementSerivce
as MVC, and controller job is just dispatching the request, the logic of
read/write should not belong to the controller (CPH) here otherwise you would
have to pass CPH to CPS for writing responses back
3. Metastore reader can be independently tested and decouples from
ContainerPlacementHandler
4. Removing cyclic dependency between ContainerPlacementHandler &
ContainerPlacementService
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services