Yes Adrian,
if I synch ON THE OBJECT and only the access code for that object on both
sides, it works...
Many thanks.

Ionel.


----- Original Message -----
From: "Adrian Janssen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 07, 2002 3:21 PM
Subject: Re: how to lock the access to an array till a method is finished
...


> syncronise all and any code that accesses the array, and make sure that
your
> blocks are "wide" enough.
>
> E.G. this WON'T work because the "syncronized" bock should be out-side of
> the loop.
>
> public void populateBigArray ( long[] bigArray )
> {
>         for (i = 0 ; i< VERY_BIG_NUMBER ; i++)
>         {
>                 syncronized (bigArray)
>                 {
>                         bigArray[i] = i;
>                 }
>         }
> }
>
>
>
> > -----Original Message-----
> > From: Ionel Condor [SMTP:[EMAIL PROTECTED]]
> > Sent: 07 November 2002 03:16
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: how to lock  the access to an array till a method is
> > finished ...
> >
> > I have already do this but does not help.
> > The synch in this case does not help, as it LOCKS the object that calls
> > the
> > method and NOT THE the array that is used by the method and also by the
> > jsp
> > page.
> > (my  use of 'volatile' also does not help).
> >
> > Ionel.
> >
> > > Syncronize the code/method that populates the array as well as the
> > > code/methods that access it. This can either be done using the
> > syncronise
> > > method modifier, or using syncronised blocks, which is better.
> > >
> > > This is however more of an elementary Java issue though, search the
web
> > for
> > > the PDF version of Bruce Eckel's book: "Thinking in Java" and read
> > chapter
> > > 14.
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Ionel Condor [SMTP:[EMAIL PROTECTED]]
> > > > Sent: 07 November 2002 02:43
> > > > To:   [EMAIL PROTECTED]
> > > > Subject:      how to lock  the access to an array till a method is
> > > > finished...
> > > >
> > > > Hi,
> > > > I have the following situation:
> > > > In a bean, I  have a method that populates an array with a large,
very
> > > > large
> > > > amount of data (required for some operations).
> > > > From my jsp page I do not want to allow any web clients to see the
> > length
> > > > of
> > > > this array, till the process of population is finished....I mean
that
> > > > otherwise one can see intermediary results and I want to avoid this.
> > > >
> > > > (I have tried to mark volatile the array but this helps me only to
> > keep
> > > > the
> > > > correct value in all the threads, does not lock me also the object).
> > > >
> > > > Do I have to use a complicated wait/notify mechanism to achive this
or
> > how
> > > > can I do ?
> > > >
> > > > Many thanks,
> > > > Ionel C.
> > > >
> > > >
> >
==========================================================================
> > > > =
> > > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > > JSP-INTEREST".
> > > > For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST
> > > > DIGEST".
> > > > Some relevant FAQs on JSP/Servlets can be found at:
> > > >
> > > >  http://archives.java.sun.com/jsp-interest.html
> > > >  http://java.sun.com/products/jsp/faq.html
> > > >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > > >  http://www.jguru.com/faq/index.jsp
> > > >  http://www.jspinsider.com
> > > --
> > >
> > > It is the strict policy of Truworths that its e-mail facility and all
> > > e-mail communications emanating therefrom, should be utilised for
> > > business purposes only and should conform to high professional and
> > > business standards.   Truworths has stipulated certain regulations in
> > > terms whereof strict guidelines relating to the use and content of
> > > e-mail communications are laid down. The use of the Truworths e-mail
> > > facility is not permitted for the distribution of chain letters or
> > > offensive mail of any nature whatsoever.   Truworths hereby distances
> > > itself from and accepts no liability in respect of the unauthorised
> > > use of its e-mail facility or the sending of e-mail communications
> > > for other than strictly business purposes.   Truworths furthermore
> > > disclaims liability for any  unauthorised instruction for  which
> > > permission was not granted.    Truworths Limited accepts no liability
> > > for any consequences arising from or as a result of reliance on this
> > > message unless it is in respect of bona fide Truworths business for
> > > which proper authorisation has been granted.
> > >
> > > Any recipient of an unacceptable communication, a chain letter or
> > > offensive material of any nature is requested to notify the Truworths
> > > e-mail administrator ([EMAIL PROTECTED]) immediately in order that
> > > appropriate action can be taken against the individual concerned.
> > >
> > >
> >
==========================================================================
> > =
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > >  http://archives.java.sun.com/jsp-interest.html
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> > >  http://www.jguru.com/faq/index.jsp
> > >  http://www.jspinsider.com
> >
> >
==========================================================================
> > =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
> --
>
> It is the strict policy of Truworths that its e-mail facility and all
> e-mail communications emanating therefrom, should be utilised for
> business purposes only and should conform to high professional and
> business standards.   Truworths has stipulated certain regulations in
> terms whereof strict guidelines relating to the use and content of
> e-mail communications are laid down. The use of the Truworths e-mail
> facility is not permitted for the distribution of chain letters or
> offensive mail of any nature whatsoever.   Truworths hereby distances
> itself from and accepts no liability in respect of the unauthorised
> use of its e-mail facility or the sending of e-mail communications
> for other than strictly business purposes.   Truworths furthermore
> disclaims liability for any  unauthorised instruction for  which
> permission was not granted.    Truworths Limited accepts no liability
> for any consequences arising from or as a result of reliance on this
> message unless it is in respect of bona fide Truworths business for
> which proper authorisation has been granted.
>
> Any recipient of an unacceptable communication, a chain letter or
> offensive material of any nature is requested to notify the Truworths
> e-mail administrator ([EMAIL PROTECTED]) immediately in order that
> appropriate action can be taken against the individual concerned.
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to