Exemplo n.º 1
0
distributed_control::~distributed_control() {
  // detach the instance
  last_dc = NULL;
  last_dc_procid = 0;
  distributed_services->full_barrier();
  logstream(LOG_INFO) << "Shutting down distributed control " << std::endl;
  FREE_CALLBACK_EVENT(EVENT_NETWORK_BYTES);
  FREE_CALLBACK_EVENT(EVENT_RPC_CALLS);
  // call all deletion callbacks
  for (size_t i = 0; i < deletion_callbacks.size(); ++i) {
    deletion_callbacks[i]();
  }

  size_t bytessent = bytes_sent();
  for (size_t i = 0;i < senders.size(); ++i) {
    senders[i]->flush();
  }

  comm->close();

  for (size_t i = 0;i < senders.size(); ++i) {
    delete senders[i];
  }
  senders.clear();

  pthread_key_delete(dc_impl::thrlocal_sequentialization_key);
  pthread_key_delete(dc_impl::thrlocal_send_buffer_key);

  size_t bytesreceived = bytes_received();
  for (size_t i = 0;i < receivers.size(); ++i) {
    receivers[i]->shutdown();
    delete receivers[i];
  }
  receivers.clear();
  // shutdown function call handlers
  for (size_t i = 0;i < fcallqueue.size(); ++i) fcallqueue[i].stop_blocking();
  fcallhandlers.join();
  logstream(LOG_INFO) << "Bytes Sent: " << bytessent << std::endl;
  logstream(LOG_INFO) << "Calls Sent: " << calls_sent() << std::endl;
  logstream(LOG_INFO) << "Network Sent: " << network_bytes_sent() << std::endl;
  logstream(LOG_INFO) << "Bytes Received: " << bytesreceived << std::endl;
  logstream(LOG_INFO) << "Calls Received: " << calls_received() << std::endl;

  delete comm;

}
Exemplo n.º 2
0
distributed_control::~distributed_control() {
  distributed_services->full_barrier();
  if(last_dc_procid==0)
  	logstream(LOG_INFO) << "Shutting down distributed control " << std::endl;
  FREE_CALLBACK_EVENT(EVENT_NETWORK_BYTES);
  FREE_CALLBACK_EVENT(EVENT_RPC_CALLS);
  // call all deletion callbacks
  for (size_t i = 0; i < deletion_callbacks.size(); ++i) {
    deletion_callbacks[i]();
  }

  size_t bytessent = bytes_sent();
  for (size_t i = 0;i < senders.size(); ++i) {
    senders[i]->flush();
  }

  comm->close();

  for (size_t i = 0;i < senders.size(); ++i) {
    delete senders[i];
  }
  size_t bytesreceived = bytes_received();
  for (size_t i = 0;i < receivers.size(); ++i) {
    receivers[i]->shutdown();
    delete receivers[i];
  }
  senders.clear();
  receivers.clear();
  // shutdown function call handlers
  for (size_t i = 0;i < fcallqueue.size(); ++i) fcallqueue[i].stop_blocking();
  fcallhandlers.join();
  if(last_dc_procid==0){
  logstream(LOG_INFO) << "Bytes Sent: " << bytessent << std::endl;
  logstream(LOG_INFO) << "Calls Sent: " << calls_sent() << std::endl;
  logstream(LOG_INFO) << "Network Sent: " << network_bytes_sent() << std::endl;
  logstream(LOG_INFO) << "Bytes Received: " << bytesreceived << std::endl;
  logstream(LOG_INFO) << "Calls Received: " << calls_received() << std::endl;
  }
  delete comm;

}