Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1476

Transaction interface: Expose "clearAbortCause" for don't pick up handled persistence Exceptions

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.13.0
    • Fix Version/s: 1.13.1
    • Component/s: None
    • Labels:
      None

      Description

      That way we avoid casting from "Transaction" to "IsisTransaction", and can support use cases that properly handle the Exception without further consequences.

      For example, creating an idempotent action that first tries to create an object and, if an SQLIntegrityConstraintViolationException occurs, return the previously persisted entity, avoiding one SELECT on massive bulk actions.

       // {{ addMessage (action)
          @Action(semantics=SemanticsOf.IDEMPOTENT)
          public Message addMessageIdempotent(
      	    final String receiptHandle, final String notificationId,
      	    final Clob xmlContent, final String notificationType, 
      	    final DateTime publishTime, final String payloadVersion) {
      	Notification unprocessedNotification = null;
      
      	try {
      	    unprocessedMessage = this.wrap(this).createMessage(receiptHandle,
      		    notificationId, amazonMarketplace, xmlContent,
      		    notificationType, publishTime, payloadVersion, sellerId);
      	} catch (final JDODataStoreException e) {
      	    if (Iterables.filter(Throwables.getCausalChain(e),
      		    SQLIntegrityConstraintViolationException.class) != null) {
      
      		((IsisTransaction) this.transactionService.currentTransaction())
      			.clearAbortCause();
      
      		unprocessedMessage = this.wrap(this).findByReceiptHandle(
      			receiptHandle);
      	    } else {
      		throw e;
      	    }
      	}
      
      	return unprocessedMessage;
      
          }
      
          // }}
      

      If published in the "Transaction" interface, the casting can be avoided, being simply:

      		this.transactionService.currentTransaction()
      			.clearAbortCause();
      

        Activity

        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit b12d2ac0209fd67ac4d2c6aaaba6b205c8202ffd in isis's branch refs/heads/maint-1.13.1 from Oscar Bou
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=b12d2ac ]

        ISIS-1476: Transaction interface: Expose "clearAbortCause" for don't pick up handled persistence Exceptions

        Show
        jira-bot ASF subversion and git services added a comment - Commit b12d2ac0209fd67ac4d2c6aaaba6b205c8202ffd in isis's branch refs/heads/maint-1.13.1 from Oscar Bou [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=b12d2ac ] ISIS-1476 : Transaction interface: Expose "clearAbortCause" for don't pick up handled persistence Exceptions
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 87966d8f0a0efabe69e7fad414b380d514c3081f in isis's branch refs/heads/maint-1.13.1 from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=87966d8 ]

        ISIS-1476: updating docs

        Show
        jira-bot ASF subversion and git services added a comment - Commit 87966d8f0a0efabe69e7fad414b380d514c3081f in isis's branch refs/heads/maint-1.13.1 from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=87966d8 ] ISIS-1476 : updating docs
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 5bc2ec352e1fcb1745f71545913518bc964796cb in isis's branch refs/heads/master from Oscar Bou
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=5bc2ec3 ]

        ISIS-1476: Transaction interface: Expose "clearAbortCause" for don't pick up handled persistence Exceptions

        Show
        jira-bot ASF subversion and git services added a comment - Commit 5bc2ec352e1fcb1745f71545913518bc964796cb in isis's branch refs/heads/master from Oscar Bou [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=5bc2ec3 ] ISIS-1476 : Transaction interface: Expose "clearAbortCause" for don't pick up handled persistence Exceptions
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 882a2ede3a7a75c30260e1ecce63e58e9194b3ab in isis's branch refs/heads/master from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=882a2ed ]

        Merge branch 'ISIS-1476_pr' of https://github.com/oscarbou/isis into ISIS-1476_pr-49

        Show
        jira-bot ASF subversion and git services added a comment - Commit 882a2ede3a7a75c30260e1ecce63e58e9194b3ab in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=882a2ed ] Merge branch ' ISIS-1476 _pr' of https://github.com/oscarbou/isis into ISIS-1476 _pr-49
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 882a2ede3a7a75c30260e1ecce63e58e9194b3ab in isis's branch refs/heads/master from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=882a2ed ]

        Merge branch 'ISIS-1476_pr' of https://github.com/oscarbou/isis into ISIS-1476_pr-49

        Show
        jira-bot ASF subversion and git services added a comment - Commit 882a2ede3a7a75c30260e1ecce63e58e9194b3ab in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=882a2ed ] Merge branch ' ISIS-1476 _pr' of https://github.com/oscarbou/isis into ISIS-1476 _pr-49
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 201637501b8c2532a443b66d68544c5363069907 in isis's branch refs/heads/master from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=2016375 ]

        ISIS-1476: updating docs

        Show
        jira-bot ASF subversion and git services added a comment - Commit 201637501b8c2532a443b66d68544c5363069907 in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=2016375 ] ISIS-1476 : updating docs
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit b8e6eb54c39048a9db745669b68248c27252b36f in isis's branch refs/heads/master from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=b8e6eb5 ]

        Merge branch 'ISIS-1476_pr-49'

        Show
        jira-bot ASF subversion and git services added a comment - Commit b8e6eb54c39048a9db745669b68248c27252b36f in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=b8e6eb5 ] Merge branch ' ISIS-1476 _pr-49'

          People

          • Assignee:
            danhaywood Dan Haywood
            Reporter:
            oscarbou Oscar Bou
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development