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

ASF GitHub Bot commented on FINERACT-428:
-----------------------------------------

GitHub user wkk91193 opened a pull request:

    https://github.com/apache/fineract/pull/468

    Implementing parallelizing and paging of Add accrual accounting

    [FINERACT-428](https://issues.apache.org/jira/browse/FINERACT-428)
    
    Parallelizing and paging of add accrual accounting

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/wkk91193/incubator-fineract 
parallelizing-accurual

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/fineract/pull/468.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #468
    
----
commit ebd557769b9fc0f79d28bce59e08d1df59266606
Author: unknown <wkk91193@...>
Date:   2018-08-04T15:04:53Z

    Implementing parallelizing and paging of Add accrual accounting

----


> Parallelization of Jobs
> -----------------------
>
>                 Key: FINERACT-428
>                 URL: https://issues.apache.org/jira/browse/FINERACT-428
>             Project: Apache Fineract
>          Issue Type: Improvement
>          Components: Loan, Savings
>    Affects Versions: 1.1.0
>            Reporter: Avik Ganguly
>            Assignee: Markus Geiss
>            Priority: Major
>              Labels: gsoc, p2, performance
>             Fix For: 1.2.0
>
>
> For starters, it will be useful to have some technical configuration added as 
> job parameter for each of the below jobs, that is batch size and thread pool 
> size for executor service so this has a dependency on FINERACT-425. 
> Add migration script to add those 2 configurations to each of the following 
> jobs with the value of batch size being 500 and thread pool size being 16 :-
> Add Accrual Transactions
> Add Periodic Accrual Transactions
> Add Accrual Transactions For Loans With Income Posted As Transactions
> Generate Loan Loss Provisioning
> Post Interest for Savings
> Update Loan Summary
> This would require separation of core functionality to a separate class.
> Simplified example :-
> ```
> final ExecutorService executor = Executors.newFixedThreadPool(threadPoolSize);
>         
>         final LocalDate dueDate = DateUtils.getLocalDateOfTenant();
>         final Collection<LoanAccountData> loansToBeRepaidData = 
> this.loanReadPlatformService
>                 .retrieveLoansToBeRepaidFromAdvancePayment(dueDate);
>         Iterable<List<LoanAccountData>> loansToBeRepaid = 
> Iterables.partition(loansToBeRepaidData, batchSize);
>         final Authentication authentication = 
> SecurityContextHolder.getContext().getAuthentication();
>         List<Callable<Object>> advancePaymentPosters = new 
> ArrayList<Callable<Object>>();
>         
>         for (List<LoanAccountData> subList : loansToBeRepaid) {
>               AdvancePaymentPoster poster = (AdvancePaymentPoster) 
> this.applicationContext.getBean("advancePaymentPoster");
>               poster.setLoans(subList);
>               poster.setTenant(ThreadLocalContextUtil.getTenant());
>               poster.setAuthentication(authentication);
>               poster.setCommandService(commandService);
>               advancePaymentPosters.add(Executors.callable(poster));
>         }
>         try {
>                       List<Future<Object>> responses = 
> executor.invokeAll(advancePaymentPosters);
> for(Future f : responses) {
>                       f.get();
>                     }
>               } catch (InterruptedException e1) {
>                       e1.printStackTrace();
>               }
>         
>         executor.shutdown(); 
>  ```



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

Reply via email to