Class OutgoingMessageQueueImpl
- java.lang.Object
-
- com.biglybt.pifimpl.local.network.OutgoingMessageQueueImpl
-
- All Implemented Interfaces:
OutgoingMessageQueue
public class OutgoingMessageQueueImpl extends java.lang.Object implements OutgoingMessageQueue
-
-
Field Summary
Fields Modifier and Type Field Description private OutgoingMessageQueue
core_queue
private java.util.HashMap
registrations
-
Constructor Summary
Constructors Modifier Constructor Description protected
OutgoingMessageQueueImpl(OutgoingMessageQueue core_queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deregisterListener(OutgoingMessageQueueListener listener)
Remove registration of queue listener.int
getDataQueuedBytes()
int
getPercentDoneOfCurrentMessage()
int
getProtocolQueuedBytes()
boolean
isBlocked()
void
notifyOfExternalSend(Message message)
Notifty the queue (and its listeners) of a message sent externally on the queue's behalf.void
registerListener(OutgoingMessageQueueListener listener)
Register queue listener.void
sendMessage(Message message)
Queue the given message for sending.void
setEncoder(MessageStreamEncoder encoder)
Set the message stream encoder that will be used to encode outgoing messages.
-
-
-
Field Detail
-
core_queue
private final OutgoingMessageQueue core_queue
-
registrations
private final java.util.HashMap registrations
-
-
Constructor Detail
-
OutgoingMessageQueueImpl
protected OutgoingMessageQueueImpl(OutgoingMessageQueue core_queue)
-
-
Method Detail
-
setEncoder
public void setEncoder(MessageStreamEncoder encoder)
Description copied from interface:OutgoingMessageQueue
Set the message stream encoder that will be used to encode outgoing messages.- Specified by:
setEncoder
in interfaceOutgoingMessageQueue
- Parameters:
encoder
- to use
-
sendMessage
public void sendMessage(Message message)
Description copied from interface:OutgoingMessageQueue
Queue the given message for sending.- Specified by:
sendMessage
in interfaceOutgoingMessageQueue
- Parameters:
message
- to send
-
registerListener
public void registerListener(OutgoingMessageQueueListener listener)
Description copied from interface:OutgoingMessageQueue
Register queue listener.- Specified by:
registerListener
in interfaceOutgoingMessageQueue
- Parameters:
listener
- to register
-
deregisterListener
public void deregisterListener(OutgoingMessageQueueListener listener)
Description copied from interface:OutgoingMessageQueue
Remove registration of queue listener.- Specified by:
deregisterListener
in interfaceOutgoingMessageQueue
- Parameters:
listener
- to remove
-
notifyOfExternalSend
public void notifyOfExternalSend(Message message)
Description copied from interface:OutgoingMessageQueue
Notifty the queue (and its listeners) of a message sent externally on the queue's behalf.- Specified by:
notifyOfExternalSend
in interfaceOutgoingMessageQueue
- Parameters:
message
- sent externally
-
getPercentDoneOfCurrentMessage
public int getPercentDoneOfCurrentMessage()
- Specified by:
getPercentDoneOfCurrentMessage
in interfaceOutgoingMessageQueue
-
getDataQueuedBytes
public int getDataQueuedBytes()
- Specified by:
getDataQueuedBytes
in interfaceOutgoingMessageQueue
-
getProtocolQueuedBytes
public int getProtocolQueuedBytes()
- Specified by:
getProtocolQueuedBytes
in interfaceOutgoingMessageQueue
-
isBlocked
public boolean isBlocked()
- Specified by:
isBlocked
in interfaceOutgoingMessageQueue
-
-