#include <Connector.h>
Inheritance diagram for ACE_Strategy_Connector< SVC_HANDLER, >:
Public Types | |
typedef ACE_Creation_Strategy< SVC_HANDLER > | creation_strategy_type |
typedef ACE_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2 > | connect_strategy_type |
typedef ACE_Concurrency_Strategy< SVC_HANDLER > | concurrency_strategy_type |
typedef ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 > | base_type |
typedef ACE_Creation_Strategy< SVC_HANDLER > | CREATION_STRATEGY |
typedef ACE_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2 > | CONNECT_STRATEGY |
typedef ACE_Concurrency_Strategy< SVC_HANDLER > | CONCURRENCY_STRATEGY |
typedef ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 > | SUPER |
Public Member Functions | |
ACE_Strategy_Connector (ACE_Reactor *r=ACE_Reactor::instance(), ACE_Creation_Strategy< SVC_HANDLER > *=0, ACE_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2 > *=0, ACE_Concurrency_Strategy< SVC_HANDLER > *=0, int flags=0) | |
virtual int | open (ACE_Reactor *r, int flags) |
virtual int | open (ACE_Reactor *r=ACE_Reactor::instance(), ACE_Creation_Strategy< SVC_HANDLER > *=0, ACE_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2 > *=0, ACE_Concurrency_Strategy< SVC_HANDLER > *=0, int flags=0) |
virtual | ~ACE_Strategy_Connector (void) |
Shutdown a connector and release resources. | |
virtual int | close (void) |
Close down the Connector. | |
virtual ACE_Creation_Strategy< SVC_HANDLER > * | creation_strategy (void) const |
virtual ACE_Connect_Strategy< SVC_HANDLER, ACE_PEER_CONNECTOR_2 > * | connect_strategy (void) const |
virtual ACE_Concurrency_Strategy< SVC_HANDLER > * | concurrency_strategy (void) const |
Protected Member Functions | |
virtual int | make_svc_handler (SVC_HANDLER *&sh) |
virtual int | connect_svc_handler (SVC_HANDLER *&sh, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, int reuse_addr, int flags, int perms) |
virtual int | connect_svc_handler (SVC_HANDLER *&sh, SVC_HANDLER *&sh_copy, const ACE_PEER_CONNECTOR_ADDR &remote_addr, ACE_Time_Value *timeout, const ACE_PEER_CONNECTOR_ADDR &local_addr, int reuse_addr, int flags, int perms) |
virtual int | activate_svc_handler (SVC_HANDLER *svc_handler) |
Protected Attributes | |
CREATION_STRATEGY * | creation_strategy_ |
Creation strategy for an . | |
int | delete_creation_strategy_ |
CONNECT_STRATEGY * | connect_strategy_ |
Connect strategy for a . | |
int | delete_connect_strategy_ |
CONCURRENCY_STRATEGY * | concurrency_strategy_ |
Concurrency strategy for an . | |
int | delete_concurrency_strategy_ |
Implements a flexible and extensible set of strategies for actively establishing connections with clients. There are three main strategies: (1) creating a SVC_HANDLER, (2) actively initiating a new connection from the client, and (3) activating the SVC_HANDLER with a particular concurrency mechanism after the connection is established.
Definition at line 405 of file Connector.h.
|
Definition at line 418 of file Connector.h. |
|
Definition at line 426 of file Connector.h. |
|
Definition at line 416 of file Connector.h. |
|
Definition at line 424 of file Connector.h. Referenced by ACE_Strategy_Connector< SVC_HANDLER, >::open(). |
|
Definition at line 414 of file Connector.h. |
|
Definition at line 422 of file Connector.h. |
|
Definition at line 412 of file Connector.h. |
|
Definition at line 428 of file Connector.h. |
|
Initialize a connector. flags indicates how 's should be initialized prior to being activated. Right now, the only flag that is processed is ACE_NONBLOCK, which enabled non-blocking I/O on the when it is opened. Definition at line 844 of file Connector.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, and LM_ERROR.
00849 : creation_strategy_ (0), 00850 delete_creation_strategy_ (0), 00851 connect_strategy_ (0), 00852 delete_connect_strategy_ (0), 00853 concurrency_strategy_ (0), 00854 delete_concurrency_strategy_ (0) 00855 { 00856 ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Strategy_Connector"); 00857 00858 if (this->open (reactor, cre_s, conn_s, con_s, flags) == -1) 00859 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Strategy_Connector::ACE_Strategy_Connector"))); 00860 } |
|
Shutdown a connector and release resources.
Definition at line 863 of file Connector.cpp. References ACE_TRACE, and ACE_Strategy_Connector< SVC_HANDLER, >::close().
|
|
Bridge method for activating a with the appropriate concurrency strategy. The default behavior of this method is to activate the by calling its method (which allows the to define its own concurrency strategy). However, subclasses can override this strategy to do more sophisticated concurrency activations (such as creating the as an "active object" via multi-threading or multi-processing). Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 939 of file Connector.cpp.
00940 { 00941 return this->concurrency_strategy_->activate_svc_handler (svc_handler, this); 00942 } |
|
Close down the Connector.
Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 872 of file Connector.cpp. References ACE_Strategy_Connector< SVC_HANDLER, >::connect_strategy_, and ACE_Strategy_Connector< SVC_HANDLER, >::delete_connect_strategy_. Referenced by ACE_Strategy_Connector< SVC_HANDLER, >::~ACE_Strategy_Connector().
00873 { 00874 if (this->delete_creation_strategy_) 00875 delete this->creation_strategy_; 00876 this->delete_creation_strategy_ = 0; 00877 this->creation_strategy_ = 0; 00878 00879 if (this->delete_connect_strategy_) 00880 delete this->connect_strategy_; 00881 this->delete_connect_strategy_ = 0; 00882 this->connect_strategy_ = 0; 00883 00884 if (this->delete_concurrency_strategy_) 00885 delete this->concurrency_strategy_; 00886 this->delete_concurrency_strategy_ = 0; 00887 this->concurrency_strategy_ = 0; 00888 00889 return SUPER::close (); 00890 } |
|
Definition at line 957 of file Connector.cpp.
00958 { 00959 return this->concurrency_strategy_; 00960 } |
|
Definition at line 951 of file Connector.cpp. References ACE_Strategy_Connector< SVC_HANDLER, >::connect_strategy_.
00952 { 00953 return this->connect_strategy_; 00954 } |
|
Bridge method for connecting the new connection into the . The default behavior delegates to the <PEER_CONNECTOR::connect> in the . is used to obtain a copy of the pointer, but that can be kept in the stack; the motivation is a bit too long to include here, but basically we want to modify safely, using the internal locks in the Connect_Strategy, while saving a TSS copy in , usually located in the stack. Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 919 of file Connector.cpp. References ACE_PEER_CONNECTOR_ADDR.
00927 { 00928 return this->connect_strategy_->connect_svc_handler (sh, 00929 sh_copy, 00930 remote_addr, 00931 timeout, 00932 local_addr, 00933 reuse_addr, 00934 flags, 00935 perms); 00936 } |
|
Bridge method for connecting the new connection into the . The default behavior delegates to the <PEER_CONNECTOR::connect> in the . Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 900 of file Connector.cpp. References ACE_PEER_CONNECTOR_ADDR.
00907 { 00908 return this->connect_strategy_->connect_svc_handler (sh, 00909 remote_addr, 00910 timeout, 00911 local_addr, 00912 reuse_addr, 00913 flags, 00914 perms); 00915 } |
|
Definition at line 945 of file Connector.cpp.
00946 { 00947 return this->creation_strategy_; 00948 } |
|
Bridge method for creating a . The strategy for creating a are configured into the Connector via it's . The default is to create a new only if == 0, else is unchanged. However, subclasses can override this policy to perform creation in any way that they like (such as creating subclass instances of , using a singleton, dynamically linking the handler, etc.). Returns -1 if failure, else 0. Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 893 of file Connector.cpp.
00894 { 00895 return this->creation_strategy_->make_svc_handler (sh); 00896 } |
|
Initialize a connector. flags indicates how 's should be initialized prior to being activated. Right now, the only flag that is processed is ACE_NONBLOCK, which enabled non-blocking I/O on the when it is opened. Definition at line 760 of file Connector.cpp. References ACE_NEW_RETURN, ACE_TRACE, and ACE_Strategy_Connector< SVC_HANDLER, >::CONNECT_STRATEGY.
00765 { 00766 ACE_TRACE ("ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open"); 00767 00768 this->reactor (r); 00769 00770 // @@ Not implemented yet. 00771 // this->flags_ = flags; 00772 ACE_UNUSED_ARG (flags); 00773 00774 // Initialize the creation strategy. 00775 00776 // First we decide if we need to clean up. 00777 if (this->creation_strategy_ != 0 && 00778 this->delete_creation_strategy_ != 0 && 00779 cre_s != 0) 00780 { 00781 delete this->creation_strategy_; 00782 this->creation_strategy_ = 0; 00783 this->delete_creation_strategy_ = 0; 00784 } 00785 00786 if (cre_s != 0) 00787 this->creation_strategy_ = cre_s; 00788 else if (this->creation_strategy_ == 0) 00789 { 00790 ACE_NEW_RETURN (this->creation_strategy_, 00791 CREATION_STRATEGY, 00792 -1); 00793 this->delete_creation_strategy_ = 1; 00794 } 00795 00796 00797 // Initialize the accept strategy. 00798 00799 if (this->connect_strategy_ != 0 && 00800 this->delete_connect_strategy_ != 0 && 00801 conn_s != 0) 00802 { 00803 delete this->connect_strategy_; 00804 this->connect_strategy_ = 0; 00805 this->delete_connect_strategy_ = 0; 00806 } 00807 00808 if (conn_s != 0) 00809 this->connect_strategy_ = conn_s; 00810 else if (this->connect_strategy_ == 0) 00811 { 00812 ACE_NEW_RETURN (this->connect_strategy_, 00813 CONNECT_STRATEGY, 00814 -1); 00815 this->delete_connect_strategy_ = 1; 00816 } 00817 00818 // Initialize the concurrency strategy. 00819 00820 if (this->concurrency_strategy_ != 0 && 00821 this->delete_concurrency_strategy_ != 0 && 00822 con_s != 0) 00823 { 00824 delete this->concurrency_strategy_; 00825 this->concurrency_strategy_ = 0; 00826 this->delete_concurrency_strategy_ = 0; 00827 } 00828 00829 if (con_s != 0) 00830 this->concurrency_strategy_ = con_s; 00831 else if (this->concurrency_strategy_ == 0) 00832 { 00833 ACE_NEW_RETURN (this->concurrency_strategy_, 00834 CONCURRENCY_STRATEGY, 00835 -1); 00836 this->delete_concurrency_strategy_ = 1; 00837 } 00838 00839 return 0; 00840 } |
|
Initialize a connector. flags indicates how 's should be initialized prior to being activated. Right now, the only flag that is processed is ACE_NONBLOCK, which enabled non-blocking I/O on the when it is opened. Default strategies would be created and used. Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 751 of file Connector.cpp. References ACE_TRACE.
|
|
Concurrency strategy for an .
Definition at line 554 of file Connector.h. |
|
Connect strategy for a .
Definition at line 547 of file Connector.h. Referenced by ACE_Strategy_Connector< SVC_HANDLER, >::close(), and ACE_Strategy_Connector< SVC_HANDLER, >::connect_strategy(). |
|
Creation strategy for an .
Definition at line 540 of file Connector.h. |
|
1 if created the concurrency strategy and thus should delete it, else 0. Definition at line 558 of file Connector.h. |
|
1 if created the connect strategy and thus should delete it, else 0. Definition at line 551 of file Connector.h. Referenced by ACE_Strategy_Connector< SVC_HANDLER, >::close(). |
|
1 if created the creation strategy and thus should delete it, else 0. Definition at line 544 of file Connector.h. |