Hi,

On Mon, Feb 25, 2013 at 4:24 AM, Felix Meschberger <[email protected]>wrote:

> Hi,
>
> Am 22.02.2013 um 23:59 schrieb Ian Boston:
>
> >
> > Implementation
> > * MBeans are not that hard to implement with the OSGi Whiteboard, but
> > they have to be implemented.
>
> Right. Everyhting that has to be queried has to be implemented. The actual
> problem I see, is that a separate API is required, which in turn is good
> programming style anyway when doing services. Yet this API does not need to
> be exported because the JMX Whiteboard gets to it through the MBean service
> class (IIRC).
>

The MBean API does not *need* to be exported but it *should* be exported so
that client applications can use it if they want to.

Justin


>
> >
> > Alternatives.
> > In Jackarabbit there is/was a statistics class [1], which IIUC uses
> > counters and time series stored in a map. The service can then be
> > queries to extract the values by wrapping in an MBean or Servlet.
>
> The only advantage over direct JMX I see, is the Servlet wrapping
> (probably the Web Console in our case ?). How common is that use case ?
>
> And even then I would prefer a good DTO design over just a "counter map".
>
> The StatisticsUtil class is IMHO overkill.
>
> Regards
> Felix
>
> >
> > I think the approach could be generalised and extended so that
> > anything in the container could use the service to record metrics. The
> > api might look something like
> >
> > public interface Statistics {
> >
> >      /**
> >       * Increment a counter by 1
> >       */
> >      void increment(String counterName);
> >
> >      /**
> >       * Record a double value in a timeseries.
> >       */
> >      void record(String timeSeriesName, double value);
> >
> >      /**
> >       * Record a long value in a timeseries.
> >       */
> >      void record(String timeSeriesName, long value);
> >
> > }
> >
> > and (so that any reference can be optional on a service
> > implementation, the final is a hint to hotspot to inline)
> >
> > public final class StatisticsUtils {
> >
> >  private StatisticsUtils() {
> >  }
> >
> >  public static void increment(Statistics statistics, String counterName)
> {
> >     if ( statistics != null ) {
> >         statistics.increment(counterName);
> >     }
> >  }
> >
> > ... etc for the other methods ..
> > }
> >
> >
> >
> >
> > The service would need to deal with all the implementation details
> > (including concurrency and speed). The service implementation would
> > also come with a servlet endpoint (under /system/*) and/or single JMX
> > MBean.
> >
> > Anything that wanted to record stats would then bind to the service
> > and use it. I think this would avoid the issues mentioned above with
> > wide scale MBean usage.
> >
> > WDYT?
> >
> > (apologies for the noise if this already exists, and if so, please
> > treat it as a question: where and how do we record stats?)
> >
> > Ian
> >
> >
> >
> >
> > 1 http://wiki.apache.org/jackrabbit/Statistics
>
>
> --
> Felix Meschberger | Principal Scientist | Adobe
>
>
>
>
>
>
>
>

Reply via email to