Hi Oleg

Sure, will open two bugs for these.. also I think your guess is correct as I found a workaround just now..  you can take your time to evaluate these issues and fix them, as I am making local changes on my code for now.

thanks
asankha

Oleg Kalnichevski wrote:
On Fri, 2007-01-12 at 23:26 +0530, Asankha C. Perera wrote:
  
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("www.yahoo.com", 80),
            null,
            new HttpHost("www.yahoo.com"));

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..

    

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



  
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


    


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to