java - Netty channelAcquired is not getting called -
i'm using netty channel pool http client , in channelpoolhandler
implementation channelacquired
not getting called when channelpool.acquire()
invoked. i'm using netty 4.0.32.final
. here's how created chanelpool. followed simple example listed @ netty.io. if can explain i've done wrong or if there bug that'll helpful. thanks.
eventloopgroup group = new nioeventloopgroup(); final bootstrap b = new bootstrap(); b.group(group).channel(niosocketchannel.class); abstractchannelpoolmap<inetsocketaddress, simplechannelpool> poolmap = new abstractchannelpoolmap<inetsocketaddress, simplechannelpool>() { @override protected simplechannelpool newpool(inetsocketaddress key) { return new simplechannelpool(b.remoteaddress(key), new httpclientpoolhandler()); } }; final simplechannelpool simplechannelpool = poolmap.get(new inetsocketaddress(uri.gethost(), uri.getport())); final future<channel> acquire = simplechannelpool.acquire(); acquire.addlistener(new futurelistener<channel>() { public void operationcomplete(future<channel> f) throws exception { if (f.issuccess()) { final channel ch = f.getnow(); // send http request. channelfuture channelfuture = ch.writeandflush(request); channelfuture.addlistener(new channelfuturelistener() { public void operationcomplete(channelfuture channelfuture) throws exception { if (channelfuture.issuccess()) { simplechannelpool.release(ch); } else { } } }); } else { system.out.println("error : " + f.cause()); } } });
the channelacquired
method called if "acquire" previous created channel. in case there not channel yet in pool call channelcreated
.
Comments
Post a Comment