hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Malaka Gallage <mpgall...@gmail.com>
Subject Adding a Callback to Trigger on Reusing a Connection
Date Mon, 10 Nov 2014 12:03:02 GMT
Hello everyone,

I'm using NIO version 4.2.5 and I'm facing a little problem. I have some
operations to be executed on HttpAsyncRequestExecutor#connected and I have
implemented those operations now. But the problem occurs when I use
keepalive connections. I want these operations to be executed on reusing an
established connection from the pool too.

To achieve this, I have added a callback method called onReusingPoolEntry()
to AbstractNIOConnPool which is executed when reusing an established
connection from the pool.

Code :

private boolean processPendingRequest(final LeaseRequest<T, C, E> request) {
..................
........
    if (entry != null) {
        this.available.remove(entry);
        this.leased.add(entry);
        future.completed(entry);
        onReusingPoolEntry(entry);
        return true;
    }
.........
.................
}

protected void onReusingPoolEntry(E entry) {}


I suggest to add this feature to the NIO code base too. WDYT?

Thanks
Malaka

-- 


Regards,



*Malaka GallageSoftware Engineer*


*AdroitLogic Lanka (Pvt) Ltd.*
[image: Facebook] <https://www.facebook.com/malaka.gallage> [image: Twitter]
<http://twitter.com/#%21/MalakaGallage> [image: LinkedIn]
<http://www.linkedin.com/profile/view?id=91872322&trk=tab_pro> [image:
Blogger] <http://swordofpoet.blogspot.com/>
Skype :  malaka.gallage
Mobile : +94 718 796 378

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message