This is totaly false.  You do need to worry about threading, if the
variable is static to the class (not instance).  Even a vaiable in the
session could be accessed by two threads.  Also I've seen some poeple
mention not to use Vector because it is "old".  This is also not true,
Vector can be useful and is not depricated at this time.


Vikramjit Singh wrote:

-----Original Message-----
From: Amit Ghaste [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 03, 2003 12:12 AM
To: [EMAIL PROTECTED]
Subject: Re: Use of Vector


Vikramjit,

The reason that Vector is Synchronized is the main reason why
I would use it
in a web application...

I dont want adhoc volatile values to be present..

I dont think in web application you need to care about threads, since the
container handles all the threading issues for you. Vectors were basically
used for legacy systems (you can read more in Thinking in JAVA-Bruce Eckel)
As far is volatile values, they arise in stand alone applications and not
web driven.

Snehal,

Could u explain what do u mean by Master Value... do u mean
for ex.. of
populating drop down lists, a list that is common across
users and sessions.
like an Application level data...

if so then yes i would use a Synchronized Collection object,
Vector works
inplictly as a Synchronized Object, but if u want to use
another class then
I would recomend using the Synchroinzation technique in the
Collections
class so as to maintain data itegrity.

Amit.

Vikram.

-----Original Message-----
From: A mailing list about Java Server Pages specification
and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Vikramjit Singh
Sent: Wednesday, January 01, 2003 10:31 PM
To: [EMAIL PROTECTED]
Subject: Re: Use of Vector


-----Original Message-----
From: Snehal Pandya [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 02, 2003 11:57 AM
To: [EMAIL PROTECTED]
Subject: Use of Vector


Hi All,
I have a Application and For that I want to put all Master
value in the
Vector .
Whether this is good programming or it is benifishery.
My application is for intranet only.
Please help me how to use it and how to retrive the
information from the
Vector.

vector is not useful for web applications, just coz of the
basic reason that
it is synchronized.
You could use other Collection classes or check the List interface.

My 2 cents:

For inserting the values use LinkedList (since LinkedList is
faster for
insert operations).
LinkedList provides sequential access, additions and
deletions, at a cost of
slower random access.
For retrieving or reading the values use ArrayList (ArrayList
is faster for
read operations).

For instance, if your program is to frequently provide random
access to the
data of the list, (for example, "show me item three, twelve, two, and
twenty-five") the ArrayList class offers quick access to
individual elements
of the list.

When working with ArrayList and LinkedList, there are two
ways of creating
the objects:

List cityList = new ArrayList();
LinkedList peopleList = new LinkedList();

The above creation ensures that, line 1 that we are creating
an ArrayList
but we are gonna use it as a List. While line 2 that, we are
gonna use a
linked list as a LinkedList :).

Thanks for help,

Snehal

Vikram.

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

Disclaimer: This e-mail message along with any attachments is
intended only
for the addressee and may contain confidential and privileged
information of
GTL Limited. If the reader of this message is not the
intended recipient,
you are notified that any dissemination, distribution or copy of this
communication is strictly prohibited. If you have received
this message by
error, please notify us immediately, return the original mail
to the sender
and delete the message from your system.

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

Disclaimer: This e-mail message along with any attachments is intended only
for the addressee and may contain confidential and privileged information of
GTL Limited. If the reader of this message is not the intended recipient,
you are notified that any dissemination, distribution or copy of this
communication is strictly prohibited. If you have received this message by
error, please notify us immediately, return the original mail to the sender
and delete the message from your system.

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