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

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


The following commit(s) were added to refs/heads/master by this push:
     new c5113e3  [SCB-1948] cache invocation.producerArguments, avoid build 
one more time for validator
c5113e3 is described below

commit c5113e36e177890dbb6fdbc58191f5d49fcef8e4
Author: wujimin <wuji...@huawei.com>
AuthorDate: Thu May 28 09:59:40 2020 +0800

    [SCB-1948] cache invocation.producerArguments, avoid build one more time 
for validator
---
 .../main/java/org/apache/servicecomb/core/Invocation.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/servicecomb/core/Invocation.java 
b/core/src/main/java/org/apache/servicecomb/core/Invocation.java
index 55bdbf3..2e542a0 100644
--- a/core/src/main/java/org/apache/servicecomb/core/Invocation.java
+++ b/core/src/main/java/org/apache/servicecomb/core/Invocation.java
@@ -102,6 +102,8 @@ public class Invocation extends SwaggerInvocation {
 
   private Map<String, Object> invocationArguments = Collections.emptyMap();
 
+  private Object[] producerArguments;
+
   private Map<String, Object> swaggerArguments = Collections.emptyMap();
 
   public long getInvocationId() {
@@ -256,12 +258,20 @@ public class Invocation extends SwaggerInvocation {
   }
 
   public Object[] toProducerArguments() {
+    if (producerArguments != null) {
+      return producerArguments;
+    }
+
     Method method = 
operationMeta.getSwaggerProducerOperation().getProducerMethod();
     Object[] args = new Object[method.getParameterCount()];
     for (int i = 0; i < method.getParameterCount(); i++) {
       args[i] = 
this.invocationArguments.get(method.getParameters()[i].getName());
     }
-    return args;
+    return producerArguments = args;
+  }
+
+  public void clearProducerArguments() {
+    producerArguments = null;
   }
 
   public Endpoint getEndpoint() {

Reply via email to