3 seconds to shutdown DomainParticipant

5 posts / 0 new
Last post
Offline
Last seen: 4 years 4 months ago
Joined: 03/29/2020
Posts: 9
3 seconds to shutdown DomainParticipant

Hi,

I am trying the example "rticonnextdds-examples/examples/connext_dds/using_qos_profiles", and it looks DomainParticipant shutdown ( or release resources) needs about 3 seconds. I did a test with only DomainParticipant as below:

void publisher_main(int domain_id, int sample_count)
{
QosProvider qos_provider("my_custom_qos_profiles.xml");
DomainParticipant participant(domain_id, qos_provider.participant_qos());
}
this simple program takes about 3 seconds to complete. Is there a way to update the shutdown timer? It's supposed to complete immediately
Keywords:
Offline
Last seen: 1 month 3 weeks ago
Joined: 09/23/2018
Posts: 63

Hello,

You can adjust the shutdown time via the shutdown_cleanup_period QoS.

For the using_qos_profiles example,  what you can do is add the following to the <participant_qos>  section of the my_custom_qos_profiles.xml  QoS file. 

<!-- THIS IS A TEST -->
<database>
<shutdown_cleanup_period>
<sec>0</sec>
<nanosec>50000000</nanosec>
</shutdown_cleanup_period>
</database>

Make sure it is in a <profile> that you specify (e.g.  make the "transient_local_profile" the default profile.

<qos_profile name="transient_local_profile" is_default_qos ="true">

 

 

 

 

 

File Attachments: 
Offline
Last seen: 4 years 4 months ago
Joined: 03/29/2020
Posts: 9

Hi garyb,

Thanks.  It works.  Another question, how can it work with default QoS? I tried below code, it did not work

void publisher_main(int domain_id, int sample_count)
{
DomainParticipantQos participant_qos = QosProvider::Default().participant_qos();
auto d = participant_qos.policy<rti::core::policy::Database>();
d.shutdown_cleanup_period(dds::core::Duration(0));

DomainParticipant participant(domain_id, participant_qos);

}
Offline
Last seen: 5 days 13 hours ago
Joined: 04/02/2013
Posts: 196

Hi,

Here you're copying the Database policy, not taking a reference (and then modifying the copy):

auto d = participant_qos.policy<rti::core::policy::Database>();
 
You need to do this instead:
 
auto& d = participant_qos.policy<rti::core::policy::Database>();
 
Alex
 
Offline
Last seen: 4 years 4 months ago
Joined: 03/29/2020
Posts: 9

Works now, thanks!