You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tephra.apache.org by anew <gi...@git.apache.org> on 2016/09/22 01:11:31 UTC

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

GitHub user anew opened a pull request:

    https://github.com/apache/incubator-tephra/pull/14

    (TEPHRA-185) Add a way to pass a custom timeout to TransactionContext

    Adds a new start(int timeout) to TransactionContext.

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

    $ git pull https://github.com/anew/incubator-tephra tephra-185-txcontext-timeout

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

    https://github.com/apache/incubator-tephra/pull/14.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 #14
    
----
commit e8306166dd1ff87c8cbcf443e05f61df7e5b4986
Author: anew <an...@continuuity.com>
Date:   2016-09-22T01:10:14Z

    (TEPHRA-185) Add a way to pass a custom timeout to TransactionContext

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by poornachandra <gi...@git.apache.org>.
Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79965483
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -97,6 +127,7 @@ public void start() throws TransactionFailureException {
                                            txAware.getTransactionAwareName(), currentTx.getTransactionId());
             LOG.warn(message, e);
             txClient.abort(currentTx);
    +        currentTx = null;
    --- End diff --
    
    \U0001f44d 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by poornachandra <gi...@git.apache.org>.
Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79964694
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -88,7 +88,27 @@ public boolean removeTransactionAware(TransactionAware txAware) {
        *     TransactionAware
        */
       public void start() throws TransactionFailureException {
    -    currentTx = txClient.startShort();
    +    txClient.startShort();
    +    staretAllTxAwares();
    +  }
    +
    +  /**
    +   * Starts a new transaction.  Calling this will initiate a new transaction using the {@link TransactionSystemClient},
    +   * and pass the returned transaction to {@link TransactionAware#startTx(Transaction)} for each registered
    +   * TransactionAware.  If an exception is encountered, the transaction will be aborted and a
    +   * {@code TransactionFailureException} wrapping the root cause will be thrown.
    +   *
    +   * @param timeout the transaction timeout for the transaction
    +   *
    +   * @throws TransactionFailureException if an exception occurs starting the transaction with any registered
    +   *     TransactionAware
    +   */
    +  public void start(int timeout) throws TransactionFailureException {
    +    txClient.startShort(timeout);
    +    staretAllTxAwares();
    +  }
    +
    +  private void staretAllTxAwares() {
    --- End diff --
    
    Typo in `staret`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by anew <gi...@git.apache.org>.
Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79965244
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -88,7 +88,27 @@ public boolean removeTransactionAware(TransactionAware txAware) {
        *     TransactionAware
        */
       public void start() throws TransactionFailureException {
    -    currentTx = txClient.startShort();
    +    txClient.startShort();
    --- End diff --
    
    oh yes. fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by poornachandra <gi...@git.apache.org>.
Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79964736
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -88,7 +88,27 @@ public boolean removeTransactionAware(TransactionAware txAware) {
        *     TransactionAware
        */
       public void start() throws TransactionFailureException {
    -    currentTx = txClient.startShort();
    +    txClient.startShort();
    +    staretAllTxAwares();
    +  }
    +
    +  /**
    +   * Starts a new transaction.  Calling this will initiate a new transaction using the {@link TransactionSystemClient},
    +   * and pass the returned transaction to {@link TransactionAware#startTx(Transaction)} for each registered
    +   * TransactionAware.  If an exception is encountered, the transaction will be aborted and a
    +   * {@code TransactionFailureException} wrapping the root cause will be thrown.
    +   *
    +   * @param timeout the transaction timeout for the transaction
    +   *
    +   * @throws TransactionFailureException if an exception occurs starting the transaction with any registered
    +   *     TransactionAware
    +   */
    +  public void start(int timeout) throws TransactionFailureException {
    +    txClient.startShort(timeout);
    --- End diff --
    
    Same here about assignment


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by anew <gi...@git.apache.org>.
Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79965250
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -88,7 +88,27 @@ public boolean removeTransactionAware(TransactionAware txAware) {
        *     TransactionAware
        */
       public void start() throws TransactionFailureException {
    -    currentTx = txClient.startShort();
    +    txClient.startShort();
    +    staretAllTxAwares();
    +  }
    +
    +  /**
    +   * Starts a new transaction.  Calling this will initiate a new transaction using the {@link TransactionSystemClient},
    +   * and pass the returned transaction to {@link TransactionAware#startTx(Transaction)} for each registered
    +   * TransactionAware.  If an exception is encountered, the transaction will be aborted and a
    +   * {@code TransactionFailureException} wrapping the root cause will be thrown.
    +   *
    +   * @param timeout the transaction timeout for the transaction
    +   *
    +   * @throws TransactionFailureException if an exception occurs starting the transaction with any registered
    +   *     TransactionAware
    +   */
    +  public void start(int timeout) throws TransactionFailureException {
    +    txClient.startShort(timeout);
    --- End diff --
    
    ditto


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by poornachandra <gi...@git.apache.org>.
Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79964659
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -88,7 +88,27 @@ public boolean removeTransactionAware(TransactionAware txAware) {
        *     TransactionAware
        */
       public void start() throws TransactionFailureException {
    -    currentTx = txClient.startShort();
    +    txClient.startShort();
    --- End diff --
    
    `currentTx` still needs to be assigned the return value of `txClient.startShort()`, right?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by anew <gi...@git.apache.org>.
Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79965226
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -97,6 +127,7 @@ public void start() throws TransactionFailureException {
                                            txAware.getTransactionAwareName(), currentTx.getTransactionId());
             LOG.warn(message, e);
             txClient.abort(currentTx);
    +        currentTx = null;
    --- End diff --
    
    this is not strictly part of this new feature. Just fixing this along the way. Normally, after we abort the tx, we set currentTx = null. I thought it would be best to do that here, too 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra issue #14: (TEPHRA-185) Add a way to pass a custom timeout ...

Posted by anew <gi...@git.apache.org>.
Github user anew commented on the issue:

    https://github.com/apache/incubator-tephra/pull/14
  
    @poornachandra please take another look. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by anew <gi...@git.apache.org>.
Github user anew commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/14#discussion_r79965256
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/TransactionContext.java ---
    @@ -88,7 +88,27 @@ public boolean removeTransactionAware(TransactionAware txAware) {
        *     TransactionAware
        */
       public void start() throws TransactionFailureException {
    -    currentTx = txClient.startShort();
    +    txClient.startShort();
    +    staretAllTxAwares();
    +  }
    +
    +  /**
    +   * Starts a new transaction.  Calling this will initiate a new transaction using the {@link TransactionSystemClient},
    +   * and pass the returned transaction to {@link TransactionAware#startTx(Transaction)} for each registered
    +   * TransactionAware.  If an exception is encountered, the transaction will be aborted and a
    +   * {@code TransactionFailureException} wrapping the root cause will be thrown.
    +   *
    +   * @param timeout the transaction timeout for the transaction
    +   *
    +   * @throws TransactionFailureException if an exception occurs starting the transaction with any registered
    +   *     TransactionAware
    +   */
    +  public void start(int timeout) throws TransactionFailureException {
    +    txClient.startShort(timeout);
    +    staretAllTxAwares();
    +  }
    +
    +  private void staretAllTxAwares() {
    --- End diff --
    
    oops.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-tephra pull request #14: (TEPHRA-185) Add a way to pass a custom t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-tephra/pull/14


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---