Have you tried using synchronize blocks around the object?

Ie.

synchronize(ArrayObjectName)
{
        //sensitive code
}

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:JSP-INTEREST@;JAVA.SUN.COM] On Behalf Of Ionel Condor
Sent: 07 November 2002 12: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

===========================================================================
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