32 namespace OmniEvents {
38 throw CORBA::OBJECT_NOT_EXIST();
46 throw CORBA::OBJECT_NOT_EXIST();
54 throw CORBA::OBJECT_NOT_EXIST();
59 DB(5,
"EventChannel_i::destroy()")
70 :
Servant(PortableServer::POA::_nil()),
71 _eventChannelStore(store),
75 _shutdownRequested(false),
84 const char* channelName,
129 DB(20,
"~EventChannel_i()")
156 assert(!CORBA::is_nil(
_poa));
158 const char* action=
"";
163 action=
"add this object to the store";
169 action=
"create this object in the persistency database";
175 action=
"run main loop";
180 action=
"remove this object from the store";
188 action=
"remove record from persistency database";
189 CORBA::String_var poaName =
_poa->the_name();
191 log.
os<<
"-ecf/"<<poaName.in()<<
'\n';
193 action=
"destroy POA";
198 _poa=PortableServer::POA::_nil();
203 catch(PortableServer::POAManager::AdapterInactive& ex) {
204 DB(0,
"EventChannel_i::run_undetached() - failed to "<<action<<
205 ", POA deactivated from the outside.")
207 catch (CORBA::SystemException& ex) {
208 DB(0,
"EventChannel_i::run_undetached() - failed to "<<action<<
209 ", System exception: "<<ex._name()<<
" ("<<
NP_MINORSTRING(ex)<<
")")
211 catch (CORBA::Exception& ex) {
212 DB(0,
"EventChannel_i::run_undetached() - failed to "<<action<<
213 ", CORBA exception: "<<ex._name())
233 list<CORBA::Any*> events;
236 assert(events.empty());
243 omni_thread::sleep(0,localCyclePeriod_ns);
250 #if OMNIEVENTS__DEBUG_REF_COUNTS
251 DB(20,
"EventChannel_i::_add_ref()")
253 omni_mutex_lock pause(
_lock);
260 #if OMNIEVENTS__DEBUG_REF_COUNTS
261 DB(20,
"EventChannel_i::_remove_ref()")
265 omni_mutex_lock pause(
_lock);
271 DB(2,
"EventChannel has negative ref count! "<<myref)
275 DB(15,
"EventChannel has zero ref count -- shutdown.")
283 CORBA::String_var poaName =
_poa->the_name();
284 string name =string(
"ecf/")+poaName.in();
304 CORBA::Object_var obj( _this() );
305 newMapper=
new Mapper(v.c_str(),obj.in());
324 using namespace PortableServer;
336 CORBA::PolicyList policies;
338 policies[0]=p->create_lifespan_policy(PERSISTENT);
339 policies[1]=p->create_id_assignment_policy(USER_ID);
340 policies[2]=p->create_thread_policy(SINGLE_THREAD_MODEL);
348 _poa=p->create_POA(channelName,POAManager::_nil(),policies);
351 catch(POA::AdapterAlreadyExists& ex)
353 DB(0,
"EventChannel_i::createPoa() - POA::AdapterAlreadyExists")
356 catch(POA::InvalidPolicy& ex)
358 DB(0,
"EventChannel_i::createPoa() - POA::InvalidPolicy: "<<ex.index)
365 for(CORBA::ULong i=0; i<policies.length(); ++i)
371 for(CORBA::ULong i=0; i<policies.length(); ++i)
392 omni_mutex_lock l(
_lock);
393 bool insertOK =
_channels.insert(channel).second;
395 DB(2,
"Attempted to store an EventChannel, when it is already stored.");
400 omni_mutex_lock l(
_lock);
401 set<EventChannel_i*>::iterator pos =
_channels.find(channel);
403 DB(2,
"Failed to erase unknown EventChannel.")
410 omni_mutex_lock l(
_lock);
411 for(set<EventChannel_i*>::iterator i=
_channels.begin();