You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Munirathnam Kumar (Created) (JIRA)" <ji...@apache.org> on 2011/12/09 14:46:39 UTC
[jira] [Created] (WINK-354) Inconsistent Unmarshalling of XML to
Object during Concurrent requests to a Resource
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
[jira] [Updated] (WINK-354) Inconsistent Unmarshalling of XML to
Object during Concurrent requests to a Resource
Posted by "Luciano Resende (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WINK-354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Luciano Resende updated WINK-354:
---------------------------------
Fix Version/s: (was: 1.1.3)
1.3
> 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.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