Thanks for your explanantion!! 
That makes it clear to me !

> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> Gesendet: 23.07.06 01:22:12
> An: [email protected]
> Betreff: Re: [axis2] service scope :: static instance variables


> You should not use static variables, but instance variables.
> Just remove the 'static' modifier.
> 
> Instance variables belong to one object instance, while static
> variables belong to a class. A class is loaded when it is
> first needed and never (well, almost never) unloaded, so its
> static variables are never deleted. That's why your static
> variable that is not set by Axis stays the same, because the
> class it belongs to is not unloaded between requests.
> 
> "The service class is instantiated with every request" -
> that's not quite correct - a new *object instance* is created
> from the class, but the class stays the same. Object
> instances can reference the static variables, but these
> variables still belong to the class, not to any instance.
> All object instances access the *same* static variable.
> 
> Hope that helps,
> Christopher.
> 
> [EMAIL PROTECTED] wrote:
> > Martin-
> > 
> > Thanks for your reply.
> > I use Java 1.4.2.
> > I'm just wondering about the - to my opinion - strange behaviour.
> > The service class is instantiated with every request, but one of its static 
> > instance variables keeps the same (Object ID is same over several requests).
> > 
> > Why is this ?
> > 
> > The other static instance variabled (MessageContexts) are set at any method 
> > invocation on my service (in setOperationContext()).
> > The variable which stays the same, I handle sort of a singleton.
> > It can be accessed via a getter; there I check if the variable is not null 
> > and set. If required, I read the properties-file and refill the static 
> > instance variable.
> > 
> > I can't understand that behaviour.
> > 
> > Any suggestions are highly appreciated; thanks for your time
> > 
> > Bille
> > 
> > 
> >> -----Ursprüngliche Nachricht-----
> >> Von: [email protected]
> >> Gesendet: 22.07.06 18:01:10
> >> An: <[email protected]>
> >> Betreff: Re: [axis2] service scope :: static instance variables
> > 
> > 
> >> Take a look at 
> >> http://java.sun.com/javase/6/docs/api/javax/xml/ws/handler/MessageContext.Scope.html
> >> where MessageContext can take on 2 'scope' groupings-
> >> Properties scoped as APPLICATION are visible to handlers, client 
> >> applications and service endpoints; 
> >> properties scoped as HANDLER are only normally visible to handlers. 
> >> 
> >> Does this help you??
> >> Martin --
> >> *********************************************************************
> >> This email message and any files transmitted with it contain confidential
> >> information intended only for the person(s) to whom this email message is
> >> addressed.  If you have received this email message in error, please notify
> >> the sender immediately by telephone or email and destroy the original
> >> message without making a copy.  Thank you.
> >> 
> >> 
> >> 
> >> ----- Original Message ----- 
> >> From: <[EMAIL PROTECTED]>
> >> To: <[email protected]>
> >> Sent: Saturday, July 22, 2006 11:19 AM
> >> Subject: [axis2] service scope :: static instance variables
> >> 
> >> 
> >> > Hi to all,
> >> > 
> >> > I'm just wondering about the following:
> >> > - my service is of scope REQUEST
> >> > - in the service I have some static instance variables like the 
> >> > messageContexts and some configuration properties.
> >> > 
> >> > While debugging I realize, that my service-class has an individual 
> >> > Object-ID for every imcoming request. That's what I exspected ;)
> >> > But concerning my static property-variable it is of the same ID 
> >> > throughout several service requests. 
> >> > The static messageContext-variables have a new ID with every request, 
> >> > too. So that's ok for me - like I'd exspected it.
> >> > The only "problem" is the configuration-property, which seems to be 
> >> > cached somewhere.
> >> > 
> >> > Sorry, for this being a fundamental question on Java. But to my 
> >> > Java-knowledge I thought that static variables have the scope of the 
> >> > parents objects lifetime.
> >> > 
> >> > I would be happy, if someone could clarify this.
> >> > 
> >> > Thanks so far 
> >> > 
> >> > Bille
> >> > ______________________________________________________________
> >> > Verschicken Sie romantische, coole und witzige Bilder per SMS!
> >> > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> >> > 
> >> > 
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >> > 
> >> >
> > 
> > 
> > ______________________________________________________________
> > Verschicken Sie romantische, coole und witzige Bilder per SMS!
> > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000071


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to