Skip navigation.

CORBA Programming Reference

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents View as PDF   Get Adobe Reader

 


ServerBase::thread_release()

Synopsis

Performs application-specific cleanup when a thread that was created by the BEA Tuxedo software is released. This method supports the development of a multithreaded server application.

C++ Binding

void thread_release()

Arguments

None.

Description

The thread_release callback method is invoked each time a thread is released. Implement the thread_release method as necessary to perform application-specific resource cleanup.

The ServerBase class provides a default implementation of the thread_release method that closes the XA resource manager in the released thread.

Return Value

None.

Example

void simple_per_request_server::thread_release()
{
TP::userlog("thread_release called in thread %ld",
(unsigned long)SIMPTHR_GETCURRENTTHREADID);
}

Tobj_ServantBase Interface

The Tobj_ServantBase interface inherits from the PortableServer::RefCountServantBase class and defines operations that allow a CORBA object to assist in the management of its state in a thread-safe manner. Every implementation skeleton generated by the IDL compiler automatically inherits from the Tobj_ServantBase class. The Tobj_ServantBase class contains two virtual methods, activate_object() and deactivate_object(), that may be optionally implemented by the programmer.

Whenever a request comes in for an inactive CORBA object, the object is activated and the activate_object() method is invoked on the servant. When the CORBA object is deactivated, the deactivate_object() method is invoked on the servant. The timing of deactivation is driven by the implementation's activation policy. When the deactivate_object() method is invoked, the TP Framework passes in a reason code to indicate why the call was made.

These methods support the development of a multithreaded server application:

Note: Tobj_ServantBase::activate_object() and Tobj_ServantBase::deactivate_object() are the only methods that the TP Framework guarantees will be invoked for CORBA object activation and deactivation. The servant class constructor and destructor may or may not be invoked at activation or deactivation time (through the Server::create_servant call for C++). Therefore, the server application code must not do any state handling for CORBA objects in either the constructor or destructor of the servant class.

Note: The programmer does not need to use a cast or reference to Tobj_ServantBase directly. The Tobj_ServantBase methods show up as part of the skeleton and, therefore, in the implementation class for a servant. The programmer may provide definitions for the activate_object and deactivate_object methods, but the programmer should never make direct invocations on those methods; only the TP Framework should call those methods.

C++ Declaration (in Tobj_ServantBase.h)

The C++ mapping for the Tobj_servantBase interface is as follows:

class Tobj_ServantBase : public PortableServer::RefCountServantBase {
public:
    Tobj_ServantBase& operator=(const Tobj_ServantBase&);
Tobj_ServantBase() {}
Tobj_ServantBase(const Tobj_ServantBase& s) :
PortableServer::RefCountServantBase(s) {}
    virtual void activate_object(const char *) {}
    virtual void deactivate_object(const char*, 
TobjS::DeactivateReasonValue) {}
    virtual CORBA::Boolean _is_reentrant() { return CORBA_FALSE; }
};
typedef Tobj_ServantBase * Tobj_Servant;

 

Skip navigation bar  Back to Top Previous Next