The error message "Hostname could not be found in context. HostNamePartitioningStrategy will not work." and variable name "hostname" are weird.
ContextNameKeyingStrategy: <-- problem code
@Override
public void setContext(Context context) {
super.setContext(context);
final String hostname = context.getProperty(CoreConstants.CONTEXT_NAME_KEY);
if (hostname == null) {
addError("Hostname could not be found in context. HostNamePartitioningStrategy will not work.");
} else {
contextNameHash = ByteBuffer.allocate(4).putInt(hostname.hashCode()).array();
}
}
HostNameKeyingStrategy:
@Override
public void setContext(Context context) {
super.setContext(context);
final String hostname = context.getProperty(CoreConstants.HOSTNAME_KEY);
if (hostname == null) {
if (!errorWasShown) {
addError("Hostname could not be found in context. HostNamePartitioningStrategy will not work.");
errorWasShown = true;
}
} else {
hostnameHash = ByteBuffer.allocate(4).putInt(hostname.hashCode()).array();
}
}
The error message "Hostname could not be found in context. HostNamePartitioningStrategy will not work." and variable name "hostname" are weird.
ContextNameKeyingStrategy: <-- problem code
HostNameKeyingStrategy: