You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by sa...@apache.org on 2020/04/21 19:04:42 UTC

[pulsar] branch master updated: Make the FunctionRunTimeManager methods used by rest-api syncrhonized since the assignment tailer also is updating it (#6786)

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

sanjeevrk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new fb930b7  Make the FunctionRunTimeManager methods used by rest-api syncrhonized since the assignment tailer also is updating it (#6786)
fb930b7 is described below

commit fb930b79a5f396ef5753fb0c6208be9dea6c1709
Author: Sanjeev Kulkarni <sa...@gmail.com>
AuthorDate: Tue Apr 21 12:04:21 2020 -0700

    Make the FunctionRunTimeManager methods used by rest-api syncrhonized since the assignment tailer also is updating it (#6786)
    
    This fixes the flakiness in PulsarFunctionE2ESecurityTest
    
    Co-authored-by: Sanjeev Kulkarni <sa...@splunk.com>
---
 .../org/apache/pulsar/functions/worker/FunctionRuntimeManager.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java
index 9b681c8..c66be68 100644
--- a/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java
+++ b/pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java
@@ -323,7 +323,7 @@ public class FunctionRuntimeManager implements AutoCloseable{
         }
     }
 
-    public void restartFunctionInstance(String tenant, String namespace, String functionName, int instanceId,
+    public synchronized void restartFunctionInstance(String tenant, String namespace, String functionName, int instanceId,
             URI uri) throws Exception {
         if (runtimeFactory.externallyManaged()) {
             throw new WebApplicationException(Response.serverError().status(Status.NOT_IMPLEMENTED)
@@ -368,7 +368,7 @@ public class FunctionRuntimeManager implements AutoCloseable{
         }
     }
 
-    public void restartFunctionInstances(String tenant, String namespace, String functionName)
+    public synchronized void restartFunctionInstances(String tenant, String namespace, String functionName)
             throws Exception {
         final String fullFunctionName = String.format("%s/%s/%s", tenant, namespace, functionName);
         Collection<Assignment> assignments = this.findFunctionAssignments(tenant, namespace, functionName);