| 252 | } |
| 253 | |
| 254 | void PartitionChannel::CallMethod( |
| 255 | const google::protobuf::MethodDescriptor* method, |
| 256 | google::protobuf::RpcController* controller, |
| 257 | const google::protobuf::Message* request, |
| 258 | google::protobuf::Message* response, |
| 259 | google::protobuf::Closure* done) { |
| 260 | if (_pchan != NULL) { |
| 261 | _pchan->CallMethod(method, controller, request, response, done); |
| 262 | } else { |
| 263 | Controller* cntl = static_cast<Controller*>(controller); |
| 264 | cntl->SetFailed(EINVAL, "PartitionChannel=%p is not initialized yet", |
| 265 | this); |
| 266 | // This is a branch only entered by wrongly-used RPC, just call done |
| 267 | // in-place. See comments in channel.cpp on deadlock concerns. |
| 268 | if (done) { |
| 269 | done->Run(); |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | int PartitionChannel::partition_count() const { |
| 275 | return _pchan ? _pchan->partition_count() : 0; |