Package 

Class BlockingRequestSender

  • All Implemented Interfaces:
    org.ice4j.ResponseCollector

    
    public class BlockingRequestSender
    extends AbstractResponseCollector
                        

    A utility used to flatten the multi-thread architecture of the Stack and execute the discovery process in a synchronized manner. Roughly what happens here is: ApplicationThread: sendMessage() wait(); StackThread: processMessage/Timeout() { saveMessage(); notify(); }

    • Constructor Detail

      • BlockingRequestSender

        BlockingRequestSender(StunStack stunStack, TransportAddress localAddress)
        Creates a new request sender.
        Parameters:
        stunStack - the stack that the sender should send requests through.
        localAddress - the TransportAddress that requests should be leaving from.
    • Method Detail

      • processResponse

         synchronized void processResponse(StunResponseEvent evt)

        Saves the message event and notifies the discoverer thread so that it may resume.

        Parameters:
        evt - the newly arrived message event.
      • sendRequestAndWaitForResponse

         synchronized StunMessageEvent sendRequestAndWaitForResponse(Request request, TransportAddress serverAddress)

        Sends the specified request and blocks until a response has been received or the request transaction has timed out.

        Parameters:
        request - the request to send
        serverAddress - the request destination address
      • sendRequestAndWaitForResponse

         synchronized StunMessageEvent sendRequestAndWaitForResponse(Request request, TransportAddress serverAddress, TransactionID tranID)

        Sends the specified request and blocks until a response has been received or the request transaction has timed out with given transactionID.

        Parameters:
        request - the request to send
        serverAddress - the request destination address
        tranID - the TransactionID to set for this reuest.