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