服务器端的终止

OK. CORBA_Object_release 关心的是客户端。这不够,原因如 Elliot Lee 所指出的,说明细微的不同的地方。

On Tue, 20 Apr 1999, Svanberg Liss wrote:
> Btw, what does CORBA_Object_duplicate & CORBA_Object_release do
> server?

Nothing.
那么,在服务器端作什么呢? Elliot 回答如下:
> and... hmm, what kind of call does destroy the object in the server
 when 
> release doesn't?

You PortableServer_POA_deactivate_object(poa, objid) to tell the POA not
to take any more requests for the specified objid.

让我们依据实际代码来看一下他的意思。如果你在你的 idl 文件上运行 orbit-idl --skeleton_impl foo.idl,你将得到一个 foo-impl.c 文件。在这个文件中你将看到类似下面列出的函数:

/*
  * You shouldn't call this routine directly without first deactivating
  *  the servant...
  * 在首先终止仆从之前,你不可以调用这个例程
  */

static void

impl_CosTransactions_Control__destroy(

     impl_POA_CosTransactions_Control * servant, 

     CORBA_Environment * ev)

{

   POA_CosTransactions_Control__fini((PortableServer_Servant) servant,
 ev);

   g_free(servant);

}

这里说“在首先终止仆从之前,你不可以调用这个例程”,这意味着你首先要对仆从调用PortableServer_POA_deactivate_object()。

FIXME: 我不理解这里 POA_CosTransactions_Control__fini 做些什么。它与 PortableServer_POA_deactivate_object 怎样的不同? 无论如何这是你的对象被终止后的你做的最后的步骤。你可以接着释放(in your factory)你建立的 POA 仆从结构。