1 // $Id: Strategies_T.cpp 82294 2008-07-12 13:03:37Z johnnyw $
3 #ifndef ACE_STRATEGIES_T_CPP
4 #define ACE_STRATEGIES_T_CPP
6 #include "ace/Strategies_T.h"
8 #if !defined (ACE_LACKS_PRAGMA_ONCE)
10 #endif /* ACE_LACKS_PRAGMA_ONCE */
12 #include "ace/Service_Repository.h"
13 #include "ace/Service_Types.h"
14 #include "ace/Thread_Manager.h"
15 #include "ace/WFMO_Reactor.h"
17 #include "ace/OS_NS_dlfcn.h"
18 #include "ace/OS_NS_string.h"
19 #include "ace/OS_Errno.h"
20 #include "ace/Svc_Handler.h"
21 #if defined (ACE_OPENVMS)
22 # include "ace/Lib_Find.h"
25 #if !defined (__ACE_INLINE__)
26 #include "ace/Strategies_T.inl"
27 #endif /* __ACE_INLINE__ */
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 template<class SVC_HANDLER
>
32 ACE_Recycling_Strategy
<SVC_HANDLER
>::~ACE_Recycling_Strategy (void)
36 template<class SVC_HANDLER
> int
37 ACE_Recycling_Strategy
<SVC_HANDLER
>::assign_recycler (SVC_HANDLER
*svc_handler
,
38 ACE_Connection_Recycling_Strategy
*recycler
,
39 const void *recycling_act
)
41 svc_handler
->recycler (recycler
, recycling_act
);
45 template<class SVC_HANDLER
> int
46 ACE_Recycling_Strategy
<SVC_HANDLER
>::prepare_for_recycling (SVC_HANDLER
*svc_handler
)
48 return svc_handler
->recycle ();
51 template <class SVC_HANDLER
>
52 ACE_Singleton_Strategy
<SVC_HANDLER
>::~ACE_Singleton_Strategy (void)
54 ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::~ACE_Singleton_Strategy");
55 if (this->delete_svc_handler_
)
56 delete this->svc_handler_
;
59 // Create a Singleton SVC_HANDLER by always returning the same
62 template <class SVC_HANDLER
> int
63 ACE_Singleton_Strategy
<SVC_HANDLER
>::make_svc_handler (SVC_HANDLER
*&sh
)
65 ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::make_svc_handler");
66 sh
= this->svc_handler_
;
70 template <class SVC_HANDLER
> int
71 ACE_Singleton_Strategy
<SVC_HANDLER
>::open (SVC_HANDLER
*sh
,
74 ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::open");
76 if (this->delete_svc_handler_
)
77 delete this->svc_handler_
;
79 // If <sh> is NULL then create a new <SVC_HANDLER>.
82 ACE_NEW_RETURN (this->svc_handler_
,
85 this->delete_svc_handler_
= true;
89 this->svc_handler_
= sh
;
90 this->delete_svc_handler_
= false;
96 template <class SVC_HANDLER
> int
97 ACE_DLL_Strategy
<SVC_HANDLER
>::open (const ACE_TCHAR dll_name
[],
98 const ACE_TCHAR factory_function
[],
99 const ACE_TCHAR svc_name
[],
100 ACE_Service_Repository
*svc_rep
,
101 ACE_Thread_Manager
*thr_mgr
)
103 ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::open");
104 this->inherited::open (thr_mgr
);
105 ACE_OS::strcpy (this->dll_name_
, dll_name
);
106 ACE_OS::strcpy (this->factory_function_
, factory_function
);
107 ACE_OS::strcpy (this->svc_name_
, svc_name
);
108 this->svc_rep_
= svc_rep
;
112 // Create a SVC_HANDLER by dynamically linking it from a DLL.
114 template <class SVC_HANDLER
> int
115 ACE_DLL_Strategy
<SVC_HANDLER
>::make_svc_handler (SVC_HANDLER
*&sh
)
117 ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler");
119 // Open the shared library.
120 ACE_SHLIB_HANDLE handle
= ACE_OS::dlopen (this->dll_name_
);
122 // Extract the factory function.
123 #if defined (ACE_OPENVMS)
124 SVC_HANDLER
*(*factory
)(void) =
125 (SVC_HANDLER
*(*)(void)) ACE::ldsymbol (handle
,
126 this->factory_function_
);
128 SVC_HANDLER
*(*factory
)(void) =
129 (SVC_HANDLER
*(*)(void)) ACE_OS::dlsym (handle
,
130 this->factory_function_
);
133 // Call the factory function to obtain the new SVC_Handler (should
134 // use RTTI here when it becomes available...)
135 SVC_HANDLER
*svc_handler
= 0;
137 ACE_ALLOCATOR_RETURN (svc_handler
, (*factory
)(), -1);
139 if (svc_handler
!= 0)
141 // Create an ACE_Service_Type containing the SVC_Handler and
142 // insert into this->svc_rep_;
144 ACE_Service_Type_Impl
*stp
= 0;
146 ACE_Service_Object_Type (svc_handler
,
150 ACE_Service_Type
*srp
= 0;
153 ACE_Service_Type (this->svc_name_
,
165 if (this->svc_rep_
->insert (srp
) == -1)
167 // @@ Somehow, we need to deal with this->thr_mgr_...
174 // Default behavior is to activate the SVC_HANDLER by calling it's
175 // open() method, which allows the SVC_HANDLER to determine its own
176 // concurrency strategy.
178 template <class SVC_HANDLER
> int
179 ACE_Concurrency_Strategy
<SVC_HANDLER
>::activate_svc_handler (SVC_HANDLER
*svc_handler
,
182 ACE_TRACE ("ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler");
186 // See if we should enable non-blocking I/O on the <svc_handler>'s
188 if (ACE_BIT_ENABLED (this->flags_
, ACE_NONBLOCK
) != 0)
190 if (svc_handler
->peer ().enable (ACE_NONBLOCK
) == -1)
193 // Otherwise, make sure it's disabled by default.
194 else if (svc_handler
->peer ().disable (ACE_NONBLOCK
) == -1)
197 if (result
== 0 && svc_handler
->open (arg
) == -1)
201 // The connection was already made; so this close is a "normal" close
203 svc_handler
->close (NORMAL_CLOSE_OPERATION
);
208 template <class SVC_HANDLER
> int
209 ACE_Reactive_Strategy
<SVC_HANDLER
>::open (ACE_Reactor
*reactor
,
210 ACE_Reactor_Mask mask
,
213 ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::open");
214 this->reactor_
= reactor
;
216 this->flags_
= flags
;
218 // Must have a <Reactor>
219 if (this->reactor_
== 0)
225 template <class SVC_HANDLER
> int
226 ACE_Reactive_Strategy
<SVC_HANDLER
>::activate_svc_handler (SVC_HANDLER
*svc_handler
,
229 ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler");
233 if (this->reactor_
== 0)
236 // Register with the Reactor with the appropriate <mask>.
237 else if (this->reactor_
->register_handler (svc_handler
, this->mask_
) == -1)
240 // If the implementation of the reactor uses event associations
241 else if (this->reactor_
->uses_event_associations ())
243 // If we don't have non-block on, it won't work with
245 // This maybe too harsh
246 // if (!ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK))
248 if (svc_handler
->open (arg
) != -1)
254 // Call up to our parent to do the SVC_HANDLER initialization.
255 return this->inherited::activate_svc_handler (svc_handler
, arg
);
258 // The connection was already made; so this close is a "normal" close
260 svc_handler
->close (NORMAL_CLOSE_OPERATION
);
265 template <class SVC_HANDLER
> int
266 ACE_Thread_Strategy
<SVC_HANDLER
>::open (ACE_Thread_Manager
*thr_mgr
,
271 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::open");
272 this->thr_mgr_
= thr_mgr
;
273 this->n_threads_
= n_threads
;
274 this->thr_flags_
= thr_flags
;
275 this->flags_
= flags
;
277 // Must have a thread manager!
278 if (this->thr_mgr_
== 0)
279 ACE_ERROR_RETURN ((LM_ERROR
,
280 ACE_TEXT ("error: must have a non-NULL thread manager\n")),
286 template <class SVC_HANDLER
> int
287 ACE_Thread_Strategy
<SVC_HANDLER
>::activate_svc_handler (SVC_HANDLER
*svc_handler
,
290 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::activate_svc_handler");
291 // Call up to our parent to do the SVC_HANDLER initialization.
292 if (this->inherited::activate_svc_handler (svc_handler
,
296 // Turn the <svc_handler> into an active object (if it isn't
297 // already one as a result of the first activation...)
298 return svc_handler
->activate (this->thr_flags_
,
302 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
> int
303 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>::open
304 (const ACE_PEER_ACCEPTOR_ADDR
&local_addr
, int reuse_addr
)
306 this->reuse_addr_
= reuse_addr
;
307 this->peer_acceptor_addr_
= local_addr
;
308 if (this->peer_acceptor_
.open (local_addr
, reuse_addr
) == -1)
311 // Set the peer acceptor's handle into non-blocking mode. This is a
312 // safe-guard against the race condition that can otherwise occur
313 // between the time when <select> indicates that a passive-mode
314 // socket handle is "ready" and when we call <accept>. During this
315 // interval, the client can shutdown the connection, in which case,
316 // the <accept> call can hang!
317 this->peer_acceptor_
.enable (ACE_NONBLOCK
);
321 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
>
322 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>::ACE_Accept_Strategy
323 (const ACE_PEER_ACCEPTOR_ADDR
&local_addr
,
325 ACE_Reactor
*reactor
)
328 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::ACE_Accept_Strategy");
330 if (this->open (local_addr
, reuse_addr
) == -1)
331 ACE_ERROR ((LM_ERROR
,
336 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
> int
337 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>::accept_svc_handler
338 (SVC_HANDLER
*svc_handler
)
340 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler");
342 // Try to find out if the implementation of the reactor that we are
343 // using requires us to reset the event association for the newly
344 // created handle. This is because the newly created handle will
345 // inherit the properties of the listen handle, including its event
347 int reset_new_handle
= this->reactor_
->uses_event_associations ();
349 if (this->peer_acceptor_
.accept (svc_handler
->peer (), // stream
353 reset_new_handle
// reset new handler
356 // Ensure that errno is preserved in case the svc_handler
357 // close() method resets it
358 ACE_Errno_Guard
error(errno
);
360 // Close down handler to avoid memory leaks.
361 svc_handler
->close (CLOSE_DURING_NEW_CONNECTION
);
369 template <class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
> int
370 ACE_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
>::connect_svc_handler
372 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
373 ACE_Time_Value
*timeout
,
374 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
379 ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler");
381 return this->connector_
.connect (sh
->peer (),
390 template <class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
> int
391 ACE_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
>::connect_svc_handler
393 SVC_HANDLER
*&sh_copy
,
394 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
395 ACE_Time_Value
*timeout
,
396 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
401 ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_svc_handler");
404 this->connector_
.connect (sh
->peer (),
415 template <class SVC_HANDLER
> int
416 ACE_Process_Strategy
<SVC_HANDLER
>::open (size_t n_processes
,
417 ACE_Event_Handler
*acceptor
,
418 ACE_Reactor
*reactor
,
421 ACE_TRACE ("ACE_Process_Strategy<SVC_HANDLER>::open");
422 this->n_processes_
= n_processes
;
423 this->acceptor_
= acceptor
;
424 this->reactor_
= reactor
;
425 this->flags_
= avoid_zombies
;
430 template <class SVC_HANDLER
> int
431 ACE_Process_Strategy
<SVC_HANDLER
>::activate_svc_handler (SVC_HANDLER
*svc_handler
,
434 ACE_TRACE ("ACE_Process_Strategy<SVC_HANDLER>::activate_svc_handler");
436 // If <flags_> is non-0 then we won't create zombies.
437 switch (ACE::fork (ACE_TEXT ("child"), this->flags_
))
441 ACE_Errno_Guard
error (errno
);
442 svc_handler
->destroy ();
444 ACE_ERROR_RETURN ((LM_ERROR
,
449 case 0: // In child process.
451 // Close down the SOCK_Acceptor's handle since we don't need to
453 if (this->acceptor_
!= 0)
454 // Ignore the return value here...
455 (void) this->reactor_
->remove_handler (this->acceptor_
,
456 ACE_Event_Handler::ACCEPT_MASK
);
458 // Call up to our ancestor in the inheritance to do the
459 // SVC_HANDLER initialization.
460 return this->inherited::activate_svc_handler (svc_handler
, arg
);
462 default: // In parent process.
463 // We need to close down the <SVC_HANDLER> here because it's
464 // running in the child.
465 svc_handler
->destroy ();
470 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
>
471 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::ACE_Cached_Connect_Strategy
472 (creation_strategy_type
*cre_s
,
473 ACE_Concurrency_Strategy
<SVC_HANDLER
> *con_s
,
474 ACE_Recycling_Strategy
<SVC_HANDLER
> *rec_s
,
478 delete_lock_ (delete_lock
),
480 creation_strategy_ (0),
481 delete_creation_strategy_ (false),
482 concurrency_strategy_ (0),
483 delete_concurrency_strategy_ (false),
484 recycling_strategy_ (0),
485 delete_recycling_strategy_ (false)
487 // Create a new lock if necessary.
488 if (this->lock_
== 0)
490 ACE_NEW (this->lock_
,
493 this->delete_lock_
= true;
496 ACE_NEW (this->reverse_lock_
,
497 REVERSE_MUTEX (*this->lock_
));
499 if (this->open (cre_s
,
502 ACE_ERROR ((LM_ERROR
,
504 ACE_TEXT ("ACE_Cached_Connect_Strategy::ACE_Cached_Connect_Strategy")));
507 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
>
508 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::~ACE_Cached_Connect_Strategy (void)
510 if (this->delete_lock_
)
513 delete this->reverse_lock_
;
515 if (this->delete_creation_strategy_
)
516 delete this->creation_strategy_
;
517 this->delete_creation_strategy_
= false;
518 this->creation_strategy_
= 0;
520 if (this->delete_concurrency_strategy_
)
521 delete this->concurrency_strategy_
;
522 this->delete_concurrency_strategy_
= false;
523 this->concurrency_strategy_
= 0;
525 if (this->delete_recycling_strategy_
)
526 delete this->recycling_strategy_
;
527 this->delete_recycling_strategy_
= false;
528 this->recycling_strategy_
= 0;
530 // Close down all cached service handlers.
531 CONNECTION_MAP_ENTRY
*entry
= 0;
532 for (CONNECTION_MAP_ITERATOR
iterator (connection_map_
);
533 iterator
.next (entry
);
536 entry
->int_id_
->recycler (0, 0);
537 entry
->int_id_
->close ();
541 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
542 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::open
543 (creation_strategy_type
*cre_s
,
544 ACE_Concurrency_Strategy
<SVC_HANDLER
> *con_s
,
545 ACE_Recycling_Strategy
<SVC_HANDLER
> *rec_s
)
547 // Initialize the creation strategy.
549 // First we decide if we need to clean up.
550 if (this->creation_strategy_
!= 0 &&
551 this->delete_creation_strategy_
&&
554 delete this->creation_strategy_
;
555 this->creation_strategy_
= 0;
556 this->delete_creation_strategy_
= false;
560 this->creation_strategy_
= cre_s
;
561 else if (this->creation_strategy_
== 0)
563 ACE_NEW_RETURN (this->creation_strategy_
,
564 CREATION_STRATEGY
, -1);
565 this->delete_creation_strategy_
= true;
568 // Initialize the concurrency strategy.
570 if (this->concurrency_strategy_
!= 0 &&
571 this->delete_concurrency_strategy_
&&
574 delete this->concurrency_strategy_
;
575 this->concurrency_strategy_
= 0;
576 this->delete_concurrency_strategy_
= false;
580 this->concurrency_strategy_
= con_s
;
581 else if (this->concurrency_strategy_
== 0)
583 ACE_NEW_RETURN (this->concurrency_strategy_
,
584 CONCURRENCY_STRATEGY
, -1);
585 this->delete_concurrency_strategy_
= true;
588 // Initialize the recycling strategy.
590 if (this->recycling_strategy_
!= 0 &&
591 this->delete_recycling_strategy_
&&
594 delete this->recycling_strategy_
;
595 this->recycling_strategy_
= 0;
596 this->delete_recycling_strategy_
= false;
600 this->recycling_strategy_
= rec_s
;
601 else if (this->recycling_strategy_
== 0)
603 ACE_NEW_RETURN (this->recycling_strategy_
,
604 RECYCLING_STRATEGY
, -1);
605 this->delete_recycling_strategy_
= true;
611 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
612 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::make_svc_handler
615 return this->creation_strategy_
->make_svc_handler (sh
);
618 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
619 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::activate_svc_handler
620 (SVC_HANDLER
*svc_handler
)
622 return this->concurrency_strategy_
->activate_svc_handler (svc_handler
);
625 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
626 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::assign_recycler
627 (SVC_HANDLER
*svc_handler
,
628 ACE_Connection_Recycling_Strategy
*recycler
,
629 const void *recycling_act
)
631 return this->recycling_strategy_
->assign_recycler (svc_handler
,
636 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
637 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::prepare_for_recycling
638 (SVC_HANDLER
*svc_handler
)
640 return this->recycling_strategy_
->prepare_for_recycling (svc_handler
);
643 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
644 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::check_hint_i
646 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
647 ACE_Time_Value
*timeout
,
648 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
652 CONNECTION_MAP_ENTRY
*&entry
,
655 ACE_UNUSED_ARG (remote_addr
);
656 ACE_UNUSED_ARG (timeout
);
657 ACE_UNUSED_ARG (local_addr
);
658 ACE_UNUSED_ARG (reuse_addr
);
659 ACE_UNUSED_ARG (flags
);
660 ACE_UNUSED_ARG (perms
);
664 // Get the recycling act for the svc_handler
665 CONNECTION_MAP_ENTRY
*possible_entry
= (CONNECTION_MAP_ENTRY
*) sh
->recycling_act ();
667 // Check to see if the hint svc_handler has been closed down
668 if (possible_entry
->ext_id_
.recycle_state () == ACE_RECYCLABLE_CLOSED
)
670 // If close, decrement refcount
671 if (possible_entry
->ext_id_
.decrement () == 0)
673 // If refcount goes to zero, close down the svc_handler
674 possible_entry
->int_id_
->recycler (0, 0);
675 possible_entry
->int_id_
->close ();
676 this->purge_i (possible_entry
);
679 // Hint not successful
686 // If hint is not closed, see if it is connected to the correct
687 // address and is recyclable
688 else if ((possible_entry
->ext_id_
.recycle_state () == ACE_RECYCLABLE_IDLE_AND_PURGABLE
||
689 possible_entry
->ext_id_
.recycle_state () == ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE
) &&
690 possible_entry
->ext_id_
.subject () == remote_addr
)
695 // Tell the <svc_handler> that it should prepare itself for
697 this->prepare_for_recycling (sh
);
701 // This hint will not be used.
702 possible_entry
->ext_id_
.decrement ();
704 // Hint not successful
707 // If <sh> is not connected to the correct address or is busy,
708 // we will not use it.
713 entry
= possible_entry
;
718 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
719 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::find_or_create_svc_handler_i
721 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
722 ACE_Time_Value
*timeout
,
723 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
727 CONNECTION_MAP_ENTRY
*&entry
,
730 // Explicit type conversion
731 REFCOUNTED_HASH_RECYCLABLE_ADDRESS
search_addr (remote_addr
);
733 // Try to find the address in the cache. Only if we don't find it
734 // do we create a new <SVC_HANDLER> and connect it with the server.
735 if (this->find (search_addr
, entry
) == -1)
740 // We need to use a temporary variable here since we are not
741 // allowed to change <sh> because other threads may use this
742 // when we let go of the lock during the OS level connect.
744 // Note that making a new svc_handler, connecting remotely,
745 // binding to the map, and assigning of the hint and recycler
746 // should be atomic to the outside world.
747 SVC_HANDLER
*potential_handler
= 0;
749 // Create a new svc_handler
750 if (this->make_svc_handler (potential_handler
) == -1)
753 // Actively establish the connection. This is a timed blocking
755 if (this->new_connection (potential_handler
,
763 // If connect() failed because of timeouts, we have to
764 // reject the connection entirely. This is necessary since
765 // currently there is no way for the non-blocking connects
766 // to complete and for the <Connector> to notify the cache
767 // of the completion of connect().
768 if (errno
== EWOULDBLOCK
)
771 // Close the svc handler.
772 potential_handler
->close (0);
778 // Insert the new SVC_HANDLER instance into the cache.
779 if (this->connection_map_
.bind (search_addr
,
783 // Close the svc handler.
784 potential_handler
->close (CLOSE_DURING_NEW_CONNECTION
);
789 // Everything succeeded as planned. Assign <sh> to <potential_handler>.
790 sh
= potential_handler
;
792 // Set the recycler and the recycling act
793 this->assign_recycler (sh
, this, entry
);
797 // We found a cached svc_handler.
802 // Get the cached <svc_handler>
805 // Tell the <svc_handler> that it should prepare itself for
807 this->prepare_for_recycling (sh
);
813 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
814 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::new_connection
816 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
817 ACE_Time_Value
*timeout
,
818 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
823 // Yow, Reverse Guard! Let go of the lock for the duration of the
824 // actual connect. This will allow other threads to hack on the
825 // connection cache while this thread creates the new connection.
826 ACE_GUARD_RETURN (REVERSE_MUTEX
, ace_mon
, *this->reverse_lock_
, -1);
828 return this->CONNECT_STRATEGY::connect_svc_handler (sh
,
837 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
838 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::connect_svc_handler
840 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
841 ACE_Time_Value
*timeout
,
842 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
849 // This artificial scope is required since we need to let go of the
850 // lock *before* registering the newly created handler with the
853 // Synchronization is required here as the setting of the
854 // recyclable state must be done atomically with the finding and
855 // binding of the service handler in the cache.
856 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
858 int result
= this->connect_svc_handler_i (sh
,
871 // If it is a new connection, activate it.
873 // Note: This activation is outside the scope of the lock of the
874 // cached connector. This is necessary to avoid subtle deadlock
875 // conditions with this lock and the Reactor lock.
879 if (this->activate_svc_handler (sh
) == -1)
881 // If an error occurs while activating the handler, the
882 // <activate_svc_handler> method will close the handler.
883 // This in turn will remove this entry from the internal
886 // Synchronization is required here as the setting of the
887 // handler to zero must be done atomically with the users of
889 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
901 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
902 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::connect_svc_handler
904 SVC_HANDLER
*&sh_copy
,
905 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
906 ACE_Time_Value
*timeout
,
907 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
914 // This artificial scope is required since we need to let go of the
915 // lock *before* registering the newly created handler with the
918 // Synchronization is required here as the setting of the
919 // recyclable state must be done atomically with the finding and
920 // binding of the service handler in the cache.
921 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
923 int result
= this->connect_svc_handler_i (sh
,
938 // If it is a new connection, activate it.
940 // Note: This activation is outside the scope of the lock of the
941 // cached connector. This is necessary to avoid subtle deadlock
942 // conditions with this lock and the Reactor lock.
946 if (this->activate_svc_handler (sh_copy
) == -1)
948 // If an error occurs while activating the handler, the
949 // <activate_svc_handler> method will close the handler.
950 // This in turn will remove this entry from the internal
953 // Synchronization is required here as the setting of the
954 // handler to zero must be done atomically with the users of
956 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
969 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
970 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::connect_svc_handler_i
972 const ACE_PEER_CONNECTOR_ADDR
&remote_addr
,
973 ACE_Time_Value
*timeout
,
974 const ACE_PEER_CONNECTOR_ADDR
&local_addr
,
980 CONNECTION_MAP_ENTRY
*entry
= 0;
982 // Check if the user passed a hint svc_handler
985 int result
= this->check_hint_i (sh
,
1001 int result
= this->find_or_create_svc_handler_i (sh
,
1014 // For all successful cases: mark the <svc_handler> in the cache
1015 // as being <in_use>. Therefore recyclable is BUSY.
1016 entry
->ext_id_
.recycle_state (ACE_RECYCLABLE_BUSY
);
1018 // And increment the refcount
1019 entry
->ext_id_
.increment ();
1024 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1025 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::cache (const void *recycling_act
)
1027 // Synchronization is required here as the setting of the recyclable
1028 // state must be done atomically with respect to other threads that
1029 // are querying the cache.
1030 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
1032 return this->cache_i (recycling_act
);
1035 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1036 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::cache_i (const void *recycling_act
)
1038 // The wonders and perils of ACT
1039 CONNECTION_MAP_ENTRY
*entry
= (CONNECTION_MAP_ENTRY
*) recycling_act
;
1041 // Mark the <svc_handler> in the cache as not being <in_use>.
1042 // Therefore recyclable is IDLE.
1043 entry
->ext_id_
.recycle_state (ACE_RECYCLABLE_IDLE_AND_PURGABLE
);
1048 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1049 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::recycle_state (const void *recycling_act
,
1050 ACE_Recyclable_State new_state
)
1052 // Synchronization is required here as the setting of the recyclable
1053 // state must be done atomically with respect to other threads that
1054 // are querying the cache.
1055 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
1057 return this->recycle_state_i (recycling_act
,
1061 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1062 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::recycle_state_i (const void *recycling_act
,
1063 ACE_Recyclable_State new_state
)
1065 // The wonders and perils of ACT
1066 CONNECTION_MAP_ENTRY
*entry
= (CONNECTION_MAP_ENTRY
*) recycling_act
;
1068 // Mark the <svc_handler> in the cache as not being <in_use>.
1069 // Therefore recyclable is IDLE.
1070 entry
->ext_id_
.recycle_state (new_state
);
1075 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> ACE_Recyclable_State
1076 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::recycle_state (const void *recycling_act
) const
1079 SELF
*fake_this
= const_cast<SELF
*> (this);
1081 // Synchronization is required here.
1082 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *fake_this
->lock_
, ACE_RECYCLABLE_UNKNOWN
);
1084 return this->recycle_state_i (recycling_act
);
1087 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> ACE_Recyclable_State
1088 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::recycle_state_i (const void *recycling_act
) const
1090 // The wonders and perils of ACT
1091 CONNECTION_MAP_ENTRY
*entry
= (CONNECTION_MAP_ENTRY
*) recycling_act
;
1093 // Mark the <svc_handler> in the cache as not being <in_use>.
1094 // Therefore recyclable is IDLE.
1095 return entry
->ext_id_
.recycle_state ();
1098 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1099 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::purge (const void *recycling_act
)
1101 // Excluded other threads from changing cache while we take this
1103 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
1105 return this->purge_i (recycling_act
);
1108 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1109 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::purge_i (const void *recycling_act
)
1111 // The wonders and perils of ACT
1112 CONNECTION_MAP_ENTRY
*entry
= (CONNECTION_MAP_ENTRY
*) recycling_act
;
1114 return this->connection_map_
.unbind (entry
);
1117 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1118 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::mark_as_closed (const void *recycling_act
)
1120 // Excluded other threads from changing cache while we take this
1122 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
1124 return this->mark_as_closed_i (recycling_act
);
1127 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1128 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::mark_as_closed_i (const void *recycling_act
)
1130 // The wonders and perils of ACT
1131 CONNECTION_MAP_ENTRY
*entry
= (CONNECTION_MAP_ENTRY
*) recycling_act
;
1133 // Mark the <svc_handler> in the cache as CLOSED.
1134 entry
->ext_id_
.recycle_state (ACE_RECYCLABLE_CLOSED
);
1139 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1140 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::cleanup_hint (const void *recycling_act
,
1143 // Excluded other threads from changing cache while we take this
1145 ACE_GUARD_RETURN (MUTEX
, ace_mon
, *this->lock_
, -1);
1147 return this->cleanup_hint_i (recycling_act
,
1151 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1152 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::cleanup_hint_i (const void *recycling_act
,
1155 // Reset the <*act_holder> in the confines and protection of the
1160 // The wonders and perils of ACT
1161 CONNECTION_MAP_ENTRY
*entry
= (CONNECTION_MAP_ENTRY
*) recycling_act
;
1163 // Decrement the refcount on the <svc_handler>.
1164 int refcount
= entry
->ext_id_
.decrement ();
1166 // If the svc_handler state is closed and the refcount == 0, call
1167 // close() on svc_handler.
1168 if (entry
->ext_id_
.recycle_state () == ACE_RECYCLABLE_CLOSED
&&
1171 entry
->int_id_
->recycler (0, 0);
1172 entry
->int_id_
->close ();
1173 this->purge_i (entry
);
1179 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> ACE_Creation_Strategy
<SVC_HANDLER
> *
1180 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::creation_strategy (void) const
1182 return this->creation_strategy_
;
1185 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> ACE_Recycling_Strategy
<SVC_HANDLER
> *
1186 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::recycling_strategy (void) const
1188 return this->recycling_strategy_
;
1191 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> ACE_Concurrency_Strategy
<SVC_HANDLER
> *
1192 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::concurrency_strategy (void) const
1194 return this->concurrency_strategy_
;
1197 template<class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
, class MUTEX
> int
1198 ACE_Cached_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
, MUTEX
>::find (
1199 REFCOUNTED_HASH_RECYCLABLE_ADDRESS
&search_addr
,
1200 CONNECTION_MAP_ENTRY
*&entry
)
1202 typedef ACE_Hash_Map_Bucket_Iterator
<REFCOUNTED_HASH_RECYCLABLE_ADDRESS
,
1204 ACE_Hash
<REFCOUNTED_HASH_RECYCLABLE_ADDRESS
>,
1205 ACE_Equal_To
<REFCOUNTED_HASH_RECYCLABLE_ADDRESS
>,
1207 CONNECTION_MAP_BUCKET_ITERATOR
;
1209 CONNECTION_MAP_BUCKET_ITERATOR
iterator (this->connection_map_
,
1212 CONNECTION_MAP_BUCKET_ITERATOR
end (this->connection_map_
,
1220 REFCOUNTED_HASH_RECYCLABLE_ADDRESS
&addr
= (*iterator
).ext_id_
;
1222 if (addr
.recycle_state () != ACE_RECYCLABLE_IDLE_AND_PURGABLE
&&
1223 addr
.recycle_state () != ACE_RECYCLABLE_IDLE_BUT_NOT_PURGABLE
)
1226 if (addr
.subject () != search_addr
.subject ())
1229 entry
= &(*iterator
);
1236 template <class SVC_HANDLER
> void
1237 ACE_DLL_Strategy
<SVC_HANDLER
>::dump (void) const
1239 #if defined (ACE_HAS_DUMP)
1240 ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::dump");
1241 #endif /* ACE_HAS_DUMP */
1244 template <class SVC_HANDLER
>
1245 ACE_Concurrency_Strategy
<SVC_HANDLER
>::~ACE_Concurrency_Strategy (void)
1247 ACE_TRACE ("ACE_Concurrency_Strategy<SVC_HANDLER>::~ACE_Concurrency_Strategy");
1251 template <class SVC_HANDLER
> void
1252 ACE_Concurrency_Strategy
<SVC_HANDLER
>::dump (void) const
1254 #if defined (ACE_HAS_DUMP)
1255 ACE_TRACE ("ACE_Concurrency_Strategy<SVC_HANDLER>::dump");
1256 #endif /* ACE_HAS_DUMP */
1259 template <class SVC_HANDLER
>
1260 ACE_Reactive_Strategy
<SVC_HANDLER
>::~ACE_Reactive_Strategy (void)
1262 ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::~ACE_Reactive_Strategy");
1266 template <class SVC_HANDLER
> void
1267 ACE_Reactive_Strategy
<SVC_HANDLER
>::dump (void) const
1269 #if defined (ACE_HAS_DUMP)
1270 ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::dump");
1271 #endif /* ACE_HAS_DUMP */
1274 template <class SVC_HANDLER
>
1275 ACE_Thread_Strategy
<SVC_HANDLER
>::~ACE_Thread_Strategy (void)
1277 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::~ACE_Thread_Strategy");
1280 template <class SVC_HANDLER
> void
1281 ACE_Thread_Strategy
<SVC_HANDLER
>::dump (void) const
1283 #if defined (ACE_HAS_DUMP)
1284 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::dump");
1285 #endif /* ACE_HAS_DUMP */
1288 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
>
1289 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>::~ACE_Accept_Strategy (void)
1291 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::~ACE_Accept_Strategy");
1293 // Close the underlying acceptor.
1294 this->peer_acceptor_
.close ();
1297 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
> ACE_HANDLE
1298 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>::get_handle (void) const
1300 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle");
1301 return this->peer_acceptor_
.get_handle ();
1304 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
> ACE_PEER_ACCEPTOR
&
1305 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>::acceptor (void) const
1307 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor");
1308 return (ACE_PEER_ACCEPTOR
&) this->peer_acceptor_
;
1311 template <class SVC_HANDLER
, ACE_PEER_ACCEPTOR_1
> void
1312 ACE_Accept_Strategy
<SVC_HANDLER
, ACE_PEER_ACCEPTOR_2
>::dump (void) const
1314 #if defined (ACE_HAS_DUMP)
1315 ACE_TRACE ("ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::dump");
1316 #endif /* ACE_HAS_DUMP */
1319 template <class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
>
1320 ACE_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
>::~ACE_Connect_Strategy (void)
1322 ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::~ACE_Connect_Strategy");
1325 template <class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
> ACE_PEER_CONNECTOR
&
1326 ACE_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
>::connector (void) const
1328 ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connector");
1329 return (ACE_PEER_CONNECTOR
&) this->connector_
;
1332 template <class SVC_HANDLER
, ACE_PEER_CONNECTOR_1
> void
1333 ACE_Connect_Strategy
<SVC_HANDLER
, ACE_PEER_CONNECTOR_2
>::dump (void) const
1335 #if defined (ACE_HAS_DUMP)
1336 ACE_TRACE ("ACE_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::dump");
1337 #endif /* ACE_HAS_DUMP */
1340 template <class SVC_HANDLER
>
1341 ACE_Process_Strategy
<SVC_HANDLER
>::~ACE_Process_Strategy (void)
1343 ACE_TRACE ("ACE_Process_Strategy<SVC_HANDLER>::~ACE_Process_Strategy");
1346 template <class SVC_HANDLER
> void
1347 ACE_Process_Strategy
<SVC_HANDLER
>::dump (void) const
1349 #if defined (ACE_HAS_DUMP)
1350 ACE_TRACE ("ACE_Process_Strategy<SVC_HANDLER>::dump");
1351 #endif /* ACE_HAS_DUMP */
1354 template <class SVC_HANDLER
>
1355 ACE_Scheduling_Strategy
<SVC_HANDLER
>::~ACE_Scheduling_Strategy (void)
1357 ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::~ACE_Scheduling_Strategy");
1360 template <class SVC_HANDLER
> int
1361 ACE_Scheduling_Strategy
<SVC_HANDLER
>::suspend (void)
1363 ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::suspend");
1367 template <class SVC_HANDLER
> int
1368 ACE_Scheduling_Strategy
<SVC_HANDLER
>::resume (void)
1370 ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::resume");
1374 template <class SVC_HANDLER
> void
1375 ACE_Scheduling_Strategy
<SVC_HANDLER
>::dump (void) const
1377 #if defined (ACE_HAS_DUMP)
1378 ACE_TRACE ("ACE_Scheduling_Strategy<SVC_HANDLER>::dump");
1380 ACE_DEBUG ((LM_DEBUG
, ACE_BEGIN_DUMP
, this));
1381 ACE_DEBUG ((LM_DEBUG
, ACE_END_DUMP
));
1382 #endif /* ACE_HAS_DUMP */
1385 template <class SVC_HANDLER
> int
1386 ACE_Schedule_All_Reactive_Strategy
<SVC_HANDLER
>::suspend (void)
1388 ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::suspend");
1389 return this->reactor_
->suspend_handlers ();
1392 template <class SVC_HANDLER
> int
1393 ACE_Schedule_All_Reactive_Strategy
<SVC_HANDLER
>::resume (void)
1395 ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::resume");
1396 return this->reactor_
->resume_handlers ();
1399 template <class SVC_HANDLER
> void
1400 ACE_Schedule_All_Reactive_Strategy
<SVC_HANDLER
>::dump (void) const
1402 #if defined (ACE_HAS_DUMP)
1403 ACE_TRACE ("ACE_Schedule_All_Reactive_Strategy<SVC_HANDLER>::dump");
1405 ACE_Scheduling_Strategy
<SVC_HANDLER
>::dump ();
1406 #endif /* ACE_HAS_DUMP */
1409 template <class SVC_HANDLER
> int
1410 ACE_Schedule_All_Threaded_Strategy
<SVC_HANDLER
>::suspend (void)
1412 ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::suspend");
1413 return this->thr_mgr_
->suspend_all ();
1416 template <class SVC_HANDLER
> int
1417 ACE_Schedule_All_Threaded_Strategy
<SVC_HANDLER
>::resume (void)
1419 ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::resume");
1420 return this->thr_mgr_
->resume_all ();
1423 template <class SVC_HANDLER
> void
1424 ACE_Schedule_All_Threaded_Strategy
<SVC_HANDLER
>::dump (void) const
1426 #if defined (ACE_HAS_DUMP)
1427 ACE_TRACE ("ACE_Schedule_All_Threaded_Strategy<SVC_HANDLER>::dump");
1429 ACE_Scheduling_Strategy
<SVC_HANDLER
>::dump ();
1430 #endif /* ACE_HAS_DUMP */
1434 ACE_Refcounted_Hash_Recyclable
<T
>::~ACE_Refcounted_Hash_Recyclable (void)
1438 template <class SVC_HANDLER
> void
1439 ACE_Singleton_Strategy
<SVC_HANDLER
>::dump (void) const
1441 #if defined (ACE_HAS_DUMP)
1442 ACE_TRACE ("ACE_Singleton_Strategy<SVC_HANDLER>::dump");
1443 #endif /* ACE_HAS_DUMP */
1446 template <class SVC_HANDLER
>
1447 ACE_Creation_Strategy
<SVC_HANDLER
>::~ACE_Creation_Strategy (void)
1449 ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::~ACE_Creation_Strategy");
1452 // Default behavior is to make a new SVC_HANDLER, passing in the
1453 // Thread_Manager (if any).
1455 template <class SVC_HANDLER
> int
1456 ACE_Creation_Strategy
<SVC_HANDLER
>::make_svc_handler (SVC_HANDLER
*&sh
)
1458 ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler");
1461 ACE_NEW_RETURN (sh
, SVC_HANDLER (this->thr_mgr_
), -1);
1462 sh
->reactor (this->reactor_
);
1466 template <class SVC_HANDLER
> void
1467 ACE_Creation_Strategy
<SVC_HANDLER
>::dump (void) const
1469 #if defined (ACE_HAS_DUMP)
1470 ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::dump");
1471 #endif /* ACE_HAS_DUMP */
1474 template <class SVC_HANDLER
> int
1475 ACE_NOOP_Creation_Strategy
<SVC_HANDLER
>::make_svc_handler (SVC_HANDLER
*&)
1477 ACE_TRACE ("ACE_NOOP_Creation_Strategy<SVC_HANDLER>::make_svc_handler");
1481 template <class SVC_HANDLER
> int
1482 ACE_NOOP_Concurrency_Strategy
<SVC_HANDLER
>::activate_svc_handler (SVC_HANDLER
*,
1485 ACE_TRACE ("ACE_NOOP_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler");
1490 ACE_ALLOC_HOOK_DEFINE(ACE_Creation_Strategy
)
1491 ACE_ALLOC_HOOK_DEFINE(ACE_Singleton_Strategy
)
1492 ACE_ALLOC_HOOK_DEFINE(ACE_DLL_Strategy
)
1493 ACE_ALLOC_HOOK_DEFINE(ACE_Concurrency_Strategy
)
1494 ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy
)
1495 ACE_ALLOC_HOOK_DEFINE(ACE_Connect_Strategy
)
1496 ACE_ALLOC_HOOK_DEFINE(ACE_Process_Strategy
)
1497 ACE_ALLOC_HOOK_DEFINE(ACE_Accept_Strategy
)
1498 ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy
)
1500 ACE_END_VERSIONED_NAMESPACE_DECL
1502 #endif /* ACE_STRATEGIES_T_CPP */