You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Angelo C." <an...@gmail.com> on 2012/06/04 14:20:19 UTC

global variable concurrent access in different services

Hi,

This is a situation, in a PageRenderRequestFilter my app need to access a
global String variable, and this global variable is updated every hour in a
PeriodicExecutor, any suggestion how to do this?  will there be a conflict
in accessing this variable? Thanks,

Angelo

--
View this message in context: http://tapestry.1045711.n5.nabble.com/global-variable-concurrent-access-in-different-services-tp5713602.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: global variable concurrent access in different services

Posted by Muhammad Gelbana <m....@gmail.com>.
You will love this tutorial:
http://www.youtube.com/playlist?list=PLBB24CFB073F1048E&feature=plcp

On Mon, Jun 4, 2012 at 3:22 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Mon, 04 Jun 2012 09:20:19 -0300, Angelo C. <an...@gmail.com>
> wrote:
>
>  Hi,
>>
>
> Hi!
>
>
>  This is a situation, in a PageRenderRequestFilter my app need to access a
>> global String variable, and this global variable is updated every hour in
>> a PeriodicExecutor, any suggestion how to do this?  will there be a
>> conflict in accessing this variable? Thanks,
>>
>
> This isn't related to Tapestry at all: it's just a Java question. To begin
> with, Java doesn't have global variables. Second, make this variable a
> private non-static field of a service, provide methods to get and set it
> and use some Java mechanism to deal with it (volatile keyword, synchronized
> keyword, java.concurrent classes, etc).
>
> --
> Thiago H. de Paula Figueiredo
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Developer*

Re: global variable concurrent access in different services

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 04 Jun 2012 09:20:19 -0300, Angelo C. <an...@gmail.com>  
wrote:

> Hi,

Hi!

> This is a situation, in a PageRenderRequestFilter my app need to access a
> global String variable, and this global variable is updated every hour  
> in a PeriodicExecutor, any suggestion how to do this?  will there be a  
> conflict in accessing this variable? Thanks,

This isn't related to Tapestry at all: it's just a Java question. To begin  
with, Java doesn't have global variables. Second, make this variable a  
private non-static field of a service, provide methods to get and set it  
and use some Java mechanism to deal with it (volatile keyword,  
synchronized keyword, java.concurrent classes, etc).

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org