|
From: Leif M. <le...@ta...> - 2003-09-03 14:51:14
|
Sal,
I liked this idea. It has been implemented and will be in the 3.0.5
release.
I wrote up some docs for the JBoss case, but still need to do so for the
Sun JMX RI example. If you have any ideas for the docs, please let me know.
The new code and existing docs are now all checked into CVS, if you
want to
try checking them out and do some testing, I would appreciate it. Also
if you have
any comments on the published API, before the release is the time to get any
changes in. Note that the public CVS is currently running 24 hours behind.
I also placed a pair of source snapshots up on my server if you prefer.
(They are not 24 hours behind :-)
http://wrapper.tanukisoftware.org/tmp/wrapper_3.0.5b_src_with_doc_src.tar.gz
http://wrapper.tanukisoftware.org/tmp/wrapper_3.0.5b_src_with_doc_src.zip
The new docs are at /doc/english/jmx.html
Cheers,
Leif
Sal Ingrilli wrote:
>Leif:
>
>I saw the previous posting on WrapperActionServer and find this to be
>relevant.
>
>We all know that one of the most important features of the wrapper is to
>dump threads.
>This is especially useful when running as a service, otherwise you basically
>can't do it (1).
>
>But how do you tell the wrapper to dump threads? I was faced with this
>issue before I had the wrapper server came about.... so here is what I did.
>
>I developed a jmx-mbean that proxies calls to the WrapperManager. I chose
>to write a jmx-mbean in order to code this only once and be able to deploy
>it to different environments.
>
>The mbean is made of these 2 java files, which need to be located in the
>same directory (2).
>
>[WrapperManagerMBean.java]
>package com.syncvoice.commons.silveregg.wrapper.jmx;
>public interface WrapperManagerMBean {
> String getBuildTime ();
> int getJVMId ();
> String getVersion ();
> boolean getHasShutdownHookBeenTriggered ();
> boolean isControlledByNativeWrapper ();
> boolean isDebugEnabled ();
> boolean isLaunchedAsService ();
>
> void restart ();
> void requestThreadDump ();
>}
>
>[WrapperManager.java]
>package com.syncvoice.commons.silveregg.wrapper.jmx;
>import com.syncvoice.commons.silveregg.wrapper.jmx.WrapperManagerMBean;
>public class WrapperManager implements WrapperManagerMBean {
>
> public String getBuildTime () { return
>org.tanukisoftware.wrapper.WrapperManager.getBuildTime (); }
> public int getJVMId () { return
>org.tanukisoftware.wrapper.WrapperManager.getJVMId (); }
> public String getVersion () { return
>org.tanukisoftware.wrapper.WrapperManager.getVersion (); }
> public boolean getHasShutdownHookBeenTriggered () { return
>org.tanukisoftware.wrapper.WrapperManager.hasShutdownHookBeenTriggered (); }
> public boolean isControlledByNativeWrapper () { return
>org.tanukisoftware.wrapper.WrapperManager.isControlledByNativeWrapper (); }
> public boolean isDebugEnabled () { return
>org.tanukisoftware.wrapper.WrapperManager.isDebugEnabled (); }
> public boolean isLaunchedAsService () { return
>org.tanukisoftware.wrapper.WrapperManager.isLaunchedAsService (); }
>
> public void restart () { org.tanukisoftware.wrapper.WrapperManager.restart
>(); }
> public void requestThreadDump () {
>org.tanukisoftware.wrapper.WrapperManager.requestThreadDump (); }
>}
>
>As you can see to write an mbean all you do is write an interface and
>implement it.
>No libraries to import and no custom interfaces to implement.
>The mbean i developed is nothing but a proxy into the WrapperManager.
>
>Now all you do is add a couple lines of configuration to your jmx-aware
>application, and you can point a browser to
>http://localhost/jmx-console (for JBoss)
>or
>http://localhost:8082 (default jmx listening port when using the sun jmx-ri)
>
>You'll get a UI that allows you to look at all the mbeans.
>For each mbean, you can see its attributes, which are any mbean functions
>that starts with get ().
>For each mbean, you can invoke its operations, which are any non-get*/set*
>method.
>
>But how do you publish an mbean in a jmx-aware application?
>In a JBoss environment, for example, take the following file and put it in
>the JBoss deploy folder (3).
>[wrapper-service.xml]
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE server>
><server>
><classpath archives="wrapper.jar" codebase="../../lib"/>
><mbean code="com.syncvoice.commons.silveregg.wrapper.jmx.WrapperManager"
>name="Adaptor:protocol=SilverEggWrapper"/>
></server>
>
>In JBoss, this file represents a service, and JBoss will hot-deploy it. Now
>to test it:
>1. point a browser to http://localhost/jmx-console
>2. click on the wrapper mbean
>3. click "requestThreadDump"
>4. Look into jboss_home/logs/wrapper.log for your thread dump!
>
>In addition to the HTTP based interface, there are a ton of other
>already-built interfaces, such as SNMP, sockets, SOAP, RMI, JMS, etc, which
>allow you to invoke mbean methods, which means that you can get to the
>wrapper manager from just as many different places.
>So now, simply by providing an mbean for the wrapper manager, i could do
>crazy things such as have my site monitoring software issue a wrapper
>restart through the RMI interface.
>
>Leif, if you want to add this functionality, i'll gladly test it out for
>you.
>
>Sal.
>
>(1) Actually, you kind of can: some people use nohup in unix..., but you
>gotta know the side effects.....
>(2) I developed this when the wrapper was still in the "silveregg" package.
>(3) wrapper.exe goes in jboss/bin, wrapper.dll and wrapper.jar go in
>jboss/lib
>
>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: VM Ware
>With VMware you can run multiple operating systems on a single machine.
>WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
>at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
>_______________________________________________
>Wrapper-user mailing list
>Wra...@li...
>https://lists.sourceforge.net/lists/listinfo/wrapper-user
>
>
>
|