Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Problem in synchronization of thread

  Asked By: Jesse    Date: Jul 07    Category: Java    Views: 441
  

i have two classes by name util and retrieve.in the retrieve.java, i
have invoked the code to fetch the data from database by its
name.for
fetching multiple datas i need to synchronize the call to database.i
tried
but i didn't get it,i will paste the code.ANYONE PLZ HELP IN SLOVING
THIS.

Util.java
**********
public class util
{
if(!(new File(win).exists()) && retrieved )
{
retrieved = false;
Retriever r = new Retriever(curr_page,panel);
thr = new Thread(wr);
thr.start
();

}
}
Retrieve.java
*********
public class Retrieve implements Runnable
{
public Retrieve(WebWindows currpage,ControlPanel panel)
{
this.eventname=currpage.geteventname;
}
public synchronized void run()
{
this.checkEventFiles();
Thread.yield();
retrieveEventFromDB(eventname));
}
}

while doing so,when we are about to fetch two events,the call to
first
one is made,and it also the second one also to run instead of
waiting
for the first one to complete.PLZ help me with this problem

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Problem in synchronization of thread Or get search suggestion and latest updates.




Tagged: