#include <Connector.h>
Inheritance diagram for ACE_Strategy_Connector:


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 Methods | |
| 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. More... | |
| virtual int | close (void) |
| Close down the Connector. More... | |
| 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 Methods | |
| 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 <Connector>. More... | |
| int | delete_creation_strategy_ |
| 1 if <Connector> created the creation strategy and thus should delete it, else 0. More... | |
| CONNECT_STRATEGY * | connect_strategy_ |
| Connect strategy for a <Connector>. More... | |
| int | delete_connect_strategy_ |
| 1 if <Connector> created the connect strategy and thus should delete it, else 0. More... | |
| CONCURRENCY_STRATEGY * | concurrency_strategy_ |
| Concurrency strategy for an <Connector>. More... | |
| int | delete_concurrency_strategy_ |
| 1 if <Connector> created the concurrency strategy and thus should delete it, else 0. More... | |
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 417 of file Connector.h.
|
|||||
|
Definition at line 430 of file Connector.h. |
|
|||||
|
Definition at line 438 of file Connector.h. |
|
|||||
|
Definition at line 428 of file Connector.h. |
|
|||||
|
Definition at line 436 of file Connector.h. |
|
|||||
|
Definition at line 426 of file Connector.h. |
|
|||||
|
Definition at line 434 of file Connector.h. |
|
|||||
|
Definition at line 424 of file Connector.h. |
|
|||||
|
Definition at line 440 of file Connector.h. |
|
||||||||||||||||||||||||||||
|
Initialize a connector. <flags> indicates how <SVC_HANDLER>'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 <SVC_HANDLER> when it is opened. Definition at line 955 of file Connector.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, and LM_ERROR.
00960 : creation_strategy_ (0), 00961 delete_creation_strategy_ (0), 00962 connect_strategy_ (0), 00963 delete_connect_strategy_ (0), 00964 concurrency_strategy_ (0), 00965 delete_concurrency_strategy_ (0) 00966 { 00967 ACE_TRACE ("ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::ACE_Strategy_Connector"); 00968 00969 if (this->open (reactor, cre_s, conn_s, con_s, flags) == -1) 00970 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Strategy_Connector::ACE_Strategy_Connector"))); 00971 } |
|
||||||||||
|
Shutdown a connector and release resources.
Definition at line 974 of file Connector.cpp. References ACE_TRACE, and close.
|
|
||||||||||
|
Bridge method for activating a <SVC_HANDLER> with the appropriate concurrency strategy. The default behavior of this method is to activate the <SVC_HANDLER> by calling its <open> method (which allows the <SVC_HANDLER> to define its own concurrency strategy). However, subclasses can override this strategy to do more sophisticated concurrency activations (such as creating the <SVC_HANDLER> as an "active object" via multi-threading or multi-processing). Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 1050 of file Connector.cpp. References ACE_Concurrency_Strategy::activate_svc_handler, and concurrency_strategy_.
01051 {
01052 return this->concurrency_strategy_->activate_svc_handler (svc_handler, this);
01053 }
|
|
||||||||||
|
Close down the Connector.
Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 983 of file Connector.cpp. References concurrency_strategy_, connect_strategy_, creation_strategy_, delete_concurrency_strategy_, delete_connect_strategy_, and delete_creation_strategy_. Referenced by ~ACE_Strategy_Connector.
00984 {
00985 if (this->delete_creation_strategy_)
00986 delete this->creation_strategy_;
00987 this->delete_creation_strategy_ = 0;
00988 this->creation_strategy_ = 0;
00989
00990 if (this->delete_connect_strategy_)
00991 delete this->connect_strategy_;
00992 this->delete_connect_strategy_ = 0;
00993 this->connect_strategy_ = 0;
00994
00995 if (this->delete_concurrency_strategy_)
00996 delete this->concurrency_strategy_;
00997 this->delete_concurrency_strategy_ = 0;
00998 this->concurrency_strategy_ = 0;
00999
01000 return SUPER::close ();
01001 }
|
|
||||||||||
|
Definition at line 1068 of file Connector.cpp. References concurrency_strategy_.
01069 {
01070 return this->concurrency_strategy_;
01071 }
|
|
||||||||||
|
Definition at line 1062 of file Connector.cpp. References connect_strategy_.
01063 {
01064 return this->connect_strategy_;
01065 }
|
|
||||||||||||||||||||||||||||||||||||||||
|
Bridge method for connecting the new connection into the <SVC_HANDLER>. The default behavior delegates to the <PEER_CONNECTOR::connect> in the <Connect_Strategy>. <sh_copy> is used to obtain a copy of the <sh> 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 <sh> safely, using the internal locks in the Connect_Strategy, while saving a TSS copy in <sh_copy>, usually located in the stack. Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 1030 of file Connector.cpp. References ACE_PEER_CONNECTOR_ADDR.
01038 {
01039 return this->connect_strategy_->connect_svc_handler (sh,
01040 sh_copy,
01041 remote_addr,
01042 timeout,
01043 local_addr,
01044 reuse_addr,
01045 flags,
01046 perms);
01047 }
|
|
||||||||||||||||||||||||||||||||||||
|
Bridge method for connecting the new connection into the <SVC_HANDLER>. The default behavior delegates to the <PEER_CONNECTOR::connect> in the <Connect_Strategy>. Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 1011 of file Connector.cpp. References ACE_PEER_CONNECTOR_ADDR.
01018 {
01019 return this->connect_strategy_->connect_svc_handler (sh,
01020 remote_addr,
01021 timeout,
01022 local_addr,
01023 reuse_addr,
01024 flags,
01025 perms);
01026 }
|
|
||||||||||
|
Definition at line 1056 of file Connector.cpp. References creation_strategy_.
01057 {
01058 return this->creation_strategy_;
01059 }
|
|
||||||||||
|
Bridge method for creating a <SVC_HANDLER>. The strategy for creating a <SVC_HANDLER> are configured into the Connector via it's <creation_strategy_>. The default is to create a new <SVC_HANDLER> only if <sh> == 0, else <sh> is unchanged. However, subclasses can override this policy to perform <SVC_HANDLER> creation in any way that they like (such as creating subclass instances of <SVC_HANDLER>, 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 1004 of file Connector.cpp. References creation_strategy_, and ACE_Creation_Strategy::make_svc_handler.
01005 {
01006 return this->creation_strategy_->make_svc_handler (sh);
01007 }
|
|
||||||||||||||||||||||||||||
|
Initialize a connector. <flags> indicates how <SVC_HANDLER>'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 <SVC_HANDLER> when it is opened. Definition at line 871 of file Connector.cpp. References ACE_NEW_RETURN, and ACE_TRACE.
00876 {
00877 ACE_TRACE ("ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::open");
00878
00879 this->reactor (r);
00880
00881 // @@ Not implemented yet.
00882 // this->flags_ = flags;
00883 ACE_UNUSED_ARG (flags);
00884
00885 // Initialize the creation strategy.
00886
00887 // First we decide if we need to clean up.
00888 if (this->creation_strategy_ != 0 &&
00889 this->delete_creation_strategy_ != 0 &&
00890 cre_s != 0)
00891 {
00892 delete this->creation_strategy_;
00893 this->creation_strategy_ = 0;
00894 this->delete_creation_strategy_ = 0;
00895 }
00896
00897 if (cre_s != 0)
00898 this->creation_strategy_ = cre_s;
00899 else if (this->creation_strategy_ == 0)
00900 {
00901 ACE_NEW_RETURN (this->creation_strategy_,
00902 CREATION_STRATEGY,
00903 -1);
00904 this->delete_creation_strategy_ = 1;
00905 }
00906
00907
00908 // Initialize the accept strategy.
00909
00910 if (this->connect_strategy_ != 0 &&
00911 this->delete_connect_strategy_ != 0 &&
00912 conn_s != 0)
00913 {
00914 delete this->connect_strategy_;
00915 this->connect_strategy_ = 0;
00916 this->delete_connect_strategy_ = 0;
00917 }
00918
00919 if (conn_s != 0)
00920 this->connect_strategy_ = conn_s;
00921 else if (this->connect_strategy_ == 0)
00922 {
00923 ACE_NEW_RETURN (this->connect_strategy_,
00924 CONNECT_STRATEGY,
00925 -1);
00926 this->delete_connect_strategy_ = 1;
00927 }
00928
00929 // Initialize the concurrency strategy.
00930
00931 if (this->concurrency_strategy_ != 0 &&
00932 this->delete_concurrency_strategy_ != 0 &&
00933 con_s != 0)
00934 {
00935 delete this->concurrency_strategy_;
00936 this->concurrency_strategy_ = 0;
00937 this->delete_concurrency_strategy_ = 0;
00938 }
00939
00940 if (con_s != 0)
00941 this->concurrency_strategy_ = con_s;
00942 else if (this->concurrency_strategy_ == 0)
00943 {
00944 ACE_NEW_RETURN (this->concurrency_strategy_,
00945 CONCURRENCY_STRATEGY,
00946 -1);
00947 this->delete_concurrency_strategy_ = 1;
00948 }
00949
00950 return 0;
00951 }
|
|
||||||||||||||||
|
Initialize a connector. <flags> indicates how <SVC_HANDLER>'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 <SVC_HANDLER> when it is opened. Default strategies would be created and used. Reimplemented from ACE_Connector< SVC_HANDLER, ACE_PEER_CONNECTOR_2 >. Definition at line 863 of file Connector.cpp. References ACE_TRACE.
|
|
|||||
|
Concurrency strategy for an <Connector>.
Definition at line 566 of file Connector.h. Referenced by activate_svc_handler, close, and concurrency_strategy. |
|
|||||
|
Connect strategy for a <Connector>.
Definition at line 559 of file Connector.h. Referenced by close, and connect_strategy. |
|
|||||
|
Creation strategy for an <Connector>.
Definition at line 552 of file Connector.h. Referenced by close, creation_strategy, and make_svc_handler. |
|
|||||
|
1 if <Connector> created the concurrency strategy and thus should delete it, else 0.
Definition at line 570 of file Connector.h. Referenced by close. |
|
|||||
|
1 if <Connector> created the connect strategy and thus should delete it, else 0.
Definition at line 563 of file Connector.h. Referenced by close. |
|
|||||
|
1 if <Connector> created the creation strategy and thus should delete it, else 0.
Definition at line 556 of file Connector.h. Referenced by close. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002