summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
0438567)
Downstream projects may need to customize Bootstrap/ServerBootstrap
instances before they are used. Create two protected methods which
can be overridden to gain access to the instances before they are used.
Change-Id: Ibb45c7b99847cbe2fe8b90e8d1bf125c66a18e0d
Signed-off-by: Robert Varga <rovarga@cisco.com>
});
b.childOption(ChannelOption.SO_KEEPALIVE, true);
});
b.childOption(ChannelOption.SO_KEEPALIVE, true);
+ customizeBootstrap(b);
+
// Bind and start to accept incoming connections.
final ChannelFuture f = b.bind(address);
LOG.debug("Initiated server {} at {}.", f, address);
return f;
// Bind and start to accept incoming connections.
final ChannelFuture f = b.bind(address);
LOG.debug("Initiated server {} at {}.", f, address);
return f;
+ /**
+ * Customize a server bootstrap before the server is created. This allows
+ * subclasses to assign non-default server options before the server is
+ * created.
+ *
+ * @param b Server bootstrap
+ */
+ protected void customizeBootstrap(final ServerBootstrap b) {
+ // The default is a no-op
initializer.initializeChannel(ch, p);
}
});
initializer.initializeChannel(ch, p);
}
});
+
+ customizeBootstrap(b);
+
p.connect();
LOG.debug("Client created.");
return p;
}
p.connect();
LOG.debug("Client created.");
return p;
}
+ /**
+ * Customize a client bootstrap before the connection is attempted. This
+ * allows subclasses to assign non-default options before the client is
+ * created.
+ *
+ * @param b Client bootstrap
+ */
+ protected void customizeBootstrap(final Bootstrap b) {
+ // The default is a no-op
+ }
+
/**
* Creates a client.
*
/**
* Creates a client.
*