Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Rani Singh   on Apr 26 In Java Category.

  
Question Answered By: Vidos Fischer   on Apr 26

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;
}

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Serveral Clicks On a Button Or get search suggestion and latest updates.


Tagged: