Ice 3.7 C++11 API Reference
Public Member Functions | List of all members
Ice::ServantLocator Class Referenceabstract

A servant locator is called by an object adapter to locate a servant that is not found in its active servant map. More...

#include <Ice/Ice.h>

Public Member Functions

virtual void deactivate (const ::std::string &category)=0
 Called when the object adapter in which this servant locator is installed is destroyed. More...
 
virtual void finished (const Current &curr, const ::std::shared_ptr< Object > &servant, const ::std::shared_ptr< void > &cookie)=0
 Called by the object adapter after a request has been made. More...
 
virtual ::std::shared_ptr<::Ice::Objectlocate (const Current &curr, ::std::shared_ptr< void > &cookie)=0
 Called before a request is dispatched if a servant cannot be found in the object adapter's active servant map. More...
 
virtual ~ServantLocator ()
 

Detailed Description

A servant locator is called by an object adapter to locate a servant that is not found in its active servant map.

See also
ObjectAdapter
ObjectAdapter::addServantLocator
ObjectAdapter::findServantLocator

Constructor & Destructor Documentation

◆ ~ServantLocator()

virtual Ice::ServantLocator::~ServantLocator ( )
virtual

Member Function Documentation

◆ deactivate()

virtual void Ice::ServantLocator::deactivate ( const ::std::string &  category)
pure virtual

Called when the object adapter in which this servant locator is installed is destroyed.

Parameters
categoryIndicates for which category the servant locator is being deactivated.
See also
ObjectAdapter::destroy
Communicator::shutdown
Communicator::destroy

◆ finished()

virtual void Ice::ServantLocator::finished ( const Current curr,
const ::std::shared_ptr< Object > &  servant,
const ::std::shared_ptr< void > &  cookie 
)
pure virtual

Called by the object adapter after a request has been made.

This operation is only called if locate was called prior to the request and returned a non-null servant. This operation can be used for cleanup purposes after a request.

finished can throw any user exception. If it does, that exception is marshaled back to the client. If the Slice definition for the corresponding operation includes that user exception, the client receives that user exception; otherwise, the client receives UnknownUserException.

If both the operation and finished throw an exception, the exception thrown by finished is marshaled back to the client.

Parameters
currInformation about the current operation call for which a servant was located by locate.
servantThe servant that was returned by locate.
cookieThe cookie that was returned by locate.
Exceptions
UserExceptionThe implementation can raise a UserException and the run time will marshal it as the result of the invocation.
See also
ObjectAdapter
Current
locate

◆ locate()

virtual ::std::shared_ptr<::Ice::Object> Ice::ServantLocator::locate ( const Current curr,
::std::shared_ptr< void > &  cookie 
)
pure virtual

Called before a request is dispatched if a servant cannot be found in the object adapter's active servant map.

Note that the object adapter does not automatically insert the returned servant into its active servant map. This must be done by the servant locator implementation, if this is desired.

locate can throw any user exception. If it does, that exception is marshaled back to the client. If the Slice definition for the corresponding operation includes that user exception, the client receives that user exception; otherwise, the client receives UnknownUserException.

If locate throws any exception, the Ice run time does not call finished.

If you call locate from your own code, you must also call finished when you have finished using the servant, provided that locate returned a non-null servant; otherwise, you will get undefined behavior if you use servant locators such as the Freeze Evictor.

Parameters
currInformation about the current operation for which a servant is required.
cookieA "cookie" that will be passed to finished.
Returns
The located servant, or null if no suitable servant has been found.
Exceptions
UserExceptionThe implementation can raise a UserException and the run time will marshal it as the result of the invocation.
See also
ObjectAdapter
Current
finished

The documentation for this class was generated from the following file: