Make the FunctionRunTimeManager methods used by rest-api syncrhonized since the assignment tailer also is updating it
This fixes the flakiness in PulsarFunctionE2ESecurityTest
@@ -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);
