[jbossts-issues] [JBoss JIRA] (JBTM-2458) Think of the possibility to improve Compensations API with lambdas

Gytis Trikleris (JIRA) issues at jboss.org
Thu Dec 24 06:30:00 EST 2015


    [ https://issues.jboss.org/browse/JBTM-2458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144099#comment-13144099 ] 

Gytis Trikleris commented on JBTM-2458:
---------------------------------------

Example v3:
{code}
public interface Action {
    void execute();
}

public interface CompensatableAction {
    List<CompensationHandler> getCompensationHandlers();
    List<ConfirmationHandler> getConfirmationHandlers();
    List<TransactionLoggedHandler> getTransactionLoggedHandlers();
    Action getAction();
}

public final class CompensatableActionBuilder() {
    CompensatableActionBuilder addCompensationHandler(CompensationHandler compensationHandler);
    CompensatableActionBuilder addConfirmationHandler(ConfirmationHandler confirmationHandler);
    CompensatableActionBuilder addTransactionLoggedHandler(TransactionLoggedHandler transactionLoggedHandler);
    CompensatableActionBuilder addAction(Action action);
    CompensatableAction build();
}

tx.begin();
tx.enlist(compensatableAction);
tx.commit();
{code}

POC implementation of the example: https://github.com/gytis/narayana/commit/2ce55f2a40b1e8f1b0f7bc3c41e91e68968268af#diff-e586f23e50404fb131b51390e6645ceeR75

> Think of the possibility to improve Compensations API with lambdas
> ------------------------------------------------------------------
>
>                 Key: JBTM-2458
>                 URL: https://issues.jboss.org/browse/JBTM-2458
>             Project: JBoss Transaction Manager
>          Issue Type: Task
>          Components: TXFramework
>            Reporter: Gytis Trikleris
>            Assignee: Gytis Trikleris
>            Priority: Minor
>             Fix For: 5.next
>
>
> Emmanuel suggested to reduce verbosity in Compensations API by making it possible to use lambdas for handler implementation.
> We should try to think of the best API changes to introduce that.
> We could rewrite MongoDB quickstart to make it easier to visualise the difference.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jbossts-issues mailing list