Menu

Concurrency

Help
mattlf
2008-06-16
2013-04-22
  • mattlf

    mattlf - 2008-06-16

    Hi Mike

    I have a question regarding otfeed example HistTick.java

    How do you know that connection is actually initialized when you make the request?

    Should you actually wait that OnLogin returns before you can actually call prepareRequest?

    Thank you

    IConnection connection = Connector.connect();

            try {
                IRequest request = connection.prepareRequest(command);
                request.submit();

                request.waitForCompletion();
            } finally {
                connection.shutdown();
                connection.waitForCompletion();
            }

     
    • Mike Kroutikov

      Mike Kroutikov - 2008-06-16

      Requests will be queued if connection process is not yet completed. So, no need to wait for onLogin() event. However, if login attempt fails, all requests will receive error completion status. In your listing, processing will block at "request.waitForCompletion()" waiting for the login and request completion.

      -Mike

       

Log in to post a comment.

MongoDB Logo MongoDB