A communicator contains one or more object adapters. An object adapter sits at
the boundary between the Ice run time and the server application code and has a
number of responsibilities:
• It maps Ice objects to servants for incoming requests and dispatches the
requests to the application code in each servant (that is, an object adapter
implements an up-call interface that connects the Ice run time and the application
code in the server).
• It assists in life cycle operations so Ice objects and servants can be created and
existing destroyed without race conditions.
• It provides one or more transport endpoints. Clients access the Ice objects
provided by the adapter via those endpoints. (It is also possible to create an
object adapter without endpoints. In this case the adapter is used for bidirectional
callbacks—see Section 36.7.)
一个通信器含有一个或更多对象适配器。对象适配器处在Ice run time
和服务器之间的界线上,负有这样一些责任:
• 它把Ice对象映射到到来请求的servant,并把请求分派给每个servant中的
应用代码(也就是说,对象适配器实现了一个向上调用接口,把Ice
run time 与服务器中的应用代码连接在一起)。
• 它协助进行生命周期操作,使得Ice对象和servant在创建和销毁时不会出
现竞争状况。
• 它提供一个或更多传输端点。客户通过这些端点访问适配器所提供的Ice
对象(也有可能创建没有端点的适配器,这样的适配器往往用于回调--参看 36.7节)
Each object adapter has one or more servants that incarnate Ice objects, as well as
one or more transport endpoints. If an object adapter has more than one endpoint,
all servants registered with that adapter respond to incoming requests on any of
32.4 Object Adapters 797
the endpoints. In other words, if an object adapter has multiple transport
endpoints, those endpoints represent alternative communication paths to the same
set of objects (for example, via different transports).
Each object adapter belongs to exactly one communicator (but a single
communicator can have many object adapters). Each object adapter has a name
that distinguishes it from all other object adapters in the same communicator.
Each object adapter can optionally have its own thread pool, enabled via the
<adapter-name>.ThreadPool.Size property (see Section 32.9.1). If so,
client invocations for that adapter are dispatched in a thread taken from the
adapter’s thread pool instead of using a thread from the communicator’s server
thread pool.
每个对象适配器都有一个或更多servant,对Ice 对象进行体现;同时还
有一个或更多传输端点。如果对象适配器拥有的传输端点不止一个,所有
向该适配器作了注册的servant 可以在任何一个端点上响应到来的请求。换
句话说,如果对象适配器有多个传输端点,这些端点代表的是通往同一组
对象的不同通信路径(例如,通过不同的传输机制)。
每个对象适配器都只属于一个通信器(但一个通信器可以有多个对象
适配器,每个适配器都有一个名字区分于同一个通信器的其他适配器)
每个对象适配器可以非强制性地拥有自己的线程池,你可以通过
<adapter-name>.ThreadPool.Size 属性来使用这个特性(参见32.9.1节
)。如果使用了这个特性,在分派针对该适配器的客户调用时,使用的是
适配器的线程池中的线程,而不会使用通信器的服务器线程池中的线程。