<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4630.0">
<TITLE>Deleting a StructuredPushConsumer</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<BR>
<P><FONT SIZE=2 FACE="Arial">Hi,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I get an error message when deleting a StructuredPushConsumer instance that I create like this:</FONT>
<BR><FONT SIZE=2 FACE="Arial">event_observer = new MyObserver ;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> /* My observer inherit from StructuredPushConsumer and overide the push_structured_event method*/</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> CosNotifyComm::StructuredPushConsumer_var push_consumer ;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> CosNotifyChannelAdmin::StructuredProxyPushSupplier_var structured_proxy ;</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">push_consumer = eventObserver->_this() ;</FONT>
<BR> <FONT SIZE=2 FACE="Arial">structured_proxy =</FONT>
<UL><UL><UL>
<P><FONT SIZE=2 FACE="Arial">{ /* pseudo code */</FONT>
<UL>
<P><FONT SIZE=2 FACE="Arial">generic_proxy = consumer_admin</FONT>
<BR><FONT SIZE=2 FACE="Arial"> ->obtain_notification_push_supplier( CosNotifyChannelAdmin::STRUCTURED_EVENT, </FONT>
<BR><FONT SIZE=2 FACE="Arial"> proxy_id ) ;</FONT>
<BR><FONT SIZE=2 FACE="Arial">structured_proxy = </FONT>
<BR><FONT SIZE=2 FACE="Arial"> CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow( generic_proxy ) ;</FONT>
<BR><FONT SIZE=2 FACE="Arial">structured_proxy->connect_structured_push_consumer( pushConsumer ) ;</FONT>
<BR><FONT SIZE=2 FACE="Arial">Return structured_proxy;</FONT>
</UL>
<P><FONT SIZE=2 FACE="Arial">}</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">/* Store all objects in *_Var vector */</FONT>
<BR><FONT SIZE=2 FACE="Arial">mEventObserverConsumerList.push_back( push_consumer ) ;</FONT>
<BR><FONT SIZE=2 FACE="Arial">mEventObserverProxyList.push_back( structured_proxy ) ;</FONT>
<BR><FONT SIZE=2 FACE="Arial">mEventObserverPtrList.push_back( eventObserver ) ;</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">/* From here I receive events successfully */</FONT>
</P>
</UL></UL></UL>
<P><FONT SIZE=2 FACE="Arial">Then before the ORB is shutdown I do not need ne more this consumer so I remove it like this:</FONT>
<BR><FONT SIZE=2 FACE="Arial">(StructuredPushConsumer s are stored in vector of StructuredPushConsumer_Var)</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial"> mEventObserverConsumerList[i]->disconnect_structured_push_consumer() ;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> mEventObserverProxyList[i]->remove_all_filters();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> mEventObserverProxyList[i]->disconnect_structured_push_supplier() ;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> mEventObserverConsumerList.erase( mEventObserverConsumerList.begin() + i ) ;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> mEventObserverProxyList.erase( mEventObserverProxyList.begin() + i ) ;</FONT>
</P>
<BR>
<BR>
<P><FONT SIZE=2 FACE="Arial">Then I do not need this event handler anymore, so I</FONT>
<BR><FONT SIZE=2 FACE="Arial">delete event_observer ;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">When the delete is executed I get this error message:</FONT>
</P>
<UL>
<P><B><FONT SIZE=2 FACE="Arial">omniORB: ERROR -- A servant has been deleted that is still activated.</FONT></B>
<BR><B><FONT SIZE=2 FACE="Arial"> id: root<33554432> (active)</FONT></B>
</P>
</UL>
<P><FONT SIZE=2 FACE="Arial">Is someone get an idea why I get this message ?</FONT>
<BR><FONT SIZE=2 FACE="Arial">I try some CORBA::release on mEventObserverConsumerList[i] but it fails (ref count becomes <0)</FONT>
<BR><FONT SIZE=2 FACE="Arial">If I delete event_observer after my main servant is destroyed and orb is shutdown, it works.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Is it forbiden to delete StructuredPushConsumer instance while the ORB is running (not shutdown) ?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Thanks for your help</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Fred</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Courier New"> (</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> </FONT><B></B><B> <FONT FACE="Courier New">Frédéric Prin</FONT></B><FONT SIZE=2 FACE="Courier New"> )</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> Senior Software Engineer /</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> S I L V A C O (</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> Grenoble REsearch CEnter \</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> Tel 04 56 38 10 33 )</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> __________________________/___</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> /__/__/__/__/__/__/__/__/__/__/</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> /__/__/__/__/__/__/__/__/_____/</FONT>
<BR><FONT SIZE=2 FACE="Courier New"> /__/__/__/__/__/__/__/__/__/__/</FONT>
</P>
</BODY>
</HTML>