aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "threads" Watch "threads" New topic
Author

threads

vipin bhatia
Ranch Hand

Joined: Jul 14, 2001
Posts: 31
I am dissapointed no one has even tried answering my question with the subject "wait and notify with classes" can someone help me since i have my jcp on 2nd of august. i tried looking through the API, java tutorials, java language specifications but no one has mentioned how to deal with it.
help!


Sun Certified Programmer for Java2 Platform scored 100%.
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi Vipin,
What's your question on wait and notify?I normally see to it that none of the posts in this forum go unanswered.I will try my best to answer your question
-- Sandeep
SCJP2,OCSD(Oracle JDeveloper),OCED(Oracle Internet Platform)


<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
vipin bhatia
Ranch Hand

Joined: Jul 14, 2001
Posts: 31
Hi! Sandeep,
My question was ->
I have a class with two static synchronized methods so they
will use the lock of the class right? Now if i want to use
wait and notify from within these methods, i can not because
they are non static methods being called from static
methods.
Is thier anyway this can be solved, i.e. imagining a Queue
problem where add and remove are static menthods working on
static array.
How can we synchronize the producer and consumer on the lock
of the class using wait and notify.
hope me not repeating some recently asked question if so
kindly point me towards it.
thnx.
I have finally found out that this can be solved by using MyClass.class.notify() & MyClass.class.wait() but there is no mention of this Class literal class in the API, can you guide me where can i find more info on it..
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Class is a regular Java class in the java.lang package.
Bill
Ragu Sivaraman
Ranch Hand

Joined: Jul 20, 2001
Posts: 464
Batia,
If you refer java.lang API tree you will see Class
Class inherits from Object there by you get wait and notify.
Class has no public constructor. Instead Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class loader
So its already there for use.

HTH
vipin bhatia
Ranch Hand

Joined: Jul 14, 2001
Posts: 31
guys what i was asking was not about the class "Class" but the literal "class" which is a class literal but i guess the right person to answer would be jim yingst go gave me this answer in the first place in the discussion group of jchq.net.
anyways i wrote my jcp today and scored 100%.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: threads