Closed: (NETTY-85) Global Channel registry

Frederic Bregier fredbregier at free.fr
Tue Dec 2 01:36:35 EST 2008


Hi Trustin,

Hmm, I didn't think about the asynchronous aspect of the close operation.
Thanks for pointing this!

Well, I thing you're right with proposing a blocking close request.
So I think that users should use at least two groups, one for the
parent, and one for the childs, and then waiting for the first to
be really closed before asking the second to close. That's one option.
These options should be explicitely written in the doc. WDYT ?

Another possibility would be to have the group having two kind of
list of channels int it, using the getParent() method.
If the getParent() returns null, it is a parent, if not, it is a child.
Then when one asked the group to close, it first closes the parent
with blocking close, then closes the others channel as usual.
For instance:

ChannelGroup g = ChannelGroupFactory.getGroup("myService");

g.add(parenntChannel);
g.add(myChannel1);
g.add(...);

ChannelGroupFuture f = g.close(); => will close in blocking way parent, then
child
f.awaitUninterruptibly(); => wait for children only

if (f.isCompleteSuccess()) {
    // yay on child
} else if (f.isPartialSuccess()) {
    // oops on child
} 

So that, even if a user makes two groups (one for parent,
one for childs), it will block when calling close on the group
of parent (awaitUninterruptibly returns immediately).
WDYT ?

Frederic

-----
Hardware/Software Architect
-- 
View this message in context: http://n2.nabble.com/-JBoss-JIRA--Created%3A-%28NETTY-85%29-Global-Channel-registry-tp1592324p1602610.html
Sent from the Netty Developer Group mailing list archive at Nabble.com.




More information about the netty-dev mailing list