[ 
https://issues.apache.org/jira/browse/GOBBLIN-1444?focusedWorklogId=603163&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-603163
 ]

ASF GitHub Bot logged work on GOBBLIN-1444:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/May/21 16:54
            Start Date: 27/May/21 16:54
    Worklog Time Spent: 10m 
      Work Description: aplex commented on pull request #3281:
URL: https://github.com/apache/gobblin/pull/3281#issuecomment-849789161


   Note for reviewers: this PR contains only refactoring, so there should not 
be any functionality changes. Many files contain only attribute changes, like 
specifying injection constructor.
   
   A couple of big chunks of logic was moved out of GobblinServiceManager: 
   1. Configuration reading and parsing is now in GobblinServiceConfiguration
   2. Logic to glue classes together moved to GobblinServiceGuiceModule
   
   We use several features of Guice that were not widely used in code base 
before:
   
   1. Marking the class as "@Singleton" - this will make sure that DI framework 
creates only one instance of it. By default, Guice will create a new instance 
of the class for each http request that Gobblin service gets.
   2. Marking constructors as @Inject to specify the one that should be used 
for dependency injection 
   3. Using unique interfaces instead of having named instances (more context 
in the comments where that happens)
   4. Using providers - those are like factories that generate an instance of 
the class for Guice
   5. Using standard javax.Inject annotations instead of using Guice-specific 
ones. They both work in the same way, but using standard once opens us to use 
other DI frameworks if needed in the future.
   
   More info is available in Guice docs: 
https://github.com/google/guice/wiki/MentalModel 


-- 
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: 603163)
    Time Spent: 2h  (was: 1h 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: 2h
>  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)

Reply via email to