dnrusakov commented on a change in pull request #3282: WIP STREAMCOMP-2724: 
Stream Manager migrated to mainly use smart pointers instead of a manual memory 
management
URL: https://github.com/apache/incubator-heron/pull/3282#discussion_r291708622
 
 

 ##########
 File path: heron/stmgr/src/cpp/manager/checkpoint-gateway.cpp
 ##########
 @@ -73,30 +72,34 @@ void CheckpointGateway::SendToInstance(sp_int32 _task_id,
   size_metric_->SetValue(current_size_);
 }
 
-void CheckpointGateway::SendToInstance(proto::stmgr::TupleStreamMessage* 
_message) {
+void 
CheckpointGateway::SendToInstance(unique_ptr<proto::stmgr::TupleStreamMessage> 
_message) {
   if (current_size_ > drain_threshold_) {
     ForceDrain();
   }
+
   sp_int32 task_id = _message->task_id();
   sp_uint64 size = _message->set().size();
-  CheckpointInfo* info = get_info(task_id);
-  _message = info->SendToInstance(_message, size);
-  if (!_message) {
+  CheckpointInfo& info = get_info(task_id);
+
+  proto::stmgr::TupleStreamMessage *raw_message = 
info.SendToInstance(_message.release(), size);
 
 Review comment:
   We can not move here because `tuplestream_drainer_` and all the chain down 
the road expects just a raw pointer. That's why i converted `uniq_ptr` into a 
raw pointer using `release`. `release` basically tells that this concrete smart 
pointer is not responsible for managing this concrete raw pointer any more. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to