1 #include "tao/Dynamic_TP/DTP_POA_Strategy.h"
2 #include "tao/CSD_Framework/CSD_Strategy_Repository.h"
4 #include "ace/OS_NS_stdio.h"
5 #include "ace/Service_Config.h"
6 #include "ace/Dynamic_Service.h"
11 show_tp_config (const ACE_CString
&name
, const TAO_DTP_Definition
&entry
)
13 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("Config set for %C:\n"), name
.c_str()));
14 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (" Initial threads: %d:\n"), entry
.init_threads_
));
15 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (" Min threads: %d:\n"), entry
.min_threads_
));
16 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (" Max threads: %d:\n"), entry
.max_threads_
));
17 if (entry
.min_threads_
> -1)
18 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (" Idle Timeout: %d (sec)\n"), entry
.timeout_
.sec()));
19 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (" Stack Size: %d:\n"), entry
.stack_size_
));
20 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (" Request queue max depth: %d\n"), entry
.queue_depth_
));
24 //show_poa_config (const ACE_CString &name, TAO_DTP_POA_Strategy * strat)
26 //ACE_DEBUG ((LM_INFO, ACE_TEXT ("POA [%C] has the configuration key [%C]\n"), name.c_str(),strat->get_tp_config().c_str()));
27 //ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Initial threads: %d:\n"), entry.init_threads_));
28 //ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Min threads: %d:\n"), entry.min_threads_));
29 //ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Max threads: %d:\n"), entry.max_threads_));
30 //if (entry.min_threads_ > -1)
31 // ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Idle Timeout: %d (sec)\n"), entry.timeout_));
32 //ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Stack Size: %d:\n"), entry.stack_size_));
33 //ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" Request queue max depth: %d\n"), entry.queue_depth_));
37 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
41 ACE_Service_Config::open (argc
, argv
);
43 // Dump the POA to Strategy map
44 TAO_CSD_Strategy_Repository
* dtp_poa_strat_repo
=
45 ACE_Dynamic_Service
<TAO_CSD_Strategy_Repository
>::instance
46 ("TAO_CSD_Strategy_Repository");
48 if (dtp_poa_strat_repo
== 0)
50 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("Unable to load configuration\n")));
55 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("TAO_CSD_Strategy_Repository found\n")));
59 // Now iterate through the repository and attempt to find sample POA configurations
61 const ACE_TCHAR
*poa_list
[] =
62 { ACE_TEXT ("MyPOA"), // should find this one
63 ACE_TEXT ("POA2"), // shouldn't find this one
64 ACE_TEXT ("MyPOA3"), // should find this one
65 ACE_TEXT ("MyPOA1"), // should find this one
69 TAO_DTP_POA_Strategy
* mapped_strategy
;
71 for (int i
= 0; poa_list
[i
] != 0; i
++)
74 ACE_DEBUG ((LM_INFO
, ACE_TEXT("Config definition for %C\n"), poa_list
[i
]));
75 mapped_strategy
= dynamic_cast <TAO_DTP_POA_Strategy
*>
76 (dtp_poa_strat_repo
->find (ACE_TEXT_ALWAYS_CHAR (poa_list
[i
])));
77 if ((mapped_strategy
== 0) && (i
!= 1) && (i
!= 3))
79 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("Cannot find TP Config definition for %C\n"), poa_list
[i
]));
86 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("Found TP Config definition for %C which should have failed\n"), poa_list
[i
]));
90 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("Config definition for %C not found as expected\n"), poa_list
[i
]));
95 //show_poa_config (poa_list[i], mapped_strategy);