Instead of NPE if server is null and shardedDeployment is null, then should probably get both values up front and then with if-else-if-else have a last branch that logs a nice error about it.