|
Project JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.endpoint.QuotaIncomingMessageListener
public class QuotaIncomingMessageListener
A wrapper around an EndpointListener which imposes fair sharing quotas.
NOTE: 20020526 jice There would be great value in making such an object the explicit interface between the endpoint and its clients, rather than a bland listener interface The client would have the ability to specify the threads limit, possibly setting it zero, and then could have access to the buffer. To implement that with a simple listener would mean that the endpoint has to TRUST the client that the listener does no-more than queuing and signaling or else, force a full and possibly redundant hand-shake in all cases, as is the case now. To be improved.
Nested Class Summary | |
---|---|
(package private) static class |
QuotaIncomingMessageListener.ListenerThread
The thread which services removing items from the queue |
(package private) static class |
QuotaIncomingMessageListener.MessageFromSource
An incoming message in the queue with its addresses and accounting |
(package private) static class |
QuotaIncomingMessageListener.MyCacheListener
A canonical mapping of all the message originators. |
Field Summary | |
---|---|
(package private) static int |
GmaxMsgSize
Max guaranteed supported message size (bytes). |
(package private) static int |
GmaxResPerSender
Every sender account can over allocate up to 5 messages worth of queue size if the space is available. |
(package private) static int |
GmaxSenders
Max guaranteed senders (integer). |
(package private) static int |
GminResPerSender
Every sender account will always be granted 2 messages worth of queue size. |
(package private) static int |
MaxExtraPerSender
There is a limit to the amount of on-the-fly that a single sender can hog. |
(package private) static int |
NeverReserved
There is a part of the non-reserved resources that we will never use for reservation by senders in excess of GmaxSenders even if the number of accounts is way beyond the max garaunteed. |
(package private) static int |
TotalExtra
Additional resources in reserve, to be allocated on the fly. |
Constructor Summary | |
---|---|
QuotaIncomingMessageListener(String name,
EndpointListener listener)
Constructor for the QuotaIncomingMessageListener object |
|
QuotaIncomingMessageListener(String name,
EndpointListener listener,
InboundMeter incomingMessageListenerMeter)
Constructor for the QuotaIncomingMessageListener object |
Method Summary | |
---|---|
void |
close()
Close this listener and release all of its resources. |
QuotaIncomingMessageListener |
doOne()
process one message and move on. |
EndpointListener |
getListener()
Gets the listener attribute of the QuotaIncomingMessageListener object |
void |
processIncomingMessage(Message message,
EndpointAddress srcAddr,
EndpointAddress dstAddr)
Try to give a new thread for this message (this listener). |
String |
toString()
Returns our name |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static int GmaxMsgSize
static int GmaxSenders
static int GminResPerSender
static int GmaxResPerSender
static int TotalExtra
static int MaxExtraPerSender
static int NeverReserved
Constructor Detail |
---|
public QuotaIncomingMessageListener(String name, EndpointListener listener)
name
- a unique name for this listenerlistener
- the recipient listener.public QuotaIncomingMessageListener(String name, EndpointListener listener, InboundMeter incomingMessageListenerMeter)
name
- a unique name for this listenerlistener
- the recipient listener.incomingMessageListenerMeter
- metering handler.Method Detail |
---|
public String toString()
toString
in class Object
public EndpointListener getListener()
public void close()
public QuotaIncomingMessageListener doOne()
public void processIncomingMessage(Message message, EndpointAddress srcAddr, EndpointAddress dstAddr)
processIncomingMessage
in interface EndpointListener
|
JXTA J2SE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |