[
https://issues.apache.org/jira/browse/GOBBLIN-1444?focusedWorklogId=604718&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-604718
]
ASF GitHub Bot logged work on GOBBLIN-1444:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 01/Jun/21 19:18
Start Date: 01/Jun/21 19:18
Worklog Time Spent: 10m
Work Description: aplex commented on a change in pull request #3281:
URL: https://github.com/apache/gobblin/pull/3281#discussion_r643416785
##########
File path:
gobblin-restli/gobblin-restli-utils/src/main/java/org/apache/gobblin/restli/EmbeddedRestliServer.java
##########
@@ -69,6 +70,7 @@
* * name - defaults to the name of the first resource in the resource
collection.
* * injector - an {@link Injector} to inject dependencies into the Rest.li
resources.
*/
+@Singleton
Review comment:
Normally, if the class is marked with Singleton annotation , Guice will
create only one instance of it. All other classes that depend on this one will
get the same instance.
However, in this case the class is created by our provider, and not by Guice
directly, so we need an extra step to make sure only one instance exists. I've
updated Guice module like this:
`
binder.bind(EmbeddedRestliServer.class).toProvider(EmbeddedRestliServerProvider.class).in(Singleton.class)`
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 604718)
Time Spent: 3h (was: 2h 50m)
> Use Guice as DI framework in Gobblin service
> --------------------------------------------
>
> Key: GOBBLIN-1444
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1444
> Project: Apache Gobblin
> Issue Type: Improvement
> Components: gobblin-service
> Reporter: Alex Prokofiev
> Assignee: Abhishek Tiwari
> Priority: Major
> Time Spent: 3h
> Remaining Estimate: 0h
>
> Currently, to initialize Gobblin service, we used a mixture of dependency
> injection, direct class creation and config-based class creation. In this
> change, we unify the service initialization by moving towards using
> dependency injection(DI) with Guice everywhere.
> Using DI will help with (1) unit testing; (2) overriding classes in the
> middle of the dependency with company-specific implementations, and (3) will
> improve code readability, as dependencies between classes become visible from
> the outside and explicit.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)