Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #203 > unrolled thread

java doubts

Started by"amarmca2u" <amarmca2u@THRWHITE.remove-dii-this>
First post2011-04-27 15:22 +0000
Last post2011-04-27 15:22 +0000
Articles 4 — 4 participants

Back to article view | Back to comp.lang.java.databases


Contents

  java doubts "amarmca2u" <amarmca2u@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
    Re: java doubts "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
    Re: java doubts "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
      Re: java doubts "Lew" <lew@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000

#203 — java doubts

From"amarmca2u" <amarmca2u@THRWHITE.remove-dii-this>
Date2011-04-27 15:22 +0000
Subjectjava doubts
Message-ID<f6e9f1a6-bfaa-4792-ae75-dc97930f18c0@z72g2000hsb.googlegroups.com>
  To: comp.lang.java.databases
hi,

what we call a concrete class in java api with out constructors(Like
DriverManager)?

detail data about protected constructor. Can we have protected class?

why all exception classes implementing the serialzible interface?

what is the difference between the "A class by defaultly
synchronized(Vector)" and "A class which is manuvally synchronized"?

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#204

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:22 +0000
Message-ID<ra5774l7vtj6ah64fbtc6sh1vbsq2a8fvi@4ax.com>
In reply to#203
  To: comp.lang.java.databases
On Tue, 8 Jul 2008 06:13:04 -0700 (PDT), amarmca2u@gmail.com wrote,
quoted or indirectly quoted someone who said :

>what we call a concrete class in java api with out constructors(Like
>DriverManager)?

Class with private or protected constructor.

>detail data about protected constructor. Can we have protected class?
Try the experiment.

>why all exception classes implementing the serialzible interface?
It was possibly for a program like Lotus Ensuite, that could save the
program state, do something else, then pick up where it left off.  It
used serialisation to encapsulate the entire state of the app.
The other reason is it was easy to do.  Exceptions don't have much
inside them.

>what is the difference between the "A class by defaultly
>synchronized(Vector)" and "A class which is manuvally synchronized"?
It is the difference between using Vector and ArrayList+
Collections.synchronizedCollection( a ); 

or Hashtable and HashMap + Collections.synchronizedCollection( a );

or doing the threading manually, only where needed.

see http://mindprod.com/jgloss/arraylist.html#THREADSAFETY

Normally you have onely one thread, so there is no point in the sync
overhead.
-- 

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#205

From"=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this>
Date2011-04-27 15:22 +0000
Message-ID<4873d90a$0$90266$14726298@news.sunsite.dk>
In reply to#203
  To: comp.lang.java.databases
amarmca2u@gmail.com wrote:
> what we call a concrete class in java api with out constructors(Like
> DriverManager)?

DriverManager only expose static members so you could not do much
by constructing one.

You can not. Not because it does not have a constructor - that is not
possible - even if you do not create one because then it will
get the default. But because SUN has made the constructor private.
Small service to prevent programmers from doing silly things.

> detail data about protected constructor. Can we have protected class?

Top level : no

Sub class : yes

> why all exception classes implementing the serialzible interface?

Because they will often be send over the wire for remote calls
like RMI and remote EJB calls.

> what is the difference between the "A class by defaultly
> synchronized(Vector)" and "A class which is manuvally synchronized"?

The first is thread safe for single calls out of the box (but not for
many real world situations). For the latter you need to do something
typical Collections synchronizedXxxx for single call or more practical
synchronized on something to make more than one call safe just like you
have to for the first.

Arne

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#206

From"Lew" <lew@THRWHITE.remove-dii-this>
Date2011-04-27 15:22 +0000
Message-ID<feOdnUVQbeKsounVnZ2dnUVZ_gSdnZ2d@comcast.com>
In reply to#205
  To: comp.lang.java.databases
amarmca2u@gmail.com wrote:
>> what is the difference between the "A class by defaultly
>> synchronized(Vector)" and "A class which is manuvally synchronized"?

Arne Vajh|+j wrote:
> The first is thread safe for single calls out of the box (but not for
> many real world situations). For the latter you need to do something
> typical Collections synchronizedXxxx for single call or more practical
> synchronized on something to make more than one call safe just like you
> have to for the first.

There are, of course, other differences between Vector and another List 
implementation like ArrayList (its closest true-collections cousin) besides 
that one has its methods synchronized for you and other does not.

-- 
Lew

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.databases


csiph-web