hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Asankha C. Perera" <asan...@wso2.com>
Subject Re: Using NIO extensions for a client
Date Fri, 12 Jan 2007 18:17:02 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Oleg<br>
<br>
Sure, will open two bugs for these.. also I think your guess is correct
as I found a workaround just now..&nbsp; you can take your time to evaluate
these issues and fix them, as I am making local changes on my code for
now.<br>
<br>
thanks<br>
asankha<br>
<br>
Oleg Kalnichevski wrote:
<blockquote cite="mid1168625459.4988.50.camel@okhost" type="cite">
  <pre wrap="">On Fri, 2007-01-12 at 23:26 +0530, Asankha C. Perera wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi

I would like to write a non-blocking client based on the NIO extensions, 
but encounter an issue, which could be reproduced with a modified 
NHttpClient example code as follows:

I want to start off a ConnectingIOReactor, and leave it running 
continuously. Now, whenever I want to send a request through this 
reactor, I would want to execute something like
    ioReactor.connect(
            new InetSocketAddress("<a class="moz-txt-link-abbreviated" href="http://www.yahoo.com">www.yahoo.com</a>",
80),
            null,
            new HttpHost("<a class="moz-txt-link-abbreviated" href="http://www.yahoo.com">www.yahoo.com</a>"));

However, if I execute the above before I execute 
ioReactor.execute(ioEventDispatch), i.e position 1, then everything 
works fine. If I try it after (i.e. position 2) the outcome is 
unpredictable - i.e. works sometimes, NPE, etc..

    </pre>
  </blockquote>
  <pre wrap=""><!---->
Hi Asankha,

This seems to suggest a threading / synchronization problem. Could you
please open a report for this issue in JIRA and attach the NPE stack
trace? 

Could also please open a report in JIRA for the previous bug you
discovered?

I'll look into these issues during the weekend.

Oleg



  </pre>
  <blockquote type="cite">
    <pre wrap="">It is not clear to me why connecting to the reactor after its execute()

method is invoked should be any different..?

thanks
asankha

public static void main(String[] args) throws Exception {
        HttpParams params = new DefaultHttpParams(null);
        .....
        NHttpClientHandler handler = new MyNHttpClientHandler(params);
        final IOEventDispatch ioEventDispatch = new 
DefaultClientIOEventDispatch(handler, params);

        // position 1       
       
        Thread t = new Thread(new Runnable() {
            public void run() {
                try {
                    ioReactor.execute(ioEventDispatch);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        );
        t.start();

        // position 2
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:httpcomponents-dev-unsubscribe@jakarta.apache.org">httpcomponents-dev-unsubscribe@jakarta.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:httpcomponents-dev-help@jakarta.apache.org">httpcomponents-dev-help@jakarta.apache.org</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->

---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:httpcomponents-dev-unsubscribe@jakarta.apache.org">httpcomponents-dev-unsubscribe@jakarta.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:httpcomponents-dev-help@jakarta.apache.org">httpcomponents-dev-help@jakarta.apache.org</a>



  </pre>
</blockquote>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message