-
.wait() and .notify() methods in multithreading
pls let me know if anyone of you have any idea as to how to use
.wait() and .notify() methods in multithreading...
pls send me an example code...if u have I am trying use that and it is not
working....
pls see the code below....
-----------------------------CLASS 1---------------------------------------
if (response == JOptionPane.YES_OPTION)
{
depotVersion = JOptionPane.showInputDialog(parent,
"Please enter the depotVersion:" /*13A*/);
txtDisplay.append("Performing the OAM Upgrade " +
'\n');
// get ats connection, prepare data and send it
txtOAMVersion.setText(" ");
synchronized(syncObj)
{
try
{
callInvokeOAMUpgrade();
syncObj.wait();
new FireCurrentVersion();
}
catch (Exception e) {txtDisplay.append(e.toString());}
}
}
else if (response == JOptionPane.NO_OPTION)
{
txtDisplay.append(" OAM Upgrade cancelled" + '\n');
}
btnOAMRollback.setEnabled(true);
btnOAMUpgrade.setEnabled(true);
---------------------------------------------------------------------------------------------------------------
----------------------CLASS 2---------------------------------------------------------------
class FireCurrentVersion extends Thread
{
FireCurrentVersion()
{
this.start();
}
public void run()
{
synchronized(syncObj)
{
try
{
callCurrentVersion();
syncObj.notify();
}
catch (Exception e) { txtDisplay.append(e.toString()); }
}
}
}
-------------------------------------------------------------------------------------------------
-
Re: .wait() and .notify() methods in multithreading
http://java.sun.com/docs/books/tutor...AndNotify.html
--
Randy Charles Morin
Author of Programming Windows Services
http://www.kbcafe.com
Feel free to contact me by private email or messenger
MSN Messenger - morin_randy@hotmail.com
Yahoo Messenger - randymorin@yahoo.com
"SATISH" <satish_141@yahoo.com> wrote in message
news:3c04f6ad@147.208.176.211...
>
> pls let me know if anyone of you have any idea as to how to use
>
> wait() and .notify() methods in multithreading...
>
> pls send me an example code...if u have I am trying use that and it is not
> working....
>
> pls see the code below....
>
> -----------------------------CLASS
1---------------------------------------
>
> if (response == JOptionPane.YES_OPTION)
> {
> depotVersion = JOptionPane.showInputDialog(parent,
> "Please enter the depotVersion:" /*13A*/);
> txtDisplay.append("Performing the OAM Upgrade " +
> '\n');
> // get ats connection, prepare data and send it
> txtOAMVersion.setText(" ");
>
> synchronized(syncObj)
> {
> try
> {
> callInvokeOAMUpgrade();
> syncObj.wait();
> new FireCurrentVersion();
> }
> catch (Exception e)
{txtDisplay.append(e.toString());}
> }
>
>
> }
>
> else if (response == JOptionPane.NO_OPTION)
> {
> txtDisplay.append(" OAM Upgrade cancelled" +
'\n');
> }
> btnOAMRollback.setEnabled(true);
> btnOAMUpgrade.setEnabled(true);
>
> --------------------------------------------------------------------------
-------------------------------------
>
> ----------------------CLASS
2---------------------------------------------------------------
> class FireCurrentVersion extends Thread
> {
>
> FireCurrentVersion()
> {
> this.start();
> }
>
> public void run()
> {
> synchronized(syncObj)
> {
> try
> {
> callCurrentVersion();
> syncObj.notify();
> }
> catch (Exception e) { txtDisplay.append(e.toString()); }
> }
> }
>
> }
>
> --------------------------------------------------------------------------
-----------------------
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks