From wink-user-return-381-apmail-incubator-wink-user-archive=incubator.apache.org@incubator.apache.org Thu Dec 8 15:58:16 2011 Return-Path: X-Original-To: apmail-incubator-wink-user-archive@minotaur.apache.org Delivered-To: apmail-incubator-wink-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E1B5098EB for ; Thu, 8 Dec 2011 15:58:16 +0000 (UTC) Received: (qmail 62589 invoked by uid 500); 8 Dec 2011 15:58:16 -0000 Delivered-To: apmail-incubator-wink-user-archive@incubator.apache.org Received: (qmail 62560 invoked by uid 500); 8 Dec 2011 15:58:16 -0000 Mailing-List: contact wink-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: wink-user@incubator.apache.org Delivered-To: mailing list wink-user@incubator.apache.org Received: (qmail 62552 invoked by uid 99); 8 Dec 2011 15:58:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2011 15:58:16 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [15.192.0.44] (HELO g5t0007.atlanta.hp.com) (15.192.0.44) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2011 15:58:04 +0000 Received: from G9W0369G.americas.hpqcorp.net (g9w0369g.houston.hp.com [16.216.193.232]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by g5t0007.atlanta.hp.com (Postfix) with ESMTPS id A94571439D for ; Thu, 8 Dec 2011 15:57:42 +0000 (UTC) Received: from G6W0644.americas.hpqcorp.net (16.230.34.80) by G9W0369G.americas.hpqcorp.net (16.216.193.232) with Microsoft SMTP Server (TLS) id 14.1.289.1; Thu, 8 Dec 2011 15:56:35 +0000 Received: from GVW1101EXC.americas.hpqcorp.net ([16.230.34.85]) by G6W0644.americas.hpqcorp.net ([16.230.34.80]) with mapi; Thu, 8 Dec 2011 15:56:35 +0000 From: "Kumar, Munirathnam" To: "wink-user@incubator.apache.org" Date: Thu, 8 Dec 2011 15:56:30 +0000 Subject: RE: Inconsistent Unmarshalling during Concurrent requests Thread-Topic: Inconsistent Unmarshalling during Concurrent requests Thread-Index: Acy1wVrJupZPixW5QuWjTHTBq9AsDwAAFAwg Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_C9B66B9175564F41A2DD134F3F81AF4F538ED961FEGVW1101EXCame_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_C9B66B9175564F41A2DD134F3F81AF4F538ED961FEGVW1101EXCame_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Here is result again. There are failed results as well. Can you please re r= un couple of times. thread - 44 : Serialisation Passed thread - 48 : Serialisation Passed thread - 36 : Serialisation Passed thread - 46 : Serialisation Passed thread - 4 : Serialisation Passed thread - 30 : Serialisation Passed thread - 13 : Serialisation Passed thread - 23 : Serialisation Passed thread - 25 : Serialisation Failed thread - 45 : Serialisation Failed thread - 28 : Serialisation Passed thread - 10 : Serialisation Passed thread - 24 : Serialisation Failed thread - 35 : Serialisation Passed thread - 22 : Serialisation Failed thread - 34 : Serialisation Passed thread - 47 : Serialisation Passed thread - 7 : Serialisation Passed thread - 38 : Serialisation Failed thread - 43 : Serialisation Failed thread - 17 : Serialisation Passed thread - 41 : Serialisation Failed thread - 9 : Serialisation Failed thread - 18 : Serialisation Failed thread - 15 : Serialisation Passed thread - 12 : Serialisation Failed thread - 20 : Serialisation Passed thread - 42 : Serialisation Passed thread - 16 : Serialisation Passed thread - 31 : Serialisation Passed thread - 14 : Serialisation Failed thread - 27 : Serialisation Failed thread - 11 : Serialisation Passed thread - 26 : Serialisation Failed thread - 8 : Serialisation Failed thread - 19 : Serialisation Passed thread - 40 : Serialisation Passed thread - 0 : Serialisation Passed thread - 21 : Serialisation Passed thread - 3 : Serialisation Failed thread - 6 : Serialisation Passed thread - 2 : Serialisation Passed thread - 33 : Serialisation Failed thread - 49 : Serialisation Passed thread - 39 : Serialisation Failed thread - 37 : Serialisation Passed thread - 29 : Serialisation Passed thread - 1 : Serialisation Passed thread - 5 : Serialisation Passed thread - 32 : Serialisation Failed From: Michael Elman [mailto:elman@apache.org] Sent: Thursday, December 08, 2011 9:22 PM To: wink-user@incubator.apache.org Subject: Re: Inconsistent Unmarshalling during Concurrent requests 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 > wrote: I have created new Instance for each thread but still I have the same issue= . RestClient client =3D new RestClient(); for ( int i =3D0; i < 50 ; i ++ ){ resource =3D client.resource("http://localhost:8080/logger/tes= t"); new Thread(new Multi(resource),new Integer(i).toString()).star= t(); } 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 multipl= e 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 > wrote: Hi I am requesting Concurrent requests to a Resource. But on the Resource, bean objects are not completely populated for some req= uest 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 =3D "" + "Amount of Memory (MB)2000" + "Number of CPUs1" + "Number of Servers1" + "" + ""; Multi(Resource resource){ this.resource =3D resource; } public void run(){ String res =3D resource.contentType(MediaType.APPLICATION_XML)= .accept(MediaType.TEXT_PLAIN).post(String.class,xml); System.out.println("thread - " + Thread.currentThread().getNam= e() + " : " + res); } } Bean Class @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement(name =3D "UserSubscription") public class ServiceRequest { private Properties modelInputs; public void setSelectedOptions(Properties modelInputs) { this.modelInputs =3D modelInputs; } @XmlElementWrapper(name =3D "selectedOptions", required =3D= true, nillable =3D 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 =3D ""; if( request.getSelectedOptions() =3D=3D null){ res =3D "Serialization Failed"; } else if(request.getSelectedOptions() !=3D null ){ res =3D "Serialization Passed"; } return Response.ok(res).build(); } } --_000_C9B66B9175564F41A2DD134F3F81AF4F538ED961FEGVW1101EXCame_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Here is r= esult again. There are failed results as well. Can you please re run couple= of times.

 

thread - 44 : Serialisation Passe= d

thread - 48 : Serialisat= ion Passed

thread - 36 : S= erialisation Passed

thre= ad - 46 : Serialisation Passed

thread - 4 : Serialisation Passed

thread - 30 : Serialisation Passed

thread - 13 : Serialisation Passed<= /p>

thread - 23 : Serialisation Passed

thread - 25 : Serialisation Failed<= o:p>

thread - 45 : Serialisatio= n Failed

thread - 28 : Ser= ialisation Passed

thread -= 10 : Serialisation Passed

thread - 24 : Serialisation Failed

thread - 35 : Serialisation Passed

thread - 22 : Serialisation Failed

thread - 34 : Serialisation Passed<= /span>

thread - 47 : Serialisation Passed

thread - 7 : Serialisation P= assed

thread - 38 : Serial= isation Failed

thread - 43= : Serialisation Failed

th= read - 17 : Serialisation Passed

= thread - 41 : Serialisation Failed

thread - 9 : Serialisation Failed

thread - 18 : Serialisation Failed

thread - 15 : Serialisation Passed

thread - 12 : Serialisation Faile= d

thread - 20 : Serialisat= ion Passed

thread - 42 : S= erialisation Passed

thre= ad - 16 : Serialisation Passed

thread - 31 : Serialisation Passed

thread - 14 : Serialisation Failed

thread - 27 : Serialisation Failed=

thread - 11 : Serialisation Passed

thread - 26 : Serialisation Failed=

thread - 8 : Serialisatio= n Failed

thread - 19 : Ser= ialisation Passed

thread -= 40 : Serialisation Passed

thread - 0 : Serialisation Passed

thread - 21 : Serialisation Passed

thread - 3 : Serialisation Failed

=

thread - 6 : Serialisation Passed

thread - 2 : Serialisation Passed<= /o:p>

thread - 33 : Serialisation Fai= led

thread - 49 : Serialis= ation Passed

thread - 39 := Serialisation Failed

thre= ad - 37 : Serialisation Passed

thread - 29 : Serialisation Passed

thread - 1 : Serialisation Passed

thread - 5 : Serialisation Passed

thread - 32 : Serialisation Failed=

 

From: Michael Elman [mailto:elman@apache.org]
Se= nt: Thursday, December 08, 2011 9:22 PM
To: wink-user@incubat= or.apache.org
Subject: Re: Inconsistent Unmarshalling during Conc= urrent requests

 =

Tried to run your code. Everything look= s fine:

 

=

thread - 29 : Serialization Passed

thread - 0 : Serialization Passed=

thread - 20 : Serialization Passe= d

thread - 9 : Serialization = Passed

thread - 7 : Serializa= tion Passed

thread - 38 : Ser= ialization 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<= /p>

thread - 43 : Serialization Passed<= /o:p>

thread - 22 : Serialization Passed=

thread - 28 : Serialization = Passed

thread - 17 : Serializ= ation Passed

thread - 21 : Se= rialization Passed

thread - 3= 3 : Serialization Passed

thre= ad - 32 : Serialization Passed

thread - 30 : Serialization Passed

thread - 40 : Serialization Passed

thread - 39 : Serialization Passed

<= p class=3DMsoNormal>thread - 24 : Serialization Passed

=

thread - 35 : Serialization Passed

=

thread - 16 : Serialization Passed

thread - 31 : Serialization Passed

thread - 18 : Serialization Pas= sed

thread - 44 : Serializati= on Passed

thread - 42 : Seria= lization Passed

thread - 34 := Serialization Passed

thread = - 2 : Serialization Passed

th= read - 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 Pas= sed

thread - 14 : Serializati= on Passed

thread - 23 : Seria= lization Passed

thread - 11 := Serialization Passed

thread = - 6 : Serialization Passed

th= read - 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 hav= e the same issue.

 

RestClient client =3D new RestClient();

 

for ( int i = =3D0; i < 50 ; i ++ ){

  =            resource =3D c= lient.resource("http://localhost:8080/logger/test");=

         &nb= sp;   new Thread(new Multi(resource),new Integer(i).toString()).s= tart();

     &n= bsp;   }

 

 

From: Michae= l Elman [mailto:elman= @apache.org]
Sent: Thursday, December 08, 2011 8:11 PM
To:
wink-user@incubator.apache.org
Subject: Re: Inconsistent Un= marshalling during Concurrent requests

 

If I understand your code correctl= y, 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:

H= i

I am requesting  Concurrent requests to a Resou= rce.

But on the Resource, bean objects are not complet= ely populated for some request and gets populated completely for other requ= ests.

 

Please see the Clie= nt,Bean and Resource Class below.

 

For few client request the request.getSelectedOptions() alw= ays returns null .

 

Is thi= s a bug with Wink ?

 

Can yo= u please help

 

-          kumar

 

Client

 

class Multi implements Runnable{&n= bsp;  

    Resource res= ource;

    String xml =3D "<Use= rSubscription>"

     =        +       = "<selectedOptions><entry><key >Amount of Memory (MB)= </key><value >2000</value></entry>" +

          &n= bsp;            = ;             &= nbsp;      "<entry><key>Number of= CPUs</key><value>1</value></entry>" +

          &= nbsp;           &nbs= p;             =        "<entry><key>Number o= f Servers</key><value>1</value></entry>"<= /o:p>

          = ;  +      "</selectedOptions>"= ;

        &nbs= p;   +   "</UserSubscription>";

   

   &= nbsp;Multi(Resource resource){

    = ;    this.resource =3D resource;

 =       

  &nbs= p; }

    public void run(){

          =    String res =3D resource.contentType(MediaType.APPLICATION_XML)= .accept(MediaType.TEXT_PLAIN).post(String.class,xml);   &nbs= p;    

    &n= bsp;        System.out.println(&quo= t;thread - " + Thread.currentThread().getName() + " : " +&nb= sp; res);      

 &= nbsp;  }

}

 <= /o:p>

Bean Class

 

@XmlAccessorType(XmlAccessType.NONE)

@XmlRootElement(= name =3D "UserSubscription")

public class Se= rviceRequest {

      &nb= sp;         private Properties mode= lInputs;

 

 =

          &nbs= p;     public  void setSelectedOptions(Properties = modelInputs) {

      &nb= sp;            =              th= is.modelInputs =3D modelInputs;

   &nbs= p;            }=

 

     =            @XmlElementWra= pper(name =3D "selectedOptions", required =3D true, nillable =3D = false)

        = ;        public  Properties getSele= ctedOptions() {

      &n= bsp;            = ;             r= eturn this.modelInputs;

     =            }

}

 

 

Resource Class

 

@Path("/test")

public class PropResource {=

   

@POST

@Consumes(MediaType.APPLICATION_XML)

@= Produces(MediaType.TEXT_PLAIN)

    publ= ic Response getLogs(ServiceRequest request){

 

    String res =3D "";

    if( request.getSelectedOptions() =3D= =3D null){           = ;   

     &nb= sp;  res =3D "Serialization Failed";

    } else if(request.getSelectedOptions() !=3D null ){&n= bsp;      

  =       res =3D "Serialization Passed"= ;;

    }    <= /p>

    return Response.ok(res).build();

    }

 

}

 

 

 

= --_000_C9B66B9175564F41A2DD134F3F81AF4F538ED961FEGVW1101EXCame_--