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

Colin Ma edited comment on SENTRY-1512 at 10/31/16 2:52 AM:
------------------------------------------------------------

[~akolb], thanks for bring this up. I agree to update patch for 
delegate.getRoleNamesForGroups(groups) to avoid the nest transaction. But for 
the assert, with the following code, pmf.getPersistenceManager() always return 
the new PersistenceManager, so, currentTransaction() always return the new 
transaction and it should be always un-active when created with the current 
implementation.
{code}
public Object executeTransaction(TransactionBlock tb) throws Exception {
    try (CloseablePersistenceManager cpm =
             new CloseablePersistenceManager(pmf.getPersistenceManager())) {
      Transaction transaction = cpm.pm.currentTransaction();
      ..............
{code}


was (Author: colinma):
[~akolb], thanks for bring this up. I agree to update patch for 
delegate.getRoleNamesForGroups(groups) to avoid the nest transaction. But for 
the assert, with the following code, pmf.getPersistenceManager() always return 
the new PersistenceManager, so, currentTransaction() always return the new 
transaction and it should be always un-active with the current implementation.
{code}
public Object executeTransaction(TransactionBlock tb) throws Exception {
    try (CloseablePersistenceManager cpm =
             new CloseablePersistenceManager(pmf.getPersistenceManager())) {
      Transaction transaction = cpm.pm.currentTransaction();
      ..............
{code}

> Refactor the database transaction management
> --------------------------------------------
>
>                 Key: SENTRY-1512
>                 URL: https://issues.apache.org/jira/browse/SENTRY-1512
>             Project: Sentry
>          Issue Type: Improvement
>            Reporter: Colin Ma
>            Assignee: Colin Ma
>         Attachments: SENTRY-1512.001.patch
>
>
> The update for SENTRY-1422 refactor the database transaction management, this 
> also should be ported to master.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to