public class Channel<T extends org.xmpp.packet.Packet> extends Object
As a request is handled by the system, it will travel through a sequence of channels. This architecture has a number of advantages:
Channels are modeled after SEDA stages. For much much more in-depth architecture information, refer to the SEDA website.
Constructor and Description |
---|
Channel(String name,
ChannelHandler<T> channelHandler)
Creates a new channel.
|
Modifier and Type | Method and Description |
---|---|
void |
add(T packet)
Enqueus a message to be handled by this channel.
|
int |
getMaxThreadCount()
Returns the max number of threads the channel will use for processing messages.
|
int |
getMinThreadCount()
Returns the min number of threads the channel will use for processing messages.
|
String |
getName()
Returns the name of the channel.
|
int |
getQueueSize()
Returns the current number of ChannelMessage objects waiting to be processed by
the channel.
|
int |
getThreadCount()
Returns the number of currently active worker threads in the channel.
|
boolean |
isRunning()
Returns true if the channel is currently running.
|
void |
setMaxThreadCount(int maxThreadCount)
Sets the max number of threads the channel will use for processing messages.
|
void |
setMinThreadCount(int minThreadCount)
Sets the min number of threads the channel will use for processing messages.
|
void |
start()
Starts the channel, which means that worker threads will start processing messages
from the queue.
|
void |
stop()
Stops the channel, which means that worker threads will stop processing messages from
the queue.
|
public Channel(String name, ChannelHandler<T> channelHandler)
name
- the name of the channel.channelHandler
- the handler for this channel.public String getName()
public void add(T packet)
packet
- an XMPP packet to add to the channel for processing.public boolean isRunning()
public void start()
public void stop()
public int getThreadCount()
public int getMinThreadCount()
public void setMinThreadCount(int minThreadCount)
minThreadCount
- the min number of threads that can be used by the channel.public int getMaxThreadCount()
public void setMaxThreadCount(int maxThreadCount)
maxThreadCount
- the max number of threads that can be used by the channel.public int getQueueSize()
Copyright © 2003-2008 Jive Software.