axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thilina Gunarathne" <cset...@gmail.com>
Subject Re: [Axis2] Management Interface - Counting requests
Date Sat, 25 Feb 2006 04:52:37 GMT
You can use MessageContext injection to access the context hierachy within a
service.

public class .....Skeleton {

private MessageContext msgContext;

   public void init(MessageContext context) {

         this.msgContext = context;

   }

   public OMElement XXOperation(OMElement requestElement) {

   msgContext.getServiceContext().getConfigurationContext());

   ........

   }
}

It's much more straight forward when using a handler....

HTH,
~Thilina

On 2/24/06, Chathura Ekanayake <cce.axis@gmail.com> wrote:

>
> Hi,
>
> Let me explain why I thought of using singleton. This is a simple
> example of dynamic statistics monitoring in the management interface. This
> is for monitoring total requests for an engine.
>
> - A handler of a globally engaged module increments a count at each
> invocation.
>
> - Webservice deployed in the same Axis2 engine provides a
> getTotalRequests() method to check the current value of the count.
>
> - Same count variable should be accessible from a MBean, which exposes it
> as an attribute.
>
> - Both Webservice and MBean should be able to set the count to zero.
>
> In this scenario same count variable has to be accessed by three objects:
> handler, webservice and MBean. So I thought of using a singleton object
> which stores this variable. Therefore all other objects can get a reference
> to it.
>
> If we can store this information in the configeration context and access
> it form any object, we can use context instead of sigleton.
>
> How can I access the configuration context within a web service? And where
> in the configuration context should I store information? I think we
> have to store an object which contains all the information.
>
> Another approach I thought of is to store the information in an object and
> register it in the MBeanServer. So that all other objects can access it
> from the MBeanServer by providing its name. This approach would give us all
> feathers of using the singleton method, but without having to make our
> objects singleton.
>
> Any suggestions....
>
> Thanks,
>
> Chathura.
>
>
>
>



--
"May the SourcE be with u"
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/
http://www.bloglines.com/blog/Thilina

Mime
View raw message