com.aelitis.azureus.core.networkmanager
Interface IncomingMessageQueue

All Known Implementing Classes:
IncomingMessageQueueImpl, PeerForeignNetworkConnection.imq

public interface IncomingMessageQueue

Inbound peer message queue.


Nested Class Summary
static interface IncomingMessageQueue.MessageQueueListener
          For notification of queue events.
 
Method Summary
 void cancelQueueListener(IncomingMessageQueue.MessageQueueListener listener)
          Cancel queue event notification listener.
 void destroy()
          Destroy this queue.
 MessageStreamDecoder getDecoder()
           
 int getPercentDoneOfCurrentMessage()
          Get the percentage of the current message that has already been received.
 void notifyOfExternallyReceivedMessage(Message message)
          Notifty the queue (and its listeners) of a message received externally on the queue's behalf.
 int[] receiveFromTransport(int max_bytes, boolean protocol_is_free)
          Receive (read) message(s) data from the underlying transport.
 void registerQueueListener(IncomingMessageQueue.MessageQueueListener listener)
          Add a listener to be notified of queue events.
 void resumeQueueProcessing()
          Manually resume processing (reading) incoming messages.
 void setDecoder(MessageStreamDecoder new_stream_decoder)
          Set the message stream decoder that will be used to decode incoming messages.
 

Method Detail

setDecoder

void setDecoder(MessageStreamDecoder new_stream_decoder)
Set the message stream decoder that will be used to decode incoming messages.

Parameters:
new_stream_decoder - to use

getDecoder

MessageStreamDecoder getDecoder()

getPercentDoneOfCurrentMessage

int getPercentDoneOfCurrentMessage()
Get the percentage of the current message that has already been received.

Returns:
percentage complete (0-99), or -1 if no message is currently being received

receiveFromTransport

int[] receiveFromTransport(int max_bytes,
                           boolean protocol_is_free)
                           throws java.io.IOException
Receive (read) message(s) data from the underlying transport.

Parameters:
max_bytes - to read
Returns:
number of bytes received as [data, protocol]
Throws:
java.io.IOException - on receive error

notifyOfExternallyReceivedMessage

void notifyOfExternallyReceivedMessage(Message message)
                                       throws java.io.IOException
Notifty the queue (and its listeners) of a message received externally on the queue's behalf.

Parameters:
message - received externally
Throws:
java.io.IOException

resumeQueueProcessing

void resumeQueueProcessing()
Manually resume processing (reading) incoming messages. NOTE: Allows us to resume docoding externally, in case it was auto-paused internally.


registerQueueListener

void registerQueueListener(IncomingMessageQueue.MessageQueueListener listener)
Add a listener to be notified of queue events.

Parameters:
listener -

cancelQueueListener

void cancelQueueListener(IncomingMessageQueue.MessageQueueListener listener)
Cancel queue event notification listener.

Parameters:
listener -

destroy

void destroy()
Destroy this queue.