Hi Dilan, You can keep the counter as a session variable and increment and write to the file in every request.
On Mon, Oct 27, 2014 at 9:56 AM, Dilan Udara Ariyaratne <[email protected]> wrote: > Thanks, Roshan. > > This was exactly what I was looking for. > > Highly appreciate your feedback. > > > *Dilan U. Ariyaratne* > Software Engineer > WSO2 Inc. <http://wso2.com/> > Mobile: +94775149066 > lean . enterprise . middleware > > On Mon, Oct 27, 2014 at 9:07 AM, Roshan Deniyage <[email protected]> wrote: > >> Hi Dilan, >> You can you the "sync(function)" function provided by the Rhino >> engine. Try the blog post [1]. >> >> [1] http://madhukaudantha.blogspot.com/2014/02/rhino-js-sync.html >> >> >> Thanks, >> >> Roshan Deniyage >> Associate Technical Lead >> >> WSO2, Inc: http://wso2.com >> >> Mobile : +94 777636406 >> Twitter : *https://twitter.com/roshku <https://twitter.com/roshku>* >> LinkedIn : https://www.linkedin.com/in/roshandeniyage >> >> >> On Sun, Oct 26, 2014 at 6:33 PM, Dilan Udara Ariyaratne <[email protected]> >> wrote: >> >>> Hi All, >>> >>> Thanks for your valuable feedback! >>> >>> If I am to continue this discussion, as far as I know, >>> when ever a client-server-connection is made, the server hands over the >>> request handling task to a separate process or a thread. >>> In PHP, this is a new process and in Jaggery, yes, this should be a >>> thread as it comes out from a Java specific background. >>> >>> So, what I understand from your feedback is that the scope of a Jaggery >>> session is local to a specific connection handling thread. >>> Please correct me if I am wrong. :) >>> >>> And about dealing with concurrency issues, >>> let me be more specific on this. >>> >>> Let's say we have one Jaggery script that is updating a number stored in >>> a file >>> and I need to increment the number by one on each and every access to >>> the script by a client. >>> In order to have a correct count, I need to synchronize the access to >>> the file from each request handling thread. >>> >>> How can I achieve this in Jaggery? Any Feedback on this would be highly >>> appreciated. >>> >>> Thanks. >>> >>> >>> >>> *Dilan U. Ariyaratne* >>> Software Engineer >>> WSO2 Inc. <http://wso2.com/> >>> Mobile: +94775149066 >>> lean . enterprise . middleware >>> >>> On Wed, Oct 22, 2014 at 10:01 AM, Harshan Liyanage <[email protected]> >>> wrote: >>> >>>> Ultimately Jaggery is compiled into a java byte-code by the Rhino >>>> Engine. So the same principals will apply as Dinesh as mentioned. :) >>>> >>>> Best Regards, >>>> >>>> Lakshitha Harshan >>>> Software Engineer >>>> Mobile: *+94724423048* >>>> Email: [email protected] >>>> Blog : http://harshanliyanage.blogspot.com/ >>>> *WSO2, Inc. :** wso2.com <http://wso2.com/>* >>>> lean.enterprise.middleware. >>>> >>>> On Wed, Oct 22, 2014 at 9:12 AM, Dinesh J Weerakkody <[email protected]> >>>> wrote: >>>> >>>>> Hi Dilan, >>>>> >>>>> As I understood, Jaggery is running on top of JSP/Servlet structure >>>>> and use same principles (more like a wrapper to JSP). Session scopes and >>>>> concurrency also similar to simple Jsp app. Each request will be served by >>>>> separate thread. So You have to deal with shared resources by keeping that >>>>> in mind.. >>>>> >>>>> PS: Please correct me if I'm wrong.. :) >>>>> >>>>> On Wed, Oct 22, 2014 at 7:59 AM, Dilan Udara Ariyaratne < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi All, >>>>>> >>>>>> I am just curious to know on "To what extent, Jaggery can deal with >>>>>> Concurrency Issues". >>>>>> >>>>>> For example, if some Jaggery Script is there to handle some file >>>>>> operations >>>>>> on a shared file or some database operations that we expect to be >>>>>> mutually exclusive... >>>>>> >>>>>> And also about the scope of Jaggery "session" variable: i.e. when the >>>>>> server is dealing with >>>>>> multiple concurrent executions of the same Jaggery script, are we >>>>>> dealing with multiple independent sessions or just one session >>>>>> instance... >>>>>> >>>>>> Any Feedback on this would be highly appreciated. >>>>>> >>>>>> Thanks. >>>>>> >>>>>> *Dilan U. Ariyaratne* >>>>>> Software Engineer >>>>>> WSO2 Inc. <http://wso2.com/> >>>>>> Mobile: +94775149066 >>>>>> lean . enterprise . middleware >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> [email protected] >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> *Dinesh J. Weerakkody* >>>>> Software Engineer >>>>> WSO2 Inc. >>>>> lean | enterprise | middleware >>>>> M : +94 727 361788 | E : [email protected] | W : www.wso2.com >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> [email protected] >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Udara Liyanage Software Engineer WSO2, Inc.: http://wso2.com lean. enterprise. middleware web: http://udaraliyanage.wordpress.com phone: +94 71 443 6897
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
