0

I have set context-per-jvm = true and max-jobs-per-context = 4 in my config file.

I have pre-created context using following curl command: curl -d "" 'http://jobserver:8090/contexts/test-context'

I am using following curl command to submit a job: curl -d "" 'http://jobserver:8090/jobs?appName=test&classPath=com.xyz.Test&context=test-context'

After submitting 4 jobs using above command, submission of 5th job gives following response:

{
  "status": "NO SLOTS AVAILABLE",
  "result": "Too many running jobs (4) for job context 'test-context'"
}

Which is a decent and useful response.

However, when I am submitting the job from my Java program using Jersey API, job submission of 5th job fails with a generic 503 exception without any specific error message.

Here is the code snippet:

public static void main(String[] args) {
        WebTarget resource = client.target("http://jobserver:8090/jobs?appName=test&classPath=com.xyz.Test&context=test-context");
        Response response = resource.request().post(Entity.json(""), Response.class);
        System.out.println("Response:" + response);
    }

Output: Response:InboundJaxrsResponse{context=ClientResponse{method=POST, uri=http://jobserver:8090/jobs?appName=test&classPath=com.xyz.Test&context=test-context, status=503, reason=Service Unavailable}} What is the reason behing this inconsistancy? Am I missing something in my Jersey API call?

vatsal mevada
  • 5,148
  • 7
  • 39
  • 68

1 Answers1

0

I was able to get the specific JSON response using the following method:

response.readEntity(JSONObject.class) or response.readEntity(String.class)

vatsal mevada
  • 5,148
  • 7
  • 39
  • 68