You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/07/22 11:20:22 UTC

[servicecomb-pack] 02/05: SCB-1385 Changed the TransactionContxt class to be immutable

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git

commit 898a61625741904498bc267dd197b8475009e034
Author: Willem Jiang <wi...@gmail.com>
AuthorDate: Sat Jul 20 22:46:04 2019 +0800

    SCB-1385 Changed the TransactionContxt class to be immutable
---
 .../servicecomb/pack/omega/context/TransactionContext.java   | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/omega/omega-context/src/main/java/org/apache/servicecomb/pack/omega/context/TransactionContext.java b/omega/omega-context/src/main/java/org/apache/servicecomb/pack/omega/context/TransactionContext.java
index 48bd370..651cf16 100644
--- a/omega/omega-context/src/main/java/org/apache/servicecomb/pack/omega/context/TransactionContext.java
+++ b/omega/omega-context/src/main/java/org/apache/servicecomb/pack/omega/context/TransactionContext.java
@@ -18,10 +18,11 @@ package org.apache.servicecomb.pack.omega.context;
 
 /**
  *  This class is holding the Transaction related context which could be use in customer code
+ *  , and it is immutable.
  */
 public class TransactionContext {
-  private String globalTxId;
-  private String localTxId;
+  private final String globalTxId;
+  private final String localTxId;
 
   public TransactionContext(String globalTxId, String localTxId) {
     this.globalTxId = globalTxId;
@@ -32,15 +33,8 @@ public class TransactionContext {
     return globalTxId;
   }
 
-  public void setGlobalTxId(String globalTxId) {
-    this.globalTxId = globalTxId;
-  }
-
   public String localTxId() {
     return localTxId;
   }
 
-  public void setLocalTxId(String localTxId) {
-    this.localTxId = localTxId;
-  }
 }