On (2003/09/03 07:33), sun zheng wrote: > well, now the target is aim to configure a mbean to warm up those > slsb. However, I still dunno what to do. will you please offer me > a very detail example?
This is very difficult, because I don't know what you need to do. My suggestion would be: 1) Adjust your stateless session beans to offload the expensive lookup operations to a Singleton. For example, they could call a lookup() operation on the Singleton. 2) Provide a warmup method on the Singleton (calling it warmup(), for example), that does the lookup operations in advance and stores the results so that they're available via lookup(). 3) Add whatever refresh logic you need, to lookup(), to ensure that data is updated when necessary, but taken from the stored values whenever possible. 4) Now implement an MBean, whose constructor calls its warmup() method. For convenience, you may want to make warmup() available in the interface, so that you can invoke it manually from the jmx-console. An MBean is a "managed bean", part of the Java Management Extensions (JMX) specification. Chapter 2 of the O'Reilly book "Java Management Extensions" provides an excellent introduction to writing your first MBean. I downloaded chapter 2 of this book from somewhere, but can't remember where. I've been sloppy with my notes lately. :-( You can view the book online if you have a safari.oreilly.com subscription. If you don't have a subscription, you may be able to view the book anyway with a 14 day trial. Note that, for this to work, your MBean and your SLSB must run in the same container. 5) Create a jboss service descriptor for your MBean and place the descriptor in server/default/deploy. This is where you might the most difficulty, because documentation isn't free. I've attached a simple example of one of my MBean descriptors in the deploy directory. In your case, I don't think you need to worry about dependencies. Just make sure that the jar containing your singleton is in server/default/lib, so that it's available to both your EJB and your MBean. Note that I am _not_ a J2EE expert. I just hate to see people getting frustrated because they can't explain what they want to the satisfaction of the experts[1]. You may get better advice from someone else. Good luck! Ciao, Sheldon. [1] Note to the experts; I know what it's like on your side of the fence as well. This isn't a dig at you. ------ abmaildelivery-service.xml ------ <?xml version="1.0" encoding="UTF-8"?> <!-- ===================================================================== --> <!-- --> <!-- SecretProject MailDelivery config --> <!-- --> <!-- ===================================================================== --> <!-- $Id: abmaildelivery-service.xml,v 1.1 2003/07/26 14:03:53 sheldonh Exp $ --> <server> <mbean code="com.secret.proc.mailer.MailDelivery" name="secret:service=abMaildelivery"> <!-- We'll need a dependency on the MBean for the abMailSenderTopic when I figure out how to query it. <depends>secret:service=???</depends> --> </mbean> </server> ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user