biz.hammurapi.metrics
Class SocketSliceConsumerServer

java.lang.Object
  extended by biz.hammurapi.metrics.SocketSliceConsumerServer
All Implemented Interfaces:
biz.hammurapi.config.Component

public class SocketSliceConsumerServer
extends java.lang.Object
implements biz.hammurapi.config.Component


Constructor Summary
SocketSliceConsumerServer()
           
 
Method Summary
protected  void consumeException(java.lang.Exception e)
          Consumes exceptions in processing threads.
protected  biz.hammurapi.metrics.SliceConsumer getDelegate()
           
static void main(java.lang.String[] args)
           
protected  void process(java.lang.Runnable job)
          Spawns a new thread for each job.
protected  void process(java.net.Socket socket)
          Spawns a new thread for each socket
protected  void processSlices(java.util.List slices, java.net.InetAddress address, java.lang.String id)
          This method iterates over slices in the batch and sends them to the delegate SliceConsumer returned by getDelegate() method.
 void setOwner(java.lang.Object owner)
           
 void setPort(int port)
          Set server listening port
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketSliceConsumerServer

public SocketSliceConsumerServer()
Method Detail

setPort

public void setPort(int port)
Set server listening port

Parameters:
port -

setOwner

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

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

getDelegate

protected biz.hammurapi.metrics.SliceConsumer getDelegate()
Returns:
SliceConsumer to delegate processing. This class returns ConsoleSliceConsumer. Subclasses can override this method.

processSlices

protected void processSlices(java.util.List slices,
                             java.net.InetAddress address,
                             java.lang.String id)
This method iterates over slices in the batch and sends them to the delegate SliceConsumer returned by getDelegate() method.

Parameters:
slices - List of slice entries obtained from clients

process

protected void process(java.net.Socket socket)
Spawns a new thread for each socket

Parameters:
socket -

process

protected void process(java.lang.Runnable job)
Spawns a new thread for each job. Override to use thread pools on high loads.

Parameters:
job -

consumeException

protected void consumeException(java.lang.Exception e)
Consumes exceptions in processing threads.

Parameters:
e -

main

public static void main(java.lang.String[] args)
                 throws biz.hammurapi.config.ConfigurationException
Throws:
biz.hammurapi.config.ConfigurationException


Copyright © 2006 Hammurapi Group. All Rights Reserved.