biz.hammurapi.jms
Class JmsSliceConsumer

java.lang.Object
  extended by biz.hammurapi.jms.JmsSliceConsumer
All Implemented Interfaces:
biz.hammurapi.config.Component, biz.hammurapi.metrics.SliceConsumer
Direct Known Subclasses:
JmsDestinationSliceConsumer, JmsQueueSliceConsumer, JmsTopicSliceConsumer

public abstract class JmsSliceConsumer
extends java.lang.Object
implements biz.hammurapi.metrics.SliceConsumer, biz.hammurapi.config.Component

Collects slices for a period of time and send them as JMS text message with XML payload.

Author:
Pavel Vlasov

Field Summary
protected  long interval
           
protected  java.util.Timer timer
           
 
Constructor Summary
JmsSliceConsumer(java.util.Timer timer, long interval)
           
 
Method Summary
 boolean consumeSlice(java.lang.String category, biz.hammurapi.metrics.Slice slice)
           
protected  java.lang.String getSlicesXml()
          Converts accumulated slices to XML.
 void setOwner(java.lang.Object owner)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timer

protected java.util.Timer timer

interval

protected long interval
Constructor Detail

JmsSliceConsumer

public JmsSliceConsumer(java.util.Timer timer,
                        long interval)
Parameters:
timer - Timer to use for scheduling. If null than internal timer is created.
interval - Send interval.
Method Detail

consumeSlice

public boolean consumeSlice(java.lang.String category,
                            biz.hammurapi.metrics.Slice slice)
Specified by:
consumeSlice in interface biz.hammurapi.metrics.SliceConsumer

getSlicesXml

protected java.lang.String getSlicesXml()
                                 throws java.io.IOException,
                                        javax.xml.transform.TransformerException,
                                        javax.xml.parsers.ParserConfigurationException
Converts accumulated slices to XML. Clears internal slices map.

Returns:
Slices in XML format.
Throws:
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

start

public void start()
           throws biz.hammurapi.config.ConfigurationException
Specified by:
start in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException

stop

public void stop()
          throws biz.hammurapi.config.ConfigurationException
Specified by:
stop in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException

setOwner

public void setOwner(java.lang.Object owner)
Specified by:
setOwner in interface biz.hammurapi.config.Component


Copyright © 2006 Hammurapi Group. All Rights Reserved.