summaryrefslogtreecommitdiff
path: root/TAO/examples/CSD_Strategy/ThreadPool
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:11 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:11 +0000
commit6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (patch)
treeda50d054f9c761c3f6a5923f6979e93306c56d68 /TAO/examples/CSD_Strategy/ThreadPool
parent0e555b9150d38e3b3473ba325b56db2642e6352b (diff)
downloadATCD-6b846cf03c0bcbd8c276cb0af61a181e5f98eaae.tar.gz
Repo restructuring
Diffstat (limited to 'TAO/examples/CSD_Strategy/ThreadPool')
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/CSD_Test_ThreadPool.mpc25
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/ClientApp.cpp143
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/ClientApp.h29
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/Foo.idl29
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/Foo_i.cpp112
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/Foo_i.h48
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/Makefile.am129
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.cpp77
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.h41
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/README57
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp240
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/ServerApp.h30
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/client_main.cpp45
-rwxr-xr-xTAO/examples/CSD_Strategy/ThreadPool/run_test.pl61
-rw-r--r--TAO/examples/CSD_Strategy/ThreadPool/server_main.cpp43
15 files changed, 0 insertions, 1109 deletions
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/CSD_Test_ThreadPool.mpc b/TAO/examples/CSD_Strategy/ThreadPool/CSD_Test_ThreadPool.mpc
deleted file mode 100644
index ee5b527e7c6..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/CSD_Test_ThreadPool.mpc
+++ /dev/null
@@ -1,25 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project(*Server) : csd_threadpool, taoserver, pi {
- exename = server_main
-
- Source_Files {
- Foo_i.cpp
- ServerApp.cpp
- server_main.cpp
- OrbShutdownTask.cpp
- }
-}
-
-project(*Client): taoexe, anytypecode {
- exename = client_main
- after += *Server
-
- Source_Files {
- FooC.cpp
- ClientApp.cpp
- client_main.cpp
- }
-}
-
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/ClientApp.cpp b/TAO/examples/CSD_Strategy/ThreadPool/ClientApp.cpp
deleted file mode 100644
index a81a617566c..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/ClientApp.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-// $Id$
-#include "ClientApp.h"
-#include "FooC.h"
-#include "ace/Get_Opt.h"
-#include "ace/Log_Msg.h"
-
-
-ClientApp::ClientApp()
-{
-}
-
-
-ClientApp::~ClientApp()
-{
-}
-
-
-int
-ClientApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL)
-{
- CORBA::ORB_var orb
- = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- // Parse the command-line args for this application.
- // * Raises -1 if problems are encountered.
- // * Returns 1 if the usage statement was explicitly requested.
- // * Returns 0 otherwise.
- int result = this->parse_args(argc, argv);
- if (result != 0)
- {
- return result;
- }
-
- CORBA::Object_var obj
- = orb->string_to_object(this->ior_.c_str() ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (CORBA::is_nil(obj.in()))
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Failed to convert IOR string to obj ref.\n"));
- ACE_THROW_RETURN (TestException(), -1);
- }
-
- Foo_var foo = Foo::_narrow(obj.in() ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (CORBA::is_nil(foo.in()))
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Failed to narrow obj ref to Foo interface.\n"));
- ACE_THROW_RETURN (TestException(), -1);
- }
-
- for (CORBA::Long i = 1; i <= 100; i++)
- {
- foo->op1(ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
- foo->op2(i ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
- CORBA::Long value = foo->op3(ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ===> Value retrieved from op3() == %d\n",
- value));
-
- for (CORBA::Long j = 1; j <= 5; j++)
- {
- foo->op4(495 + (i * 5) + j ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
- }
-
- ACE_TRY_NEW_ENV
- {
- foo->op5(ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCH (FooException, ex)
- {
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ===> Caught FooException - as expected.\n"));
-
- }
- ACE_ENDTRY;
- }
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ===> Tell server that we are done().\n"));
-
- foo->done(ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ===> Back from done().\n"));
-
- return 0;
-}
-
-
-int
-ClientApp::parse_args(int argc, char* argv[])
-{
- this->exe_name_ = argv[0];
-
- ACE_Get_Opt get_opts(argc, argv, "i:");
-
- int c;
-
- while ((c = get_opts()) != -1)
- {
- switch (c)
- {
- case 'i':
- this->ior_ = get_opts.opt_arg();
- break;
-
- case '?':
- this->usage_statement();
- return 1;
-
- default:
- this->usage_statement();
- return -1;
- }
- }
-
- return 0;
-}
-
-
-void
-ClientApp::usage_statement()
-{
- ACE_ERROR((LM_ERROR,
- "Usage: %s [options]\n\n"
- "OPTIONS:\n\n"
- "\t[-i <ior>]\n"
- "\t[-?]\n\n",
- this->exe_name_.c_str()));
-}
-
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/ClientApp.h b/TAO/examples/CSD_Strategy/ThreadPool/ClientApp.h
deleted file mode 100644
index 1c706005563..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/ClientApp.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id$
-#ifndef CLIENTAPP_H
-#define CLIENTAPP_H
-
-#include "ace/SString.h"
-#include "ace/CORBA_macros.h"
-#include "tao/Environment.h"
-
-class ClientApp
-{
- public:
-
- ClientApp();
- ~ClientApp();
-
- int run(int argc, char* argv[] ACE_ENV_ARG_DECL);
-
-
- private:
-
- int parse_args(int argc, char* argv[]);
- void usage_statement();
-
- ACE_CString ior_;
-
- ACE_CString exe_name_;
-};
-
-#endif
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/Foo.idl b/TAO/examples/CSD_Strategy/ThreadPool/Foo.idl
deleted file mode 100644
index f4a756a31b1..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/Foo.idl
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id$
-#ifndef FOO_IDL
-#define FOO_IDL
-
-exception FooException {};
-exception TestException {};
-
-interface Foo
-{
- /// void return-type, no arguments
- void op1();
-
- /// void return-type, 1 "in" argument
- void op2(in long value);
-
- /// long return-type, no arguments
- long op3();
-
- /// one-way version of op2
- oneway void op4(in long value);
-
- /// Operation that always raises an exception.
- void op5() raises (FooException);
-
- /// Client calls this last. It will shutdown the server.
- void done();
-};
-
-#endif
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/Foo_i.cpp b/TAO/examples/CSD_Strategy/ThreadPool/Foo_i.cpp
deleted file mode 100644
index 66e424d8781..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/Foo_i.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// $Id$
-#include "Foo_i.h"
-#include "OrbShutdownTask.h"
-#include "ace/OS.h"
-
-Foo_i::Foo_i(unsigned num_clients)
- : value_(0),
- num_clients_(num_clients),
- count_op1_(0),
- count_op2_(0),
- count_op3_(0),
- count_op4_(0),
- count_op5_(0)
-{
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) Number of clients for Foo_i servant: %d\n",
- num_clients));
-}
-
-
-Foo_i::~Foo_i()
-{
-}
-
-
-void
-Foo_i::op1(ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC((CORBA::SystemException))
-{
- ++this->count_op1_;
- // Sleep for 10 milliseconds (10,000 microseconds)
- //ACE_OS::sleep(ACE_Time_Value(0,10000));
-}
-
-
-void
-Foo_i::op2(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC((CORBA::SystemException))
-{
- ++this->count_op2_;
- this->value_ = value;
-}
-
-
-CORBA::Long
-Foo_i::op3(ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC((CORBA::SystemException))
-{
- ++this->count_op3_;
- return this->value_;
-}
-
-
-void
-Foo_i::op4(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC((CORBA::SystemException))
-{
- ++this->count_op4_;
- this->value_ = value;
-
- if (this->count_op4_ % 500 == 0)
- {
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) op4() has been called %d times now. value == %d\n",
- this->count_op4_, this->value_));
- }
-
- // Sleep for 10 milliseconds (10,000 microseconds)
- //ACE_OS::sleep(ACE_Time_Value(0,10000));
-}
-
-
-void
-Foo_i::op5(ACE_ENV_SINGLE_ARG_DECL)
- ACE_THROW_SPEC((CORBA::SystemException, FooException))
-{
- ++this->count_op5_;
- ACE_THROW_SPEC (FooException());
-}
-
-
-void
-Foo_i::done(ACE_ENV_SINGLE_ARG_DECL)
- ACE_THROW_SPEC((CORBA::SystemException))
-{
- unsigned num_left = --this->num_clients_;
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) A client has reported that it is done(). "
- "There are %d clients left.\n", num_left));
-
- if (num_left == 0)
- {
- ACE_DEBUG((LM_DEBUG, "(%P|%t) Stats:\n"
- "op1() count: %d\n"
- "op2() count: %d\n"
- "op3() count: %d\n"
- "op4() count: %d\n"
- "op5() count: %d\n",
- this->count_op1_,
- this->count_op2_,
- this->count_op3_,
- this->count_op4_,
- this->count_op5_));
-
- if (TheOrbShutdownTask::instance()->open(0) != 0)
- {
- ACE_ERROR((LM_ERROR, "(%P|%t)Foo_i::done: failed to create orb "\
- "shutdown thread.\n"));
- }
- }
-}
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/Foo_i.h b/TAO/examples/CSD_Strategy/ThreadPool/Foo_i.h
deleted file mode 100644
index c1da2d5811b..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/Foo_i.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// $Id$
-#ifndef FOO_I_H
-#define FOO_I_H
-
-#include "FooS.h"
-#include "ace/CORBA_macros.h"
-#include "tao/Environment.h"
-
-
-class Foo_i : public virtual POA_Foo
-{
- public:
-
- Foo_i(unsigned num_clients);
- virtual ~Foo_i();
-
- virtual void op1(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC((CORBA::SystemException));
-
- virtual void op2(CORBA::Long value ACE_ENV_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC((CORBA::SystemException));
-
- virtual CORBA::Long op3(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC((CORBA::SystemException));
-
- virtual void op4(CORBA::Long value ACE_ENV_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC((CORBA::SystemException));
-
- virtual void op5(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC((CORBA::SystemException, FooException));
-
- virtual void done(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC((CORBA::SystemException));
-
-
- private:
-
- CORBA::Long value_;
- unsigned num_clients_;
-
- unsigned count_op1_;
- unsigned count_op2_;
- unsigned count_op3_;
- unsigned count_op4_;
- unsigned count_op5_;
-};
-
-#endif
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/Makefile.am b/TAO/examples/CSD_Strategy/ThreadPool/Makefile.am
deleted file mode 100644
index 099b8e11e3c..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/Makefile.am
+++ /dev/null
@@ -1,129 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ../bin/mwc.pl -type automake -noreldefs TAO.mwc
-
-ACE_BUILDDIR = $(top_builddir)/..
-ACE_ROOT = $(top_srcdir)/..
-TAO_BUILDDIR = $(top_builddir)
-TAO_IDL = ACE_ROOT=$(ACE_ROOT) TAO_ROOT=$(TAO_ROOT) $(TAO_BUILDDIR)/TAO_IDL/tao_idl
-TAO_IDL_DEP = $(TAO_BUILDDIR)/TAO_IDL/tao_idl
-TAO_IDLFLAGS = -Ge 1 -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I$(TAO_ROOT) -I$(srcdir) -g $(ACE_BUILDDIR)/apps/gperf/src/gperf
-TAO_ROOT = $(top_srcdir)
-
-## Makefile.CSD_Test_ThreadPool_Server.am
-
-BUILT_SOURCES = \
- FooC.cpp \
- FooC.h \
- FooC.inl \
- FooS.cpp \
- FooS.h \
- FooS.inl
-
-CLEANFILES = \
- Foo-stamp \
- FooC.cpp \
- FooC.h \
- FooC.inl \
- FooS.cpp \
- FooS.h \
- FooS.inl
-
-FooC.cpp FooC.h FooC.inl FooS.cpp FooS.h FooS.inl: Foo-stamp
-
-Foo-stamp: $(srcdir)/Foo.idl $(TAO_IDL_DEP)
- $(TAO_IDL) $(TAO_IDLFLAGS) $(srcdir)/Foo.idl
- @touch $@
-
-noinst_PROGRAMS = server_main
-
-server_main_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(TAO_ROOT) \
- -I$(TAO_BUILDDIR)
-
-server_main_SOURCES = \
- FooC.cpp \
- FooS.cpp \
- Foo_i.cpp \
- OrbShutdownTask.cpp \
- ServerApp.cpp \
- server_main.cpp \
- FooC.h \
- FooC.inl \
- FooS.h \
- FooS.inl \
- Foo_i.h \
- OrbShutdownTask.h \
- ServerApp.h
-
-server_main_LDADD = \
- $(TAO_BUILDDIR)/tao/libTAO_CSD_ThreadPool.la \
- $(TAO_BUILDDIR)/tao/libTAO_CSD_Framework.la \
- $(TAO_BUILDDIR)/tao/libTAO_PI.la \
- $(TAO_BUILDDIR)/tao/libTAO_CodecFactory.la \
- $(TAO_BUILDDIR)/tao/libTAO_PortableServer.la \
- $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
- $(TAO_BUILDDIR)/tao/libTAO.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-## Makefile.CSD_Test_ThreadPool_Client.am
-
-BUILT_SOURCES += \
- FooC.cpp \
- FooC.h \
- FooC.inl \
- FooS.h \
- FooS.inl
-
-CLEANFILES += \
- Foo-stamp \
- FooC.cpp \
- FooC.h \
- FooC.inl \
- FooS.h \
- FooS.inl
-
-FooC.cpp FooC.h FooC.inl FooS.h FooS.inl: Foo-stamp
-
-Foo-stamp: $(srcdir)/Foo.idl $(TAO_IDL_DEP)
- $(TAO_IDL) $(TAO_IDLFLAGS) $(srcdir)/Foo.idl
- @touch $@
-
-noinst_PROGRAMS += client_main
-
-client_main_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(TAO_ROOT) \
- -I$(TAO_BUILDDIR)
-
-client_main_SOURCES = \
- ClientApp.cpp \
- FooC.cpp \
- client_main.cpp \
- ClientApp.h \
- FooC.h \
- FooC.inl \
- FooS.h \
- FooS.inl
-
-client_main_LDADD = \
- $(TAO_BUILDDIR)/tao/libTAO_AnyTypeCode.la \
- $(TAO_BUILDDIR)/tao/libTAO.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.cpp b/TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.cpp
deleted file mode 100644
index f9d551e8aee..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-
-//=============================================================================
-/**
- * @file OrbShutdownTask.cpp
- *
- * $Id$
- *
- * @author Tim Bradley <bradley_t@ociweb.com>
- */
-//=============================================================================
-
-#include "OrbShutdownTask.h"
-#include "ace/CORBA_macros.h"
-#include "ace/OS_NS_unistd.h"
-
-
-OrbShutdownTask::OrbShutdownTask()
-{
-}
-
-
-OrbShutdownTask::~OrbShutdownTask()
-{
-}
-
-
-void
-OrbShutdownTask::orb(CORBA::ORB_ptr orb)
-{
- this->orb_ = CORBA::ORB::_duplicate (orb);
-}
-
-
-int
-OrbShutdownTask::open(void*)
-{
- if (this->activate(THR_NEW_LWP | THR_JOINABLE, 1) != 0)
- {
- // Assumes that when activate returns non-zero return code that
- // no threads were activated.
- ACE_ERROR_RETURN((LM_ERROR,
- "(%P|%t) OrbShutdownTask failed to open().\n"),
- -1);
- }
-
- return 0;
-}
-
-
-int
-OrbShutdownTask::svc()
-{
- ACE_OS::sleep (2);
- ACE_DEBUG ((LM_DEBUG, "(%P|%t)OrbShutdownTask::svc shutdown orb \n"));
- ACE_TRY_NEW_ENV
- {
- this->orb_->shutdown(0 ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHALL
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Exception raised by ORB::shutdown() call "
- "in OrbShutdownTask::svc().\n"));
- }
- ACE_ENDTRY;
-
- return 0;
-}
-
-
-int
-OrbShutdownTask::close(u_long)
-{
- return 0;
-}
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.h b/TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.h
deleted file mode 100644
index 3795d12c3c9..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/OrbShutdownTask.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-
-//=============================================================================
-/**
- * @file OrbShutdownTask.h
- *
- * $Id$
- *
- * @author Tim Bradley <bradley_t@ociweb.com>
- */
-//=============================================================================
-
-#ifndef ORB_SHUTDOWN_TASK_H
-#define ORB_SHUTDOWN_TASK_H
-
-#include "ace/Task.h"
-#include "tao/ORB.h"
-
-
-class OrbShutdownTask : public ACE_Task_Base
-{
- public:
-
- OrbShutdownTask();
- virtual ~OrbShutdownTask();
-
- void orb(CORBA::ORB_ptr orb);
-
- virtual int open(void*);
- virtual int svc();
- virtual int close(u_long);
-
-
- private:
-
- CORBA::ORB_var orb_;
-};
-
-typedef ACE_Singleton<OrbShutdownTask, ACE_Thread_Mutex> TheOrbShutdownTask;
-
-#endif
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/README b/TAO/examples/CSD_Strategy/ThreadPool/README
deleted file mode 100644
index 76a46ba103f..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/README
+++ /dev/null
@@ -1,57 +0,0 @@
-# $Id$
-
-Description:
-
-This is the simplest example shows the use of a Custom Servant Dispatching (CSD)
-Strategy. This test uses the reference implementation, known as the Thread Pool
-CSD Strategy. This tests some simple remote two-way CORBA requests and a simple
-remote one-way request.
-
-The server application creates one servant object, runs the ORB event
-loop using the main thread, and uses one worker thread for the
-Thread Pool CSD Strategy.
-
-The client application invokes simple two-way calls on the object
-reference. There is also a simple one-way call that is also made on
-the object reference.
-
-The run_test.pl script will launch 1 sever process, and 40 client processes.
-Each client process will make invocations on the single object reference
-provided by the (single) server process.
-
-Executables:
-
- * client_main
-
- This is the client test executable.
-
- Command-line arguments:
-
- -? : Prints the executable's available command-line options, and
- then exits.
-
- -i <ior string> : Provide the IOR to the client (ie, file://some.ior).
-
- * server_main
-
- This is the server test executable.
-
- Command-line arguments:
-
- -? : Prints the executable's available command-line options, and
- then exits.
-
- -o <ior filename> : Name of file to which the IOR will be written.
-
- -n <num_clients> : The number of clients that will use the server.
-
- * run_test.pl
-
- This perl script will run an automated test using 40 client processes
- and 1 server process. The script returns 0 if the test was successful.
-
- No command-line options are supported. Simply execute the perl script
- as follows:
-
- $ ./run_test.pl
-
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp b/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp
deleted file mode 100644
index 8a107eff964..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-// $Id$
-#include "ServerApp.h"
-#include "Foo_i.h"
-#include "OrbShutdownTask.h"
-#include "ace/Get_Opt.h"
-#include "tao/CSD_ThreadPool/CSD_TP_Strategy.h"
-#include "tao/Intrusive_Ref_Count_Handle_T.h"
-// To force static load the service.
-#include "tao/PI/PI.h"
-#include "tao/CSD_ThreadPool/CSD_ThreadPool.h"
-
-
-ServerApp::ServerApp()
-: num_clients_ (1)
-{
-}
-
-
-ServerApp::~ServerApp()
-{
-}
-
-
-int
-ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL)
-{
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- // Parse the command-line args for this application.
- // * Raises -1 if problems are encountered.
- // * Returns 1 if the usage statement was explicitly requested.
- // * Returns 0 otherwise.
- int result = this->parse_args(argc, argv);
- if (result != 0)
- {
- return result;
- }
-
- TheOrbShutdownTask::instance()->orb (orb.in ());
-
- CORBA::Object_var obj
- = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (CORBA::is_nil(obj.in()))
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Failed to resolve initial ref for 'RootPOA'.\n"));
- ACE_THROW_RETURN (TestException(), -1);
- }
-
- PortableServer::POA_var root_poa
- = PortableServer::POA::_narrow(obj.in() ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (CORBA::is_nil(root_poa.in()))
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Failed to narrow obj ref to POA interface.\n"));
- ACE_THROW_RETURN (TestException(), -1);
- }
-
- PortableServer::POAManager_var poa_manager
- = root_poa->the_POAManager( ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- // Create the child POA.
- CORBA::PolicyList policies(0);
- policies.length(0);
-
- PortableServer::POA_var child_poa
- = root_poa->create_POA("ChildPoa",
- poa_manager.in(),
- policies
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (CORBA::is_nil(child_poa.in()))
- {
- ACE_ERROR((LM_ERROR, "(%P|%t) ERROR [ServerApp::run()]: "
- "Failed to create the child POA.\n"));
- ACE_THROW_RETURN (TestException(), -1);
- }
-
- // Create the thread pool servant dispatching strategy object, and
- // hold it in a (local) smart pointer variable.
- TAO_Intrusive_Ref_Count_Handle<TAO::CSD::TP_Strategy> csd_tp_strategy =
- new TAO::CSD::TP_Strategy();
-
- // Tell the strategy to apply itself to the child poa.
- if (csd_tp_strategy->apply_to(child_poa.in() ACE_ENV_ARG_PARAMETER) == false)
- {
- ACE_ERROR((LM_ERROR, "(%P|%t) ERROR [ServerApp::run()]: "
- "Failed to apply custom dispatching strategy to child poa.\n"));
- ACE_THROW_RETURN (TestException(), -1);
- }
- ACE_CHECK_RETURN (-1);
-
- // Create the servant object.
- Foo_i* servant = new Foo_i(this->num_clients_);
-
- // local smart pointer variable to deal with releasing the reference
- // to the servant object when the smart pointer object falls out of scope.
- PortableServer::ServantBase_var owner_transfer(servant);
-
- // Activate the servant using the Child POA.
- PortableServer::ObjectId_var oid
- = child_poa->activate_object(servant
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- // Obtain the object reference.
- obj = child_poa->servant_to_reference(servant ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- if (CORBA::is_nil(obj.in()))
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Failed to activate servant (Foo_i).\n"));
- ACE_THROW_RETURN (TestException(), -1);
- }
-
- // Stringify the object reference
- CORBA::String_var ior
- = orb->object_to_string(obj.in() ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- // Write the stringified object reference to the ior file.
- FILE* ior_file = ACE_OS::fopen(this->ior_filename_.c_str(), "w");
-
- if (ior_file == 0)
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Cannot open output file for writing IOR: %s",
- this->ior_filename_.c_str()));
- ACE_THROW_RETURN (TestException(), -1);
- }
-
- ACE_OS::fprintf(ior_file, "%s", ior.in ());
- ACE_OS::fclose(ior_file);
-
- // Activate the POA Manager
- poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ServerApp is ready. Running the ORB event loop.\n"));
-
- // Run the ORB event loop.
- orb->run(ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ServerApp ORB has stopped running. "
- "Stop the CSD strategy.\n"));
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ServerApp is waiting for OrbShutdownTask.\n"));
- TheOrbShutdownTask::instance()->wait ();
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ServerApp is destroying the Root POA.\n"));
-
- // Sleep for 2 second to let the done() two-way call complete
- // before cleanup.
- ACE_OS::sleep (2);
-
- // Tear-down the root poa and orb.
- root_poa->destroy(1, 1 ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ServerApp is destroying the ORB.\n"));
-
- orb->destroy( ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_CHECK_RETURN (-1);
-
- ACE_DEBUG((LM_DEBUG,
- "(%P|%t) ServerApp has completed running successfully.\n"));
-
- return 0;
-}
-
-
-int
-ServerApp::parse_args(int argc, char* argv[])
-{
- this->exe_name_ = argv[0];
-
- ACE_Get_Opt get_opts(argc, argv, "o:n:");
-
- int c;
-
- while ((c = get_opts()) != -1)
- {
- switch (c)
- {
- case 'o':
- this->ior_filename_ = get_opts.opt_arg();
- break;
-
- case 'n':
- {
- int tmp = ACE_OS::atoi(get_opts.opt_arg());
- if (tmp < 1)
- {
- this->usage_statement();
- return -1;
- }
-
- this->num_clients_ = tmp;
- }
- break;
-
- case '?':
- this->usage_statement();
- return 1;
-
- default:
- this->usage_statement();
- return -1;
- }
- }
-
- return 0;
-}
-
-
-void
-ServerApp::usage_statement()
-{
- ACE_ERROR((LM_ERROR,
- "Usage: %s [options]\n\n"
- "OPTIONS:\n\n"
- "\t[-o <ior_filename>]\n"
- "\t[-n <num_clients>]\n"
- "\t[-?]\n\n",
- this->exe_name_.c_str()));
-}
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.h b/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.h
deleted file mode 100644
index ad89b43c972..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// $Id$
-#ifndef SERVERAPP_H
-#define SERVERAPP_H
-
-#include "ace/SString.h"
-#include "ace/CORBA_macros.h"
-#include "tao/Environment.h"
-
-
-class ServerApp
-{
- public:
-
- ServerApp();
- ~ServerApp();
-
- int run(int argc, char* argv[] ACE_ENV_ARG_DECL);
-
-
- private:
-
- int parse_args(int argc, char* argv[]);
- void usage_statement();
-
- ACE_CString exe_name_;
- ACE_CString ior_filename_;
- unsigned num_clients_;
-};
-
-#endif
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/client_main.cpp b/TAO/examples/CSD_Strategy/ThreadPool/client_main.cpp
deleted file mode 100644
index 1f9c337ae54..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/client_main.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// $Id$
-#include "ClientApp.h"
-#include "ace/Log_Msg.h"
-#include "ace/SString.h"
-#include "tao/Exception.h"
-
-
-int
-main(int argc, char* argv[])
-{
- ACE_LOG_MSG->priority_mask(LM_TRACE |
- LM_DEBUG |
- LM_INFO |
- LM_NOTICE |
- LM_WARNING |
- LM_ERROR |
- LM_CRITICAL |
- LM_ALERT |
- LM_EMERGENCY,
- ACE_Log_Msg::PROCESS);
-
-
- ClientApp app;
-
- ACE_TRY_NEW_ENV
- {
- int ret = app.run(argc,argv ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- return ret == 1 ? 0 : ret;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Caught exception:");
- }
- ACE_CATCHALL
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Unknown (...) exception caught in main() "
- "for ClientApp\n"));
- }
- ACE_ENDTRY;
-
- return 1;
-}
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/run_test.pl b/TAO/examples/CSD_Strategy/ThreadPool/run_test.pl
deleted file mode 100755
index 7e34ffa58ba..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/run_test.pl
+++ /dev/null
@@ -1,61 +0,0 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
- & eval 'exec perl -S $0 $argv:q'
- if 0;
-
-# $Id$
-# -*- perl -*-
-
-use lib '../../../../bin';
-use PerlACE::Run_Test;
-
-$iorfile = PerlACE::LocalFile ("server.ior");
-unlink $iorfile;
-$status = 0;
-
-$num_clients=40;
-
-if (PerlACE::is_vxworks_test()) {
- $SV = new PerlACE::ProcessVX ("server_main", "-o $iorfile -n $num_clients");
-}
-else {
- $SV = new PerlACE::Process ("server_main", "-o $iorfile -n $num_clients");
-}
-
-
-$SV->Spawn ();
-
-if (PerlACE::waitforfile_timed ($iorfile,
- $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
-}
-
-for ($i = 0; $i < $num_clients; $i++) {
-
- @CLS[$i] = new PerlACE::Process ("client_main", " -i file://$iorfile");
-
- @CLS[$i]->Spawn ();
-}
-
-for ($i = 0; $i < $num_clients; $i++) {
-
- $client = @CLS[$i]->WaitKill (60);
-
- if ($client != 0) {
- print STDERR "ERROR: client $i returned $client\n";
- $status = 1;
- }
-}
-
-
-$server = $SV->WaitKill (60);
-
-if ($server != 0) {
- print STDERR "ERROR: server returned $server\n";
- $status = 1;
-}
-
-unlink $iorfile;
-
-exit $status;
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/server_main.cpp b/TAO/examples/CSD_Strategy/ThreadPool/server_main.cpp
deleted file mode 100644
index 8c3c4b192a0..00000000000
--- a/TAO/examples/CSD_Strategy/ThreadPool/server_main.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// $Id$
-#include "ServerApp.h"
-#include "ace/Log_Msg.h"
-#include "tao/Exception.h"
-
-
-int
-main(int argc, char* argv[])
-{
- ACE_LOG_MSG->priority_mask(LM_TRACE |
- LM_DEBUG |
- LM_INFO |
- LM_NOTICE |
- LM_WARNING |
- LM_ERROR |
- LM_CRITICAL |
- LM_ALERT |
- LM_EMERGENCY,
- ACE_Log_Msg::PROCESS);
-
- ServerApp app;
-
- ACE_TRY_NEW_ENV
- {
- int ret = app.run(argc,argv ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
- return ret == 1 ? 0 : ret;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "Caught exception in main() for ServerApp");
- }
- ACE_CATCHALL
- {
- ACE_ERROR((LM_ERROR,
- "(%P|%t) Unknown (...) exception caught in main() "
- "for ServerApp\n"));
- }
- ACE_ENDTRY;
-
- return 1;
-}