Abstract methods for clarity
This commit is contained in:
parent
b4a05689f0
commit
1de96ae769
|
@ -61,14 +61,34 @@ class EndPointClient<C extends Connection> extends EndPoint<C> implements Runnab
|
||||||
new Thread(this, "Bootstrap registration").start();
|
new Thread(this, "Bootstrap registration").start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// not protected by synchronized
|
||||||
|
private
|
||||||
|
BootstrapWrapper getNextBootstrap() {
|
||||||
|
int bootstrapToRegister = this.connectingBootstrap.getAndIncrement();
|
||||||
|
|
||||||
|
if (bootstrapToRegister == this.bootstraps.size()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.bootstraps.get(bootstrapToRegister);
|
||||||
|
}
|
||||||
|
|
||||||
|
// not protected by synchronized
|
||||||
|
private
|
||||||
|
boolean isRegistrationComplete() {
|
||||||
|
return this.connectingBootstrap.get() == this.bootstraps.size();
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("AutoBoxing")
|
@SuppressWarnings("AutoBoxing")
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
void run() {
|
void run() {
|
||||||
synchronized (this.connectingBootstrap) {
|
synchronized (this.connectingBootstrap) {
|
||||||
int bootstrapToRegister = this.connectingBootstrap.getAndIncrement();
|
BootstrapWrapper bootstrapWrapper = getNextBootstrap();
|
||||||
|
if (bootstrapWrapper == null) {
|
||||||
BootstrapWrapper bootstrapWrapper = this.bootstraps.get(bootstrapToRegister);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ChannelFuture future;
|
ChannelFuture future;
|
||||||
|
|
||||||
|
@ -116,7 +136,7 @@ class EndPointClient<C extends Connection> extends EndPoint<C> implements Runnab
|
||||||
protected
|
protected
|
||||||
boolean registerNextProtocol0() {
|
boolean registerNextProtocol0() {
|
||||||
synchronized (this.connectingBootstrap) {
|
synchronized (this.connectingBootstrap) {
|
||||||
this.registrationComplete = this.connectingBootstrap.get() == this.bootstraps.size();
|
this.registrationComplete = isRegistrationComplete();
|
||||||
if (!this.registrationComplete) {
|
if (!this.registrationComplete) {
|
||||||
registerNextProtocol();
|
registerNextProtocol();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user