[
https://issues.apache.org/jira/browse/SCB-856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16602509#comment-16602509
]
ASF GitHub Bot commented on SCB-856:
------------------------------------
WillemJiang closed pull request #288: * SCB-856 Fixed the way to remove
specific OmegaCallback.
URL: https://github.com/apache/incubator-servicecomb-saga/pull/288
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java
b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java
index 62c183a5..dd98b1a8 100644
---
a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java
+++
b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java
@@ -29,7 +29,7 @@ public void invoke(ParticipatedEvent event, TransactionStatus
status) {
try {
omegaCallback.invoke(event, status);
} catch (Exception ex) {
- OmegaCallbacksRegistry.removeByValue(event.getServiceName(),
omegaCallback);
+ OmegaCallbacksRegistry.remove(event.getServiceName(),
event.getInstanceId());
throw ex;
}
}
diff --git
a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/registry/OmegaCallbacksRegistry.java
b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/registry/OmegaCallbacksRegistry.java
index 02340b2d..feb9026d 100644
---
a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/registry/OmegaCallbacksRegistry.java
+++
b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/registry/OmegaCallbacksRegistry.java
@@ -77,9 +77,14 @@ public static OmegaCallback retrieve(String serviceName,
String instanceId) thro
return result;
}
- public static void removeByValue(String serviceName, OmegaCallback
omegaCallback) {
- Map<String, OmegaCallback> callbackMap =
REGISTRY.getOrDefault(serviceName, emptyMap());
- callbackMap.values().remove(omegaCallback);
+ /**
+ * Remove omega TCC callback by service name and instance id.
+ *
+ * @param serviceName service name
+ * @param instanceId instance id
+ */
+ public static void remove(String serviceName, String instanceId) {
+ REGISTRY.getOrDefault(serviceName, emptyMap()).remove(instanceId);
}
/**
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Implement reaction of the event in Alpha Server
> ------------------------------------------------
>
> Key: SCB-856
> URL: https://issues.apache.org/jira/browse/SCB-856
> Project: Apache ServiceComb
> Issue Type: Sub-task
> Components: Saga
> Reporter: Willem Jiang
> Assignee: cherrylzhao
> Priority: Major
> Fix For: saga-0.3.0
>
>
> Alpha Server create a tracker when the TransactionStartEvent is received,
> and record the register of other participate once the participate event is
> received.
> When AlphaServer received the TransactionEndEvent, it sends the
> CoordinateCommand to the participant client with cancel or confirmation
> message type.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)