<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 19:53:29 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[CONTROLLER-624] Usability enhancement to WriteTransaction commit method</title>
                <link>https://jira.opendaylight.org/browse/CONTROLLER-624</link>
                <project id="10113" key="CONTROLLER">controller</project>
                    <description>&lt;p&gt;The current WrteTransaction commit method returns RpcResult&amp;lt;TransactionStatus&amp;gt;:&lt;/p&gt;

&lt;p&gt;   ListenableFuture&amp;lt;RpcResult&amp;lt;TransactionStatus&amp;gt;&amp;gt; commit();&lt;/p&gt;

&lt;p&gt;Typical client usage is to use a Futures.addCallback:&lt;/p&gt;

&lt;p&gt;       Futures.addCallback( commitFuture,&lt;br/&gt;
           new FutureCallback&amp;lt;RpcResult&amp;lt;TransactionStatus&amp;gt;&amp;gt;() {&lt;br/&gt;
              @Override&lt;br/&gt;
              public void onSuccess( RpcResult&amp;lt;TransactionStatus&amp;gt; result ) {&lt;br/&gt;
                  if( result.getResult() == TransactionStatus.COMMITED  ) &lt;/p&gt;
{
                      // succeeded
                  }
&lt;p&gt; else &lt;/p&gt;
{
                      // failed
                  }
&lt;p&gt;              }&lt;/p&gt;

&lt;p&gt;              @Override&lt;br/&gt;
              public void onFailure( Throwable ex ) &lt;/p&gt;
{
                  // failed
              }
&lt;p&gt;        } );&lt;/p&gt;

&lt;p&gt;Notice that the client has to handle failure conditions in 2 places and in 2 different ways (by checking TransactionStatus and in onFailure).&lt;/p&gt;

&lt;p&gt;Also the onSuccess method may be a bit misleading as it might not have been successful depending on the TransactionStatus. &lt;/p&gt;

&lt;p&gt;Also at this point the TransactionStatus could only be COMMITED or FAILURE which is really redundant with RpcResult#isSuccessful. &lt;/p&gt;

&lt;p&gt;I propose changing the commit method to:&lt;/p&gt;

&lt;p&gt;  CheckedFuture&amp;lt;Void,TransactionCommitFailedException&amp;gt; ready();&lt;/p&gt;

&lt;p&gt;This method removes the RpcResult entirely and all errors conditions are conveyed via one path, via TransactionCommitFailedException. Nothing need be returned for a successful commit.&lt;/p&gt;

&lt;p&gt;The RpcResult allows for rich error info to be conveyed via RpcError. We can add RpcErrors to TransactionCommitFailedException for clients that are interested (eg restconf).&lt;/p&gt;

&lt;p&gt;The CheckedFuture explicitly conveys that clients can expect only TransactionCommitFailedExceptions.&lt;/p&gt;

&lt;p&gt;Client code then becomes:&lt;/p&gt;

&lt;p&gt;    Futures.addCallback( commitFuture, new FutureCallback&amp;lt;Void&amp;gt;() {&lt;br/&gt;
        @Override&lt;br/&gt;
        public void onSuccess( Void result ) &lt;/p&gt;
{
            // Success
        }

&lt;p&gt;        @Override&lt;br/&gt;
        public void onFailure( Throwable ex ) &lt;/p&gt;
{
            // Failed - e is instance of TransactionCommitFailedException
        }
&lt;p&gt;    } );&lt;/p&gt;

&lt;p&gt;which is cleaner.&lt;/p&gt;</description>
                <environment>&lt;p&gt;Operating System: All&lt;br/&gt;
Platform: All&lt;/p&gt;</environment>
        <key id="25178">CONTROLLER-624</key>
            <summary>Usability enhancement to WriteTransaction commit method</summary>
                <type id="10100" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10310&amp;avatarType=issuetype">Improvement</type>
                                                <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="tpantelis">Tom Pantelis</assignee>
                                    <reporter username="tpantelis">Tom Pantelis</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Jul 2014 17:33:49 +0000</created>
                <updated>Tue, 22 Jul 2014 04:07:45 +0000</updated>
                            <resolved>Tue, 22 Jul 2014 04:07:45 +0000</resolved>
                                    <version>Helium</version>
                                                    <component>mdsal</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="48702" author="tpantelis" created="Wed, 16 Jul 2014 18:30:26 +0000"  >&lt;p&gt;Submitted &lt;a href=&quot;https://git.opendaylight.org/gerrit/#/c/8964/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://git.opendaylight.org/gerrit/#/c/8964/&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10208" key="com.atlassian.jira.plugin.system.customfieldtypes:textfield">
                        <customfieldname>External issue ID</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1362</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10201" key="com.atlassian.jira.plugin.system.customfieldtypes:url">
                        <customfieldname>External issue URL</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[https://bugs.opendaylight.org/show_bug.cgi?id=1362]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10204" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>ODL SR Target Milestone</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10370"><![CDATA[Helium]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i02ljr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>