This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Syncronized & serializable

 
Nimish Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I know diffrence between vector and arraylist.
Vector is syncronized and arraylist is not syncronized.

what is the meaning of syncronized related to vector and arraylist ?

and more, when class implement serializable interface, what happen ?
generaly bean class implement serializable interface,
but what is it gain ?

i can't understand.

please help me.

Thanks in anticipation.

with rgds,
Nimish
 
madhup narain
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
heres what i can say about synchronized

Only one thread at a time can own the lock for any given object. Thus if more than one thread tries to enter a section of code for which the lock must be acquired then only one thread will get the lock and all other threads will block. Note however that a thread can still execute a non-synchronized method or block of code even if the object is locked.
 
vidhyasagar reddy
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are implementing serializable means we making that class object as persistant

class x implemts Serializable
{
....
}


means if u create object for x that object is persistant
 
Steve Simon Joseph Fernandez
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The serializable interface is a marker interface - implying that it doesn't contain any methods to implement. It tells the JVM that objects of this class are serializable by default - they can be converted to and from a byte stream by the default methods applied by the JVM. Serialization is done to 1) transmit objects via the network and 2)store objects in a persistent store. The opposite of serialization, i.e. deserialization, takes serialized objects and puts them back into the JVM heap.

_steve.
 
Nimish Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for giving ur valuable time,

but i want to know syncronization related to vector and arraylist.

please help me.

rgds,
Nimish Patel
6:40 pm
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its not related to ArrayList. A Vector is synchronized, so only one thread at a time can access or manipulate it or its contents.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic