Inconsistent Unmarshalling of XML to Object during Concurrent requests to a
Resource
------------------------------------------------------------------------------------
Key: WINK-354
URL: https://issues.apache.org/jira/browse/WINK-354
Project: Wink
Issue Type: Bug
Components: Server
Affects Versions: 1.1.3
Reporter: Munirathnam Kumar
Priority: Critical
Fix For: 1.1.3
Concurrent request are Issued on a Resource.
Client sends an XML to the resource.
Few request Unmarshall the XML partially, While others succeed in forming
complete bean object.
I have posted my test results on Wink-user.
Sample code to prove the issue are given below
Client
RestClient client = new RestClient();
for ( int i =0; i < 50 ; i ++ ){
resource = client.resource("http://localhost:8080/logger/test");
new Thread(new Multi(resource),new Integer(i).toString()).start();
}
class Multi implements Runnable{
Resource resource;
String xml = "<UserSubscription>"
+ "<selectedOptions><entry><key >Amount of Memory
(MB)</key><value >2000</value></entry>" +
"<entry><key>Number of
CPUs</key><value>1</value></entry>" +
"<entry><key>Number of
Servers</key><value>1</value></entry>"
+ "</selectedOptions>"
+ "</UserSubscription>";
Multi(Resource resource){
this.resource = resource;
}
public void run(){
String res =
resource.contentType(MediaType.APPLICATION_XML).accept(MediaType.TEXT_PLAIN).post(String.class,xml);
System.out.println("thread - " + Thread.currentThread().getName()
+ " : " + res);
}
}
Bean Class
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "UserSubscription")
public class ServiceRequest {
private Properties modelInputs;
public void setSelectedOptions(Properties modelInputs) {
this.modelInputs = modelInputs;
}
@XmlElementWrapper(name = "selectedOptions", required = true,
nillable = false)
public Properties getSelectedOptions() {
return this.modelInputs;
}
}
Resource Class
@Path("/test")
public class PropResource {
@POST
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.TEXT_PLAIN)
public Response getLogs(ServiceRequest request){
String res = "";
if( request.getSelectedOptions() == null){
res = "Unmarshall Failed";
} else if(request.getSelectedOptions() != null ){
res = "Unmarshall Passed";
}
return Response.ok(res).build();
}
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira