You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Meeusen, Christopher W." <Me...@mayo.edu> on 2010/08/19 00:20:23 UTC
Field level variables
I'm looking through some of my colleagues code and I'm noticing some
field level variables declared inside one of our pojos. Something
similar to this:
Public class classA
{
private classB aClassb;
Public classC[] aMethod()
{
aClassb= new classB();
}
}
aMethod() is exposed as a web service and is called several thousand
times per minute. Is this thread safe? I know it is bad to have field
level variables unless they are really needed but I don't know if this
behavior is ok inside of the axis2 environment.
Thanks,
Chris
AW: Field level variables
Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
We use scope="soapsession" to get one instance per user-session-thread; that allows for long-lasting.-user-sessions and/or state-full service objects. We use it since years, and we use it with axis2-1.2; we did not test it with axis2-1.5.1; doing so, beware to adjust in /.conf/axis2.xml ConfigContextTimeoutInterval from 30000 ms (default) to what you think is an appropriate timeout. Because if the timeout triggers, destroy() is called on your service object.
<!--This will give out the timeout of the configuration contexts, in milliseconds-->
<parameter name="ConfigContextTimeoutInterval">28800000</parameter>
We use it as shown above because we start sometimes user sessions which are not terminating within hours due to heavy calculations. Also you need to add 2 methods of 3 to your service class; init() and destroy(), as shown in relevant documentation.
Josef
-----Ursprüngliche Nachricht-----
Von: Meeusen, Christopher W. [mailto:Meeusen.Christopher@mayo.edu]
Gesendet: Freitag, 20. August 2010 18:21
An: java-user@axis.apache.org; jgreif@alumni.princeton.edu
Cc: axis-user@ws.apache.org
Betreff: RE: Field level variables
I think I found the answer to my question. Thank you for pointing me in the correct direction. According to the article here: http://wso2.org/library/articles/axis2-session-management-part-2, if no scope is explicitly declared for a service then, it defaults to session scope, which means that an instance of the service implementation will be instantiated for each request. 10 requests to MyService.class means 10 instances of MyService.class.
Thanks!
Chris
-----Original Message-----
From: java-user-return-83370-Meeusen.Christopher=mayo.edu@axis.apache.org [mailto:java-user-return-83370-Meeusen.Christopher=mayo.edu@axis.apache.org] On Behalf Of Meeusen, Christopher W.
Sent: Friday, August 20, 2010 11:06 AM
To: jgreif@alumni.princeton.edu
Cc: java-user@axis.apache.org; axis-user@ws.apache.org
Subject: RE: Field level variables
Thank you for the response! I just want to make sure I understand. You're saying this is configurable in the services.xml file? If this is so what is the default scope if nothing is specified?
Thanks,
Chris
-----Original Message-----
From: Jeff Greif [mailto:jeff.greif@gmail.com]
Sent: Friday, August 20, 2010 11:03 AM
To: Meeusen, Christopher W.
Cc: java-user@axis.apache.org; axis-user@ws.apache.org
Subject: Re: Field level variables
This is configurable in the deployment descriptor. The <service> element has an attribute "scope". One allowed value of this attribute creates an instance of the implementing class for each invocation.
Jeff
On 8/20/2010 7:18 AM, Meeusen, Christopher W. wrote:
> Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
>
> -----Original Message-----
> From: Meeusen, Christopher W.
> Sent: Wednesday, August 18, 2010 5:45 PM
> To: java-user@axis.apache.org
> Cc: axis-user@ws.apache.org
> Subject: Re: Field level variables
>
> My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
>
> On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
>
>> I’m looking through some of my colleagues code and I’m noticing some
>> field level variables declared inside one of our pojos. Someth ing
>> similar to this:
>>
>>
>>
>> Public class classA
>>
>> {
>>
>> private classB aClassb;
>>
>>
>>
>> Public classC[] aMethod()
>>
>> {
>>
>> aClassb= new classB();
>>
>> }
>>
>> }
>>
>>
>>
>> aMethod() is exposed as a web service and is called several thousand
>> times per minute. Is this thread safe? I know it is bad to have
>> field level variables unless they are really needed but I don’t know
>> if this behavior is ok inside of the axis2 environment.
>>
>>
>>
>> Thanks,
>>
>> Chris
RE: Field level variables
Posted by "Meeusen, Christopher W." <Me...@mayo.edu>.
I think I found the answer to my question. Thank you for pointing me in the correct direction. According to the article here: http://wso2.org/library/articles/axis2-session-management-part-2, if no scope is explicitly declared for a service then, it defaults to session scope, which means that an instance of the service implementation will be instantiated for each request. 10 requests to MyService.class means 10 instances of MyService.class.
Thanks!
Chris
-----Original Message-----
From: java-user-return-83370-Meeusen.Christopher=mayo.edu@axis.apache.org [mailto:java-user-return-83370-Meeusen.Christopher=mayo.edu@axis.apache.org] On Behalf Of Meeusen, Christopher W.
Sent: Friday, August 20, 2010 11:06 AM
To: jgreif@alumni.princeton.edu
Cc: java-user@axis.apache.org; axis-user@ws.apache.org
Subject: RE: Field level variables
Thank you for the response! I just want to make sure I understand. You're saying this is configurable in the services.xml file? If this is so what is the default scope if nothing is specified?
Thanks,
Chris
-----Original Message-----
From: Jeff Greif [mailto:jeff.greif@gmail.com]
Sent: Friday, August 20, 2010 11:03 AM
To: Meeusen, Christopher W.
Cc: java-user@axis.apache.org; axis-user@ws.apache.org
Subject: Re: Field level variables
This is configurable in the deployment descriptor. The <service> element has an attribute "scope". One allowed value of this attribute creates an instance of the implementing class for each invocation.
Jeff
On 8/20/2010 7:18 AM, Meeusen, Christopher W. wrote:
> Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
>
> -----Original Message-----
> From: Meeusen, Christopher W.
> Sent: Wednesday, August 18, 2010 5:45 PM
> To: java-user@axis.apache.org
> Cc: axis-user@ws.apache.org
> Subject: Re: Field level variables
>
> My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
>
> On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
>
>> I’m looking through some of my colleagues code and I’m noticing some
>> field level variables declared inside one of our pojos. Someth ing
>> similar to this:
>>
>>
>>
>> Public class classA
>>
>> {
>>
>> private classB aClassb;
>>
>>
>>
>> Public classC[] aMethod()
>>
>> {
>>
>> aClassb= new classB();
>>
>> }
>>
>> }
>>
>>
>>
>> aMethod() is exposed as a web service and is called several thousand
>> times per minute. Is this thread safe? I know it is bad to have
>> field level variables unless they are really needed but I don’t know
>> if this behavior is ok inside of the axis2 environment.
>>
>>
>>
>> Thanks,
>>
>> Chris
RE: Field level variables
Posted by "Meeusen, Christopher W." <Me...@mayo.edu>.
Thank you for the response! I just want to make sure I understand. You're saying this is configurable in the services.xml file? If this is so what is the default scope if nothing is specified?
Thanks,
Chris
-----Original Message-----
From: Jeff Greif [mailto:jeff.greif@gmail.com]
Sent: Friday, August 20, 2010 11:03 AM
To: Meeusen, Christopher W.
Cc: java-user@axis.apache.org; axis-user@ws.apache.org
Subject: Re: Field level variables
This is configurable in the deployment descriptor. The <service> element has an attribute "scope". One allowed value of this attribute creates an instance of the implementing class for each invocation.
Jeff
On 8/20/2010 7:18 AM, Meeusen, Christopher W. wrote:
> Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
>
> -----Original Message-----
> From: Meeusen, Christopher W.
> Sent: Wednesday, August 18, 2010 5:45 PM
> To: java-user@axis.apache.org
> Cc: axis-user@ws.apache.org
> Subject: Re: Field level variables
>
> My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
>
> On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
>
>> I’m looking through some of my colleagues code and I’m noticing some
>> field level variables declared inside one of our pojos. Someth ing
>> similar to this:
>>
>>
>>
>> Public class classA
>>
>> {
>>
>> private classB aClassb;
>>
>>
>>
>> Public classC[] aMethod()
>>
>> {
>>
>> aClassb= new classB();
>>
>> }
>>
>> }
>>
>>
>>
>> aMethod() is exposed as a web service and is called several thousand
>> times per minute. Is this thread safe? I know it is bad to have
>> field level variables unless they are really needed but I don’t know
>> if this behavior is ok inside of the axis2 environment.
>>
>>
>>
>> Thanks,
>>
>> Chris
RE: Field level variables
Posted by "Meeusen, Christopher W." <Me...@mayo.edu>.
Thanks everyone for the responses. After reading the responses, and some testing I've confirmed that not specifying a scope in the service descriptor makes axis2 instantiate a new instance of our pojo service class with each new request. I've also since changed these variables, because there was no reason to have them as that scope.
Thanks!
Chris
-----Original Message-----
From: java-user-return-83475-Meeusen.Christopher=mayo.edu@axis.apache.org [mailto:java-user-return-83475-Meeusen.Christopher=mayo.edu@axis.apache.org] On Behalf Of Stadelmann Josef
Sent: Monday, September 13, 2010 8:03 AM
To: java-user@axis.apache.org; jgreif@alumni.princeton.edu
Subject: AW: Field level variables
Christopher
Jeff is correct;
in service.xml there is scope="soapsession"
This makes axis2 creating a new instance of your service class for each new user-session.
For that your service class demands 3 more methods
public void init(ServiceContext sCtx) throws XMLStreamException {
. . .
}
public void destroy(ServiceContext sCtx) throws XMLStreamException {
. . .
}
public void setOperationContext(OperationContext oCtx) {
. . .
}
AND
In axis2.xml at ./axis2/WEB-INF/conf you have to set-up ConfigContextTimeoutInterval to a much bigger value.
The value is the TimeoutInterval in ms at which the users client has to send latest the next session-request to keep the service class instance (the service providing object a-life).
This is what we understand as "LONG LASTING USER SESSIONMS" and with AXIS2-1.2 it works greate.
<!--This will give out the timeout of the configuration contexts, in milliseconds-->
<parameter name="ConfigContextTimeoutInterval">28800000</parameter>
You can look to the TimeoutInterval as the life-time of your instance, after which destroy() gets called.
This is true unless you the user-session places a next request before this TimeoutInterval ends; at which time the TimeoutInterval starts from 0.
That is what we use with our SpezplaService and AXIS2-1.2 and I have no confirmation and did not yet test that the same is true for AXIS2-1.5.x
Somewhere in the Oxygen-Tank Area there is a more precise document.
Josef
-----Ursprüngliche Nachricht-----
Von: Jeff Greif [mailto:jeff.greif@gmail.com]
Gesendet: Freitag, 20. August 2010 18:03
An: Meeusen, Christopher W.
Cc: java-user@axis.apache.org; axis-user@ws.apache.org
Betreff: Re: Field level variables
This is configurable in the deployment descriptor. The <service> element has an attribute "scope". One allowed value of this attribute creates an instance of the implementing class for each invocation.
Jeff
On 8/20/2010 7:18 AM, Meeusen, Christopher W. wrote:
> Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
>
> -----Original Message-----
> From: Meeusen, Christopher W.
> Sent: Wednesday, August 18, 2010 5:45 PM
> To: java-user@axis.apache.org
> Cc: axis-user@ws.apache.org
> Subject: Re: Field level variables
>
> My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
>
> On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
>
>> I’m looking through some of my colleagues code and I’m noticing some
>> field level variables declared inside one of our pojos. Someth ing
>> similar to this:
>>
>>
>>
>> Public class classA
>>
>> {
>>
>> private classB aClassb;
>>
>>
>>
>> Public classC[] aMethod()
>>
>> {
>>
>> aClassb= new classB();
>>
>> }
>>
>> }
>>
>>
>>
>> aMethod() is exposed as a web service and is called several thousand
>> times per minute. Is this thread safe? I know it is bad to have
>> field level variables unless they are really needed but I don’t know
>> if this behavior is ok inside of the axis2 environment.
>>
>>
>>
>> Thanks,
>>
>> Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
RE: AW: Field level variables
Posted by Martin Gainty <mg...@hotmail.com>.
http://wso2.org/library/articles/axis2-session-management-part-2
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Subject: AW: Field level variables
> Date: Mon, 13 Sep 2010 15:02:47 +0200
> From: josef.stadelmann@axa-winterthur.ch
> To: java-user@axis.apache.org; jgreif@alumni.princeton.edu
>
> Christopher
>
> Jeff is correct;
> in service.xml there is scope="soapsession"
> This makes axis2 creating a new instance of your service class
> for each new user-session.
>
> For that your service class demands 3 more methods
>
> public void init(ServiceContext sCtx) throws XMLStreamException {
> . . .
> }
> public void destroy(ServiceContext sCtx) throws XMLStreamException {
> . . .
> }
> public void setOperationContext(OperationContext oCtx) {
> . . .
> }
>
> AND
>
> In axis2.xml at ./axis2/WEB-INF/conf you have to set-up ConfigContextTimeoutInterval to a much bigger value.
> The value is the TimeoutInterval in ms at which the users client has to send latest the next session-request
> to keep the service class instance (the service providing object a-life).
>
> This is what we understand as "LONG LASTING USER SESSIONMS" and with AXIS2-1.2 it works greate.
>
> <!--This will give out the timeout of the configuration contexts, in milliseconds-->
> <parameter name="ConfigContextTimeoutInterval">28800000</parameter>
>
> You can look to the TimeoutInterval as the life-time of your instance, after which destroy() gets called.
> This is true unless you the user-session places a next request before this TimeoutInterval ends;
> at which time the TimeoutInterval starts from 0.
>
> That is what we use with our SpezplaService and AXIS2-1.2
> and I have no confirmation and did not yet test that the same is true for AXIS2-1.5.x
>
> Somewhere in the Oxygen-Tank Area there is a more precise document.
>
> Josef
>
>
> -----Ursprüngliche Nachricht-----
> Von: Jeff Greif [mailto:jeff.greif@gmail.com]
> Gesendet: Freitag, 20. August 2010 18:03
> An: Meeusen, Christopher W.
> Cc: java-user@axis.apache.org; axis-user@ws.apache.org
> Betreff: Re: Field level variables
>
> This is configurable in the deployment descriptor. The <service>
> element has an attribute "scope". One allowed value of this attribute
> creates an instance of the implementing class for each invocation.
>
> Jeff
>
> On 8/20/2010 7:18 AM, Meeusen, Christopher W. wrote:
> > Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
> >
> > -----Original Message-----
> > From: Meeusen, Christopher W.
> > Sent: Wednesday, August 18, 2010 5:45 PM
> > To: java-user@axis.apache.org
> > Cc: axis-user@ws.apache.org
> > Subject: Re: Field level variables
> >
> > My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
> >
> > On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
> >
> >> I’m looking through some of my colleagues code and I’m noticing some
> >> field level variables declared inside one of our pojos. Someth ing
> >> similar to this:
> >>
> >>
> >>
> >> Public class classA
> >>
> >> {
> >>
> >> private classB aClassb;
> >>
> >>
> >>
> >> Public classC[] aMethod()
> >>
> >> {
> >>
> >> aClassb= new classB();
> >>
> >> }
> >>
> >> }
> >>
> >>
> >>
> >> aMethod() is exposed as a web service and is called several thousand
> >> times per minute. Is this thread safe? I know it is bad to have
> >> field level variables unless they are really needed but I don’t know
> >> if this behavior is ok inside of the axis2 environment.
> >>
> >>
> >>
> >> Thanks,
> >>
> >> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
AW: Field level variables
Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Christopher
Jeff is correct;
in service.xml there is scope="soapsession"
This makes axis2 creating a new instance of your service class
for each new user-session.
For that your service class demands 3 more methods
public void init(ServiceContext sCtx) throws XMLStreamException {
. . .
}
public void destroy(ServiceContext sCtx) throws XMLStreamException {
. . .
}
public void setOperationContext(OperationContext oCtx) {
. . .
}
AND
In axis2.xml at ./axis2/WEB-INF/conf you have to set-up ConfigContextTimeoutInterval to a much bigger value.
The value is the TimeoutInterval in ms at which the users client has to send latest the next session-request
to keep the service class instance (the service providing object a-life).
This is what we understand as "LONG LASTING USER SESSIONMS" and with AXIS2-1.2 it works greate.
<!--This will give out the timeout of the configuration contexts, in milliseconds-->
<parameter name="ConfigContextTimeoutInterval">28800000</parameter>
You can look to the TimeoutInterval as the life-time of your instance, after which destroy() gets called.
This is true unless you the user-session places a next request before this TimeoutInterval ends;
at which time the TimeoutInterval starts from 0.
That is what we use with our SpezplaService and AXIS2-1.2
and I have no confirmation and did not yet test that the same is true for AXIS2-1.5.x
Somewhere in the Oxygen-Tank Area there is a more precise document.
Josef
-----Ursprüngliche Nachricht-----
Von: Jeff Greif [mailto:jeff.greif@gmail.com]
Gesendet: Freitag, 20. August 2010 18:03
An: Meeusen, Christopher W.
Cc: java-user@axis.apache.org; axis-user@ws.apache.org
Betreff: Re: Field level variables
This is configurable in the deployment descriptor. The <service>
element has an attribute "scope". One allowed value of this attribute
creates an instance of the implementing class for each invocation.
Jeff
On 8/20/2010 7:18 AM, Meeusen, Christopher W. wrote:
> Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
>
> -----Original Message-----
> From: Meeusen, Christopher W.
> Sent: Wednesday, August 18, 2010 5:45 PM
> To: java-user@axis.apache.org
> Cc: axis-user@ws.apache.org
> Subject: Re: Field level variables
>
> My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
>
> On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
>
>> I’m looking through some of my colleagues code and I’m noticing some
>> field level variables declared inside one of our pojos. Someth ing
>> similar to this:
>>
>>
>>
>> Public class classA
>>
>> {
>>
>> private classB aClassb;
>>
>>
>>
>> Public classC[] aMethod()
>>
>> {
>>
>> aClassb= new classB();
>>
>> }
>>
>> }
>>
>>
>>
>> aMethod() is exposed as a web service and is called several thousand
>> times per minute. Is this thread safe? I know it is bad to have
>> field level variables unless they are really needed but I don’t know
>> if this behavior is ok inside of the axis2 environment.
>>
>>
>>
>> Thanks,
>>
>> Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
Re: Field level variables
Posted by Jeff Greif <je...@gmail.com>.
This is configurable in the deployment descriptor. The <service>
element has an attribute "scope". One allowed value of this attribute
creates an instance of the implementing class for each invocation.
Jeff
On 8/20/2010 7:18 AM, Meeusen, Christopher W. wrote:
> Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
>
> -----Original Message-----
> From: Meeusen, Christopher W.
> Sent: Wednesday, August 18, 2010 5:45 PM
> To: java-user@axis.apache.org
> Cc: axis-user@ws.apache.org
> Subject: Re: Field level variables
>
> My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
>
> On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
>
>> I’m looking through some of my colleagues code and I’m noticing some
>> field level variables declared inside one of our pojos. Someth ing
>> similar to this:
>>
>>
>>
>> Public class classA
>>
>> {
>>
>> private classB aClassb;
>>
>>
>>
>> Public classC[] aMethod()
>>
>> {
>>
>> aClassb= new classB();
>>
>> }
>>
>> }
>>
>>
>>
>> aMethod() is exposed as a web service and is called several thousand
>> times per minute. Is this thread safe? I know it is bad to have
>> field level variables unless they are really needed but I don’t know
>> if this behavior is ok inside of the axis2 environment.
>>
>>
>>
>> Thanks,
>>
>> Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
RE: Field level variables
Posted by "Meeusen, Christopher W." <Me...@mayo.edu>.
Let me try to ask this another way. Say I have a class MyService.java and this class has a web service method in it. What does the lifecycle of this class look like? Is there a new instance of MyService instantiated for each request to one of the methods within it, or is one instance of this class instantiated and multiple threads use the same instance of the class?
-----Original Message-----
From: Meeusen, Christopher W.
Sent: Wednesday, August 18, 2010 5:45 PM
To: java-user@axis.apache.org
Cc: axis-user@ws.apache.org
Subject: Re: Field level variables
My main concern is if this is thread safe. Are pojos re entrant in axis2-1.3?
On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu > wrote:
> I’m looking through some of my colleagues code and I’m noticing some
> field level variables declared inside one of our pojos. Someth ing
> similar to this:
>
>
>
> Public class classA
>
> {
>
> private classB aClassb;
>
>
>
> Public classC[] aMethod()
>
> {
>
> aClassb= new classB();
>
> }
>
> }
>
>
>
> aMethod() is exposed as a web service and is called several thousand
> times per minute. Is this thread safe? I know it is bad to have
> field level variables unless they are really needed but I don’t know
> if this behavior is ok inside of the axis2 environment.
>
>
>
> Thanks,
>
> Chris
Re: Field level variables
Posted by "Meeusen, Christopher W." <Me...@mayo.edu>.
My main concern is if this is thread safe. Are pojos re entrant in
axis2-1.3?
On Aug 18, 2010, at 17:21, "Meeusen, Christopher W." <Meeusen.Christopher@mayo.edu
> wrote:
> I’m looking through some of my colleagues code and I’m noticing
> some field level variables declared inside one of our pojos. Someth
> ing similar to this:
>
>
>
> Public class classA
>
> {
>
> private classB aClassb;
>
>
>
> Public classC[] aMethod()
>
> {
>
> aClassb= new classB();
>
> }
>
> }
>
>
>
> aMethod() is exposed as a web service and is called several thousand
> times per minute. Is this thread safe? I know it is bad to have
> field level variables unless they are really needed but I don’t know
> if this behavior is ok inside of the axis2 environment.
>
>
>
> Thanks,
>
> Chris