Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBHow to get a default value for a stateless EJB (2.0)?  RSS feed

Klament J. Kruoghst
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there, I have a stateless session bean that sends a message to a queue.

The messages can be sent with a delay so I'm setting the default delay to -1 (no delay) and i have a setter and getter for it defined too.

One type of message has a delay of X seconds, all others use its default. So when I'm calling the bean i:

local = localHome.create();
local.sendMessage("my message");
} finally {

The other calls go the same but without the setDelay call. The problem is that this delay doesn't seem to be setting. For instance if I don't set a delay it's going to pick the delay of the previous call (instead of picking my default delay of -1)

So I guess when the variable is changed by the first call and the bean is put back to the pool with that delay it's changed for the next called so... I tried putting the setDelay to -1 in the ejbCreate() which although it's not called when i do the loca.create(), it is supposed to be triggered when a business method is called so I thought would be triggered by the local.sendMessage() but the same thing is happening. I read that even when you call local.remove() it doesn't mean ejbRemove() will be called so I can't use that either, so...

How do I go about receiving a default value for a Stateless session bean each time it's called?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!