if you are using J2EE stack,
since you can not use synchronized keyword in EJB components,
you have to do it in other ways, here is one of them:
then use a statefull session bean for doing this task.
put a boolean variable in your bean,
in statefull session bean check this boolean variable before starting the task and set its value
look at this example:
public Class MySFSB .... {
...
boolean isBusy = false;
...
public myMethod(...) {
if (isBusy) {
// throw exception or do some thing else like just returning from method
return;
}
isBusy = true;
// now do your job
....
....
isBusy = false;
}