MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / get_data_durability_cache

Method get_data_durability_cache

dds/DCPS/Service_Participant.cpp:2193–2241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2191
2192#ifndef OPENDDS_NO_PERSISTENCE_PROFILE
2193DataDurabilityCache *
2194Service_Participant::get_data_durability_cache(
2195 DDS::DurabilityQosPolicy const & durability)
2196{
2197 DDS::DurabilityQosPolicyKind const kind =
2198 durability.kind;
2199
2200 DataDurabilityCache * cache = 0;
2201
2202 if (kind == DDS::TRANSIENT_DURABILITY_QOS) {
2203 {
2204 ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, factory_lock_, 0);
2205
2206 if (!this->transient_data_cache_) {
2207 this->transient_data_cache_.reset(new DataDurabilityCache(kind));
2208 }
2209 }
2210
2211 cache = this->transient_data_cache_.get();
2212
2213 } else if (kind == DDS::PERSISTENT_DURABILITY_QOS) {
2214 {
2215 ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, factory_lock_, 0);
2216
2217 try {
2218 if (!this->persistent_data_cache_) {
2219 const String persistent_data_dir =
2220 config_store_->get(COMMON_DCPS_PERSISTENT_DATA_DIR,
2221 COMMON_DCPS_PERSISTENT_DATA_DIR_default);
2222 this->persistent_data_cache_.reset(new DataDurabilityCache(kind, persistent_data_dir));
2223 }
2224
2225 } catch (const std::exception& ex) {
2226 if (DCPS_debug_level > 0) {
2227 ACE_ERROR((LM_WARNING,
2228 ACE_TEXT("(%P|%t) WARNING: Service_Participant::get_data_durability_cache ")
2229 ACE_TEXT("failed to create PERSISTENT cache, falling back on ")
2230 ACE_TEXT("TRANSIENT behavior: %C\n"), ex.what()));
2231 }
2232
2233 this->persistent_data_cache_.reset(new DataDurabilityCache(DDS::TRANSIENT_DURABILITY_QOS));
2234 }
2235 }
2236
2237 cache = this->persistent_data_cache_.get();
2238 }
2239
2240 return cache;
2241}
2242#endif
2243
2244void

Callers 2

enableMethod · 0.80

Calls 3

resetMethod · 0.45
getMethod · 0.45
whatMethod · 0.45

Tested by 1