Wink
  1. Wink
  2. WINK-354

Inconsistent Unmarshalling of XML to Object during Concurrent requests to a Resource

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.1.3
    • Fix Version/s: 1.5
    • Component/s: Server
    • Labels:
      None

      Description

      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();
      }

      }

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Munirathnam Kumar
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development