wink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Elman <el...@apache.org>
Subject Re: Inconsistent Unmarshalling during Concurrent requests
Date Thu, 08 Dec 2011 15:52:04 GMT
Tried to run your code. Everything looks fine:

thread - 29 : Serialization Passed
thread - 0 : Serialization Passed
thread - 20 : Serialization Passed
thread - 9 : Serialization Passed
thread - 7 : Serialization Passed
thread - 38 : Serialization Passed
thread - 5 : Serialization Passed
thread - 37 : Serialization Passed
thread - 36 : Serialization Passed
thread - 25 : Serialization Passed
thread - 1 : Serialization Passed
thread - 13 : Serialization Passed
thread - 47 : Serialization Passed
thread - 4 : Serialization Passed
thread - 43 : Serialization Passed
thread - 22 : Serialization Passed
thread - 28 : Serialization Passed
thread - 17 : Serialization Passed
thread - 21 : Serialization Passed
thread - 33 : Serialization Passed
thread - 32 : Serialization Passed
thread - 30 : Serialization Passed
thread - 40 : Serialization Passed
thread - 39 : Serialization Passed
thread - 24 : Serialization Passed
thread - 35 : Serialization Passed
thread - 16 : Serialization Passed
thread - 31 : Serialization Passed
thread - 18 : Serialization Passed
thread - 44 : Serialization Passed
thread - 42 : Serialization Passed
thread - 34 : Serialization Passed
thread - 2 : Serialization Passed
thread - 10 : Serialization Passed
thread - 27 : Serialization Passed
thread - 19 : Serialization Passed
thread - 3 : Serialization Passed
thread - 49 : Serialization Passed
thread - 26 : Serialization Passed
thread - 46 : Serialization Passed
thread - 41 : Serialization Passed
thread - 8 : Serialization Passed
thread - 14 : Serialization Passed
thread - 23 : Serialization Passed
thread - 11 : Serialization Passed
thread - 6 : Serialization Passed
thread - 45 : Serialization Passed
thread - 48 : Serialization Passed
thread - 12 : Serialization Passed
thread - 15 : Serialization Passed

On Thu, Dec 8, 2011 at 5:07 PM, Kumar, Munirathnam <munirathnam.kumar@hp.com
> wrote:

> I have created new Instance for each thread but still I have the same
> issue.****
>
> ** **
>
> 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();****
>
>          }****
>
> ** **
>
> ** **
>
> *From:* Michael Elman [mailto:elman@apache.org]
> *Sent:* Thursday, December 08, 2011 8:11 PM
> *To:* wink-user@incubator.apache.org
> *Subject:* Re: Inconsistent Unmarshalling during Concurrent requests****
>
> ** **
>
> If I understand your code correctly, you reuse Resource instance on
> multiple threads. ****
>
> But as I recall Resource is not threadsafe.****
>
> Just create a new instance each time, and it should be fine.****
>
> On Thu, Dec 8, 2011 at 4:05 PM, Kumar, Munirathnam <
> munirathnam.kumar@hp.com> wrote:****
>
> Hi****
>
> I am requesting  Concurrent requests to a Resource.****
>
> But on the Resource, bean objects are not completely populated for some
> request and gets populated completely for other requests.****
>
>  ****
>
> Please see the Client,Bean and Resource Class below.****
>
>  ****
>
> For few client request the *request.getSelectedOptions()* always returns
> null . ****
>
>  ****
>
> Is this a bug with Wink ?****
>
>  ****
>
> Can you please help****
>
>  ****
>
> -          kumar****
>
>  ****
>
> Client ****
>
>  ****
>
> 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 = "Serialization Failed";****
>
>     } else if(request.getSelectedOptions() != null ){        ****
>
>         res = "Serialization Passed";****
>
>     }    ****
>
>     return Response.ok(res).build();****
>
>     }****
>
>  ****
>
> }****
>
>  ****
>
> ** **
>

Mime
View raw message