diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-26 00:39:09 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-26 00:39:09 +0000 |
commit | 0131a172c96f4823eb1d17d53c7e3f5142c7c6a2 (patch) | |
tree | 8d51bb1be304d4bae1d47fc0a2d2ced60763c516 | |
parent | e818b5b0f0d53f97d2c006934710be4865d35b79 (diff) | |
download | ATCD-0131a172c96f4823eb1d17d53c7e3f5142c7c6a2.tar.gz |
ChangeLogTag:Sat Mar 25 16:31:29 2000 Carlos O'Ryan <coryan@uci.edu>
36 files changed, 639 insertions, 160 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 8fcce43d380..b2af37c5879 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,41 @@ +Sat Mar 25 16:31:29 2000 Carlos O'Ryan <coryan@uci.edu> + + * orbsvcs/LoadBalancer/Makefile: + * orbsvcs/LoadBalancer/LoadBalancer.h: + * orbsvcs/LoadBalancer/LoadBalancer.cpp: + * orbsvcs/LoadBalancer/LoadBalancer_Service.cpp: + * orbsvcs/LoadBalancer/LoadBalancer_Service.dsp: + * orbsvcs/LoadBalancer/LoadBalancer_Service.dsw: + Add project files, Makefile and missing header file. + Fixed typos syntax errors and other problems, so at least it + compiles now. + + * orbsvcs/orbsvcs/Makefile: + * orbsvcs/orbsvcs/Makefile.LoadBalancing: + * orbsvcs/orbsvcs/orbsvcs.dsw: + * orbsvcs/orbsvcs/LoadBalancing.dsp: + * orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.h: + * orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.cpp: + * orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.h: + * orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.cpp: + * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.h: + * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.i: + * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.cpp: + * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_export.h: + * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h: + * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp: + * orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.h: + * orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.cpp: + Fixed numerous typos, errors and configuration problems. + Added the Makefile, updated the project file and inserted the + project file to the orbsvcs workspace. + + * orbsvcs/tests/LoadBalancing/client.cpp: + Implemented a simple client body, still not compiled. + + * orbsvcs/tests/LoadBalancing/server.cpp: + Cosmetic errors. + Fri Mar 24 21:32:30 2000 Pradeep Gore <pradeep@flamenco.cs.wustl.edu> * docs/releasenotes/index.html: diff --git a/TAO/orbsvcs/LoadBalancer/LoadBalancer.cpp b/TAO/orbsvcs/LoadBalancer/LoadBalancer.cpp index 0a4e2d99852..271e66b1c60 100644 --- a/TAO/orbsvcs/LoadBalancer/LoadBalancer.cpp +++ b/TAO/orbsvcs/LoadBalancer/LoadBalancer.cpp @@ -2,11 +2,22 @@ // $Id$ +#include "LoadBalancer.h" +#include "ace/Get_Opt.h" + ACE_RCSID(LoadBalancer, LoadBalancer, "$Id$") TAO_LoadBalancer::TAO_LoadBalancer (void) + : interface_repository_id_ ("IDL:CORBA/Object:1.0"), + load_balancer_file_ ("lb.ior"), + balancer_ (0) +{ +} + +TAO_LoadBalancer::~TAO_LoadBalancer (void) { + // @@ } void @@ -14,7 +25,7 @@ TAO_LoadBalancer::parse_args (int argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) { - ACE_Get_Opt get_opts (argc, argv, "o:h"); + ACE_Get_Opt get_opts (argc, argv, "i:o:h"); int c = 0; @@ -22,26 +33,19 @@ TAO_LoadBalancer::parse_args (int argc, { switch (c) { - case 'o': // Write the Load Balancer IOR to the specified file. - this->ior_file_ = - ACE_OS::fopen (get_opts.optarg, "w"); - - if (this->ior_file_ == 0) - { - ACE_ERROR ((LM_ERROR, - "Unable to open %s for writing: %p\n", - get_opts.optarg)); - ACE_THROW (CORBA::UNKNOWN ()); - } - + case 'i': + this->interface_repository_id_ = get_opts.optarg; + break; + case 'o': + this->load_balancer_file_ = get_opts.optarg; break; case 'h': - this->usage (); + this->usage (argv[0]); break; default: - this->usage (); + this->usage (argv[0]); ACE_THROW (CORBA::BAD_PARAM ()); } } @@ -60,21 +64,13 @@ TAO_LoadBalancer::init (int argc, this->orb_->resolve_initial_references ("RootPOA", ACE_TRY_ENV); ACE_CHECK; - if (CORBA::is_nil (poa.in ())) - { - ACE_ERROR ((LM_ERROR, - ASYS_TEXT ("(%P|%t) Unable to initialize the ") - ASYS_TEXT ("POA.\n"))); - ACE_CHECK; - } - // Get the POA object. this->root_poa_ = PortableServer::POA::_narrow (poa.in (), ACE_TRY_ENV); ACE_CHECK; // Get the POA_Manager. - PortableServer::POAManager_var poa_manager = + PortableServer::POAManager_var poa_manager = this->root_poa_->the_POAManager (ACE_TRY_ENV); ACE_CHECK; @@ -86,26 +82,31 @@ TAO_LoadBalancer::init (int argc, ACE_CHECK; // Initialize the LoadBalancer servant. - this->load_balancer_impl_.init (ACE_TRY_ENV); + ACE_NEW (this->balancer_, + LoadBalancer_Impl (this->interface_repository_id_, + &this->round_robin_)); + + CORBA::Object_var obj = + this->balancer_->_this (ACE_TRY_ENV); ACE_CHECK; - if (this->ior_output_file_ != 0) - { - CORBA::String_var str = - this->my_naming_server_.naming_service_ior (); - ACE_OS::fprintf (this->ior_output_file_, - "%s", - str.in ()); - ACE_OS::fclose (this->ior_output_file_); - } + CORBA::String_var str = + this->orb_->object_to_string (obj.in (), ACE_TRY_ENV); + ACE_CHECK; + + FILE *lb_ior = ACE_OS::fopen (this->load_balancer_file_, "w"); + ACE_OS::fprintf (lb_ior, "%s", str.in ()); + ACE_OS::fclose (lb_ior); } void -TAO_LoadBalancer::usage (void) const +TAO_LoadBalancer::usage (const char *cmd) const { ACE_DEBUG ((LM_INFO, ASYS_TEXT ("Usage: %s ") + ASYS_TEXT ("-i <interface_repo_id> ") ASYS_TEXT ("-o <ior_output_file> ") + ASYS_TEXT ("-h ") ASYS_TEXT ("\n"), - argv [0])); + cmd)); } diff --git a/TAO/orbsvcs/LoadBalancer/LoadBalancer.h b/TAO/orbsvcs/LoadBalancer/LoadBalancer.h new file mode 100644 index 00000000000..39cfc1af635 --- /dev/null +++ b/TAO/orbsvcs/LoadBalancer/LoadBalancer.h @@ -0,0 +1,73 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// orbsvcs/LoadBalancer +// +// = FILENAME +// LoadBalancer.h +// +// = DESCRIPTION +// Implement the LoadBalancing service as a standalone process. +// +// = AUTHORS +// Ossama Othman (ossama@uci.edu) +// +// ============================================================================ + +#ifndef TAO_LOADBALANCER_H +#define TAO_LOADBALANCER_H + +#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" +#include "orbsvcs/LoadBalancing/Round_Robin_Strategy.h" + +class TAO_LoadBalancer +{ + // = TITLE + // Defines a class that encapsulates the implementation of the + // LoadBalancing Service + // + // = DESCRIPTION +public: + TAO_LoadBalancer (void); + // Default Constructor. + + ~TAO_LoadBalancer (void); + // Destructor. + + void init (int argc, char *argv[], + CORBA::Environment &ACE_TRY_ENV); + // Initialize the service + + int run (CORBA_Environment &ACE_TRY_ENV); + // Run the TAO_Loadbalancer. + +protected: + void parse_args (int argc, char *argv[], + CORBA::Environment &ACE_TRY_ENV); + // parses the arguments. + + void usage (const char *msg) const; + // Print a usage message + +private: + const char *interface_repository_id_; + // The interface repository ID for the object we load balance. + + const char *load_balancer_file_; + // The load balancing service IOR is stored in this file + + Round_Robin_Strategy round_robin_; + + LoadBalancer_Impl *balancer_; + // The load balancer + + CORBA::ORB_var orb_; + // The ORB + + PortableServer::POA_var root_poa_; + // The root POA +}; + +#endif /* TAO_LOADBALANCER_H */ diff --git a/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.cpp b/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.cpp index 8aa52239aa5..9e90d3e4842 100644 --- a/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.cpp +++ b/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.cpp @@ -2,8 +2,9 @@ // $Id$ -ACE_RCSID(LoadBalancer, LoadBalancer_Service, "$Id$") +#include "LoadBalancer.h" +ACE_RCSID(LoadBalancer, LoadBalancer_Service, "$Id$") int main (int argc, char *argv[]) @@ -13,7 +14,7 @@ main (int argc, char *argv[]) { TAO_LoadBalancer balancer; - balancer.init (ACE_TRY_ENV); + balancer.init (argc, argv, ACE_TRY_ENV); ACE_TRY_CHECK; balancer.run (ACE_TRY_ENV); diff --git a/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.dsp b/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.dsp new file mode 100644 index 00000000000..700672db7df --- /dev/null +++ b/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.dsp @@ -0,0 +1,108 @@ +# Microsoft Developer Studio Project File - Name="LoadBalancer_Service" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=LoadBalancer_Service - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "LoadBalancer_Service.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "LoadBalancer_Service.mak" CFG="LoadBalancer_Service - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "LoadBalancer_Service - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "LoadBalancer_Service - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "LoadBalancer_Service - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I ".." /I "..\.." /I "..\..\.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D TAO_ORBSVCS_HAS_DLL=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 TAO.lib TAO_LoadBalancing.lib ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\orbsvcs" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
+
+!ELSEIF "$(CFG)" == "LoadBalancer_Service - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".." /I "..\.." /I "..\..\.." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D TAO_ORBSVCS_HAS_DLL=1 /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAOd.lib aced.lib TAO_LoadBalancingd.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept /libpath:"..\orbsvcs" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
+
+!ENDIF
+
+# Begin Target
+
+# Name "LoadBalancer_Service - Win32 Release"
+# Name "LoadBalancer_Service - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ".cpp"
+# Begin Source File
+
+SOURCE=.\LoadBalancer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\LoadBalancer_Service.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ".h"
+# Begin Source File
+
+SOURCE=.\LoadBalancer.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.dsw b/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.dsw new file mode 100644 index 00000000000..590e0ac2ef8 --- /dev/null +++ b/TAO/orbsvcs/LoadBalancer/LoadBalancer_Service.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "LoadBalancer_Service"=.\LoadBalancer_Service.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/orbsvcs/LoadBalancer/Makefile b/TAO/orbsvcs/LoadBalancer/Makefile new file mode 100644 index 00000000000..2727583ad1c --- /dev/null +++ b/TAO/orbsvcs/LoadBalancer/Makefile @@ -0,0 +1,49 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif + +SRC = LoadBalancer.cpp LoadBalancer_Service.cpp + +LDLIBS = -lTAO_LoadBalancing -lTAO + +BIN2 = LoadBalancing_Service + +#### If the TAO orbsvcs library wasn't built with sufficient components, +#### don't try to build here. +TAO_ORBSVCS := $(shell sh $(ACE_ROOT)/bin/ace_components --orbsvcs) +ifeq (LoadBalancing,$(findstring LoadBalancing,$(TAO_ORBSVCS))) + BIN = $(BIN2) +endif # LoadBalancing + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +LDFLAGS += -L$(TAO_ROOT)/orbsvcs/orbsvcs -L$(TAO_ROOT)/tao +CPPFLAGS += -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT) + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.cpp b/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.cpp index 9cbe4f85d6d..d0ad39c9738 100644 --- a/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.cpp +++ b/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.cpp @@ -2,8 +2,8 @@ // $Id$ -#include "orbsvcs/LoadBalancing/DSI_ForwardingProxy.h" -#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" +#include "DSI_ForwardingProxy.h" +#include "LoadBalancer_i.h" ACE_RCSID(orbsvcs, DSI_ForwardingProxy, "$Id$") @@ -24,7 +24,7 @@ DSI_ForwardingProxy::invoke (CORBA::ServerRequest_ptr /* request */, CORBA::Object_ptr replica = this->load_balancer_->replica (ACE_TRY_ENV); ACE_CHECK; - + // Throw a forward exception to force the client to redirect its // requests to the Replica chosen by the LoadBalancer. diff --git a/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.h b/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.h index f2cf2e52b2f..bda693bd633 100644 --- a/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.h +++ b/TAO/orbsvcs/orbsvcs/DSI_ForwardingProxy.h @@ -15,11 +15,11 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" - #ifndef DSI_FORWARDING_PROXY_H #define DSI_FORWARDING_PROXY_H +#include "orbsvcs/LoadBalancingS.h" + // Forward declaration. class LoadBalancer_Impl; @@ -45,7 +45,7 @@ public: virtual void invoke (CORBA::ServerRequest_ptr request, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, - PortableServer::ForwardingRequest)); + PortableServer::ForwardRequest)); virtual CORBA::RepositoryId _primary_interface ( const PortableServer::ObjectId &oid, diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp index 9fce5a6d4fc..d7f7de88750 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp @@ -7,11 +7,10 @@ ACE_RCSID(orbsvcs, Load_Balancer_i, "$Id$") +#if !defined (__ACE_INLINE__) +#include "LoadBalancer_i.i" +#endif /* __ACE_INLINE__ */ -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancer_i.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - LoadBalancer_Impl::LoadBalancer_Impl (const char *interface_id, Load_Balancing_Strategy *strategy) : redirector_ (this, interface_id), diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancer_i.h b/TAO/orbsvcs/orbsvcs/LoadBalancer_i.h index 2cfb007087f..3793ca8e2fa 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancer_i.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancer_i.h @@ -30,7 +30,7 @@ typedef ACE_Unbounded_Set<ReplicaProxy_Impl *> typedef ACE_Unbounded_Set_Iterator<ReplicaProxy_Impl *> ReplicaProxySetIterator; -class LoadBalancer_Impl : public virtual POA_LoadBalancing::LoadBalancer +class TAO_LoadBalancing_Export LoadBalancer_Impl : public virtual POA_LoadBalancing::LoadBalancer { public: LoadBalancer_Impl (const char *interface_id, @@ -79,9 +79,8 @@ private: // The underlying load balancing strategy. }; -#if !defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancer_i.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ +#if defined (__ACE_INLINE__) +#include "LoadBalancer_i.i" +#endif /* __ACE_INLINE__ */ #endif /* TAO_LOADBALANCER_I_H */ - diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing.dsp b/TAO/orbsvcs/orbsvcs/LoadBalancing.dsp index 073cd6212ab..ed9b14ebc96 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing.dsp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ace.lib TAO.lib TAO_Svc_Utils.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\TAO_LoadBalancing.dll" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
+# ADD LINK32 ace.lib TAO.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\TAO_LoadBalancing.dll" /libpath:"..\..\tao" /libpath:"..\..\..\ace"
!ELSEIF "$(CFG)" == "LoadBalancing - Win32 Debug"
@@ -79,7 +79,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 TAOd.lib aced.lib TAO_Svc_Utilsd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\TAO_LoadBalancingd.dll" /pdbtype:sept /libpath:"..\..\tao" /libpath:"..\..\..\ace"
+# ADD LINK32 TAOd.lib aced.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\TAO_LoadBalancingd.dll" /pdbtype:sept /libpath:"..\..\tao" /libpath:"..\..\..\ace"
# SUBTRACT LINK32 /profile
!ENDIF
@@ -113,10 +113,6 @@ SOURCE=.\LoadBalancingS.cpp # End Source File
# Begin Source File
-SOURCE=.\LoadBalancing\ReplicaControl.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\LoadBalancing\ReplicaProxy.cpp
# End Source File
# Begin Source File
@@ -153,10 +149,6 @@ SOURCE=.\LoadBalancingS.h # End Source File
# Begin Source File
-SOURCE=.\LoadBalancing\ReplicaControl.h
-# End Source File
-# Begin Source File
-
SOURCE=.\LoadBalancing\ReplicaProxy.h
# End Source File
# Begin Source File
@@ -219,7 +211,7 @@ InputPath=.\LoadBalancing.idl InputName=LoadBalancing
BuildCmds= \
- ..\..\..\bin\tao_idl -Ge 1 -I../../ -I../../tao -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -Wb,export_macro=TAO_LoadBalancing_Export -Wb,export_include=LoadBalancing\loadbalancing_export.h $(InputName).idl
+ ..\..\..\bin\tao_idl -Ge 1 -I../../ -I../../tao -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -Wb,export_macro=TAO_LoadBalancing_Export -Wb,export_include=LoadBalancing/LoadBalancing_export.h $(InputName).idl
"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.cpp index 9cbe4f85d6d..d0ad39c9738 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.cpp @@ -2,8 +2,8 @@ // $Id$ -#include "orbsvcs/LoadBalancing/DSI_ForwardingProxy.h" -#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" +#include "DSI_ForwardingProxy.h" +#include "LoadBalancer_i.h" ACE_RCSID(orbsvcs, DSI_ForwardingProxy, "$Id$") @@ -24,7 +24,7 @@ DSI_ForwardingProxy::invoke (CORBA::ServerRequest_ptr /* request */, CORBA::Object_ptr replica = this->load_balancer_->replica (ACE_TRY_ENV); ACE_CHECK; - + // Throw a forward exception to force the client to redirect its // requests to the Replica chosen by the LoadBalancer. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.h index f2cf2e52b2f..bda693bd633 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/DSI_ForwardingProxy.h @@ -15,11 +15,11 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" - #ifndef DSI_FORWARDING_PROXY_H #define DSI_FORWARDING_PROXY_H +#include "orbsvcs/LoadBalancingS.h" + // Forward declaration. class LoadBalancer_Impl; @@ -45,7 +45,7 @@ public: virtual void invoke (CORBA::ServerRequest_ptr request, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, - PortableServer::ForwardingRequest)); + PortableServer::ForwardRequest)); virtual CORBA::RepositoryId _primary_interface ( const PortableServer::ObjectId &oid, diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.cpp index 9fce5a6d4fc..d7f7de88750 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.cpp @@ -7,11 +7,10 @@ ACE_RCSID(orbsvcs, Load_Balancer_i, "$Id$") +#if !defined (__ACE_INLINE__) +#include "LoadBalancer_i.i" +#endif /* __ACE_INLINE__ */ -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancer_i.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ - LoadBalancer_Impl::LoadBalancer_Impl (const char *interface_id, Load_Balancing_Strategy *strategy) : redirector_ (this, interface_id), diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.h index 2cfb007087f..3793ca8e2fa 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.h @@ -30,7 +30,7 @@ typedef ACE_Unbounded_Set<ReplicaProxy_Impl *> typedef ACE_Unbounded_Set_Iterator<ReplicaProxy_Impl *> ReplicaProxySetIterator; -class LoadBalancer_Impl : public virtual POA_LoadBalancing::LoadBalancer +class TAO_LoadBalancing_Export LoadBalancer_Impl : public virtual POA_LoadBalancing::LoadBalancer { public: LoadBalancer_Impl (const char *interface_id, @@ -79,9 +79,8 @@ private: // The underlying load balancing strategy. }; -#if !defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancer_i.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ +#if defined (__ACE_INLINE__) +#include "LoadBalancer_i.i" +#endif /* __ACE_INLINE__ */ #endif /* TAO_LOADBALANCER_I_H */ - diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.cpp index 96a6727bea2..099563ddb8b 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.cpp @@ -3,11 +3,10 @@ // $Id$ -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.h" -#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" +#include "LoadBalancing_Strategy.h" -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ +#if defined (__ACE_INLINE__) +#include "LoadBalancing_Strategy.i" +#endif /* __ACE_INLINE__ */ ACE_RCSID(orbsvcs, LoadBalancing_Strategy, "$Id$") diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.h index 7a465b42356..bf63d6f2ee5 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.h @@ -15,11 +15,13 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" - #ifndef LOAD_BALANCING_STRATEGY_H #define LOAD_BALANCING_STRATEGY_H +#include "orbsvcs/LoadBalancingS.h" + +class ReplicaProxy_Impl; + // The abstract load balancing strategy class. class Load_Balancing_Strategy @@ -47,8 +49,8 @@ public: }; -#if !defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ +#if !defined (__ACE_INLINE__) +#include "LoadBalancing_Strategy.i" +#endif /* __ACE_INLINE__ */ #endif /* LOAD_BALANCING_STRATEGY_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.i b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.i index abffb63d92a..aa25cd5a09f 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.i +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.i @@ -1,4 +1,3 @@ // -*- C++ -*- // $Id$ - diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_export.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_export.h index 58af36b0064..9ef9d82ed04 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_export.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_export.h @@ -4,7 +4,7 @@ // This file is generated automatically by // ${ACE_ROOT}/GenExportH.BAT // ------------------------------ -#ifndef TAO_LOADBALANCING_EXPORT_H +#if !defined (TAO_LOADBALANCING_EXPORT_H) #define TAO_LOADBALANCING_EXPORT_H #include "ace/OS.h" @@ -16,18 +16,18 @@ #if defined (TAO_LOADBALANCING_HAS_DLL) # if (TAO_LOADBALANCING_HAS_DLL == 1) # if defined (TAO_LOADBALANCING_BUILD_DLL) -# define TAO_LOADBALANCING_Export ACE_Proper_Export_Flag +# define TAO_LoadBalancing_Export ACE_Proper_Export_Flag # define TAO_LOADBALANCING_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) # else -# define TAO_LOADBALANCING_Export ACE_Proper_Import_Flag +# define TAO_LoadBalancing_Export ACE_Proper_Import_Flag # define TAO_LOADBALANCING_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) # endif /* TAO_LOADBALANCING_BUILD_DLL */ # else -# define TAO_LOADBALANCING_Export +# define TAO_LoadBalancing_Export # define TAO_LOADBALANCING_SINGLETON_DECLARATION(T) # endif /* ! TAO_LOADBALANCING_HAS_DLL == 1 */ #else -# define TAO_LOADBALANCING_Export +# define TAO_LoadBalancing_Export # define TAO_LOADBALANCING_SINGLETON_DECLARATION(T) #endif /* TAO_LOADBALANCING_HAS_DLL */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp index 4763b891271..46b6f05a41b 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp @@ -2,8 +2,8 @@ // $Id$ -#include "orbsvcs/LoadBalancing/ReplicaProxy.h" -#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" +#include "ReplicaProxy.h" +#include "LoadBalancer_i.h" ACE_RCSID(orbsvcs, ReplicaProxy, "$Id$") @@ -68,7 +68,7 @@ void ReplicaProxy_Impl::connect (LoadBalancer_Impl *balancer, this->control_ = LoadBalancing::ReplicaControl::_duplicate (control); else ACE_THROW (LoadBalancing::ReplicaProxy::NilControl ()); - + if (!CORBA::is_nil (control)) this->replica_ = CORBA::Object::_duplicate (replica); else diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h index d86322343fa..c8fa2a170e2 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h @@ -15,15 +15,22 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" - #ifndef TAO_REPLICAPROXY_H #define TAO_REPLICAPROXY_H +#include "orbsvcs/LoadBalancingS.h" + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + class LoadBalancer_Impl; // Forward declaration -class ReplicaProxy_Impl : +class TAO_LoadBalancing_Export ReplicaProxy_Impl : public virtual POA_LoadBalancing::ReplicaProxy, public virtual PortableServer::RefCountServantBase { @@ -83,4 +90,8 @@ private: // 0 == currently disconnected from load balancer }; +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + #endif /* TAO_REPLICAPROXY_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.cpp index a899db89c3f..8d6ec187e36 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.cpp @@ -3,7 +3,8 @@ // $Id$ -#include "orbsvcs/LoadBalancing/Round_Robin_Strategy.h" +#include "Round_Robin_Strategy.h" +#include "ReplicaProxy.h" ACE_RCSID(orbsvcs, Round_Robin_Strategy, "$Id$") @@ -12,7 +13,6 @@ Round_Robin_Strategy::Round_Robin_Strategy (void) : proxies_ (), next_replica_ (this->proxies_.end ()) { - // Nothing else } Round_Robin_Strategy::~Round_Robin_Strategy (void) @@ -56,7 +56,7 @@ Round_Robin_Strategy::replica (CORBA::Environment &ACE_TRY_ENV) int Round_Robin_Strategy::insert (ReplicaProxy_Impl *proxy) { - return this->proxies_.insert (proxy) + return this->proxies_.insert (proxy); } int @@ -64,4 +64,3 @@ Round_Robin_Strategy::remove (ReplicaProxy_Impl *proxy) { return this->proxies_.remove (proxy); } - diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.h index 6948c610c3b..e65d8cdb39c 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.h @@ -15,23 +15,20 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.h" - - #ifndef ROUND_ROBIN_STRATEGY_H #define ROUND_ROBIN_STRATEGY_H +#include "LoadBalancing_Strategy.h" +#include "orbsvcs/LoadBalancingS.h" +#include "ace/Containers.h" // Forward declarations class ReplicaProxy_Impl; -template class ACE_Unbounded_Set<ReplicaProxy_Impl *>; - -typedef ACE_Unbounded_Set<ReplicaProxy_Impl *> - ReplicaProxySet; +typedef ACE_Unbounded_Set<ReplicaProxy_Impl *> ReplicaProxySet; +typedef ACE_Unbounded_Set_Iterator<ReplicaProxy_Impl *> ReplicaProxySetIterator; -class Round_Robin_Strategy : public Load_Balancing_Strategy +class TAO_LoadBalancing_Export Round_Robin_Strategy : public Load_Balancing_Strategy { // = TITLE // Round Robin load balancing strategy @@ -42,19 +39,22 @@ class Round_Robin_Strategy : public Load_Balancing_Strategy // fashion. public: - Round_Robin_Strategy (void); // Constructor. + ~Round_Robin_Strategy (void); + // Destructor + + // = The Load_Balancing_Strategy methods virtual CORBA::Object_ptr replica (CORBA_Environment &ACE_TRY_ENV); - // Return the object reference to the Replica to which requests should - // be redirected. + virtual int insert (ReplicaProxy_Impl *); + virtual int remove (ReplicaProxy_Impl *); private: - ReplicaProxySet proxies_; // Set containing the ReplicaProxy servants. -}; + ACE_Unbounded_Set_Iterator<ReplicaProxy_Impl*> next_replica_; +}; #endif /* ROUND_ROBIN_STRATEGY_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.cpp index 96a6727bea2..099563ddb8b 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.cpp @@ -3,11 +3,10 @@ // $Id$ -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.h" -#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" +#include "LoadBalancing_Strategy.h" -#if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ +#if defined (__ACE_INLINE__) +#include "LoadBalancing_Strategy.i" +#endif /* __ACE_INLINE__ */ ACE_RCSID(orbsvcs, LoadBalancing_Strategy, "$Id$") diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.h b/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.h index 7a465b42356..bf63d6f2ee5 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.h @@ -15,11 +15,13 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" - #ifndef LOAD_BALANCING_STRATEGY_H #define LOAD_BALANCING_STRATEGY_H +#include "orbsvcs/LoadBalancingS.h" + +class ReplicaProxy_Impl; + // The abstract load balancing strategy class. class Load_Balancing_Strategy @@ -47,8 +49,8 @@ public: }; -#if !defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.i" -#endif /* ACE_LACKS_INLINE_FUNCTIONS */ +#if !defined (__ACE_INLINE__) +#include "LoadBalancing_Strategy.i" +#endif /* __ACE_INLINE__ */ #endif /* LOAD_BALANCING_STRATEGY_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.i b/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.i index abffb63d92a..aa25cd5a09f 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.i +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing_Strategy.i @@ -1,4 +1,3 @@ // -*- C++ -*- // $Id$ - diff --git a/TAO/orbsvcs/orbsvcs/Makefile b/TAO/orbsvcs/orbsvcs/Makefile index f0d1a1073d9..193030fde87 100644 --- a/TAO/orbsvcs/orbsvcs/Makefile +++ b/TAO/orbsvcs/orbsvcs/Makefile @@ -18,6 +18,7 @@ ifndef TAO_ORBSVCS #### TAO_ORBSVCS. TAO_ORBSVCS = Naming \ Time \ + LoadBalancing \ Property \ Sched \ Event \ @@ -53,6 +54,9 @@ endif ifneq (,$(findstring Time, $(TAO_ORBSVCS))) MKLIST += Makefile.CosTime endif +ifneq (,$(findstring LoadBalancing, $(TAO_ORBSVCS))) + MKLIST += Makefile.LoadBalancing +endif ifneq (,$(findstring Concurrency, $(TAO_ORBSVCS))) MKLIST += Makefile.CosConcurrency endif diff --git a/TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing b/TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing new file mode 100644 index 00000000000..031ee16a35b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing @@ -0,0 +1,79 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +MAKEFILE = Makefile +LIBNAME = libTAO_LoadBalancing +LIB = $(LIBNAME).a +SHLIB = $(LIBNAME).$(SOEXT) + +VPATH=.:Event + +ACE_SHLIBS = -lTAO -lACE + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +# On non-Windows environment, we should at least define +# the export_include IDL flag. +override TAO_IDLFLAGS += \ + -I$(TAO_ROOT) -Ge 1 \ + -Wb,export_macro=TAO_LoadBalancing_Export \ + -Wb,export_include=LoadBalancing/LoadBalancing_export.h \ + -Wb,pre_include=ace/pre.h \ + -Wb,post_include=ace/post.h + + +IDL_SRCS += \ + LoadBalancing +CPP_SRCS += \ + DSI_ForwardingProxy \ + LoadBalancer_i \ + LoadBalancing_Strategy \ + ReplicaProxy \ + Round_Robin_Strategy + +IDL_FILES = \ + $(addsuffix S, $(IDL_SRCS)) \ + $(addsuffix C, $(IDL_SRCS)) +FILES = $(IDL_FILES) $(CPP_SRCS) +DEFS = $(addsuffix .h,$(FILES)) +LSRC = $(addsuffix .cpp,$(FILES)) + +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU +include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU + +#---------------------------------------------------------------------------- +# Local targets (and local hacks) +#---------------------------------------------------------------------------- + +LDFLAGS += -L$(TAO_ROOT)/tao +CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs + +.PRECIOUS: $(foreach file, $(IDL_SRCS), $(foreach ext, $(IDL_EXT), $(file)$(ext)))) + +idl_stubs: $(addsuffix .h, $(IDL_FILES)) + +realclean: clean + -$(RM) $(foreach file, $(IDL_SRCS), $(foreach ext, $(IDL_EXT), $(file)$(ext))) + +#---------------------------------------------------------------------------- +# Dependencies +#---------------------------------------------------------------------------- + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp b/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp index 4763b891271..46b6f05a41b 100644 --- a/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp +++ b/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp @@ -2,8 +2,8 @@ // $Id$ -#include "orbsvcs/LoadBalancing/ReplicaProxy.h" -#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" +#include "ReplicaProxy.h" +#include "LoadBalancer_i.h" ACE_RCSID(orbsvcs, ReplicaProxy, "$Id$") @@ -68,7 +68,7 @@ void ReplicaProxy_Impl::connect (LoadBalancer_Impl *balancer, this->control_ = LoadBalancing::ReplicaControl::_duplicate (control); else ACE_THROW (LoadBalancing::ReplicaProxy::NilControl ()); - + if (!CORBA::is_nil (control)) this->replica_ = CORBA::Object::_duplicate (replica); else diff --git a/TAO/orbsvcs/orbsvcs/ReplicaProxy.h b/TAO/orbsvcs/orbsvcs/ReplicaProxy.h index d86322343fa..c8fa2a170e2 100644 --- a/TAO/orbsvcs/orbsvcs/ReplicaProxy.h +++ b/TAO/orbsvcs/orbsvcs/ReplicaProxy.h @@ -15,15 +15,22 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" - #ifndef TAO_REPLICAPROXY_H #define TAO_REPLICAPROXY_H +#include "orbsvcs/LoadBalancingS.h" + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + class LoadBalancer_Impl; // Forward declaration -class ReplicaProxy_Impl : +class TAO_LoadBalancing_Export ReplicaProxy_Impl : public virtual POA_LoadBalancing::ReplicaProxy, public virtual PortableServer::RefCountServantBase { @@ -83,4 +90,8 @@ private: // 0 == currently disconnected from load balancer }; +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + #endif /* TAO_REPLICAPROXY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.cpp b/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.cpp index a899db89c3f..8d6ec187e36 100644 --- a/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.cpp @@ -3,7 +3,8 @@ // $Id$ -#include "orbsvcs/LoadBalancing/Round_Robin_Strategy.h" +#include "Round_Robin_Strategy.h" +#include "ReplicaProxy.h" ACE_RCSID(orbsvcs, Round_Robin_Strategy, "$Id$") @@ -12,7 +13,6 @@ Round_Robin_Strategy::Round_Robin_Strategy (void) : proxies_ (), next_replica_ (this->proxies_.end ()) { - // Nothing else } Round_Robin_Strategy::~Round_Robin_Strategy (void) @@ -56,7 +56,7 @@ Round_Robin_Strategy::replica (CORBA::Environment &ACE_TRY_ENV) int Round_Robin_Strategy::insert (ReplicaProxy_Impl *proxy) { - return this->proxies_.insert (proxy) + return this->proxies_.insert (proxy); } int @@ -64,4 +64,3 @@ Round_Robin_Strategy::remove (ReplicaProxy_Impl *proxy) { return this->proxies_.remove (proxy); } - diff --git a/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.h b/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.h index 6948c610c3b..e65d8cdb39c 100644 --- a/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/Round_Robin_Strategy.h @@ -15,23 +15,20 @@ // // ============================================================================ -#include "orbsvcs/LoadBalancingS.h" -#include "orbsvcs/LoadBalancing/LoadBalancing_Strategy.h" - - #ifndef ROUND_ROBIN_STRATEGY_H #define ROUND_ROBIN_STRATEGY_H +#include "LoadBalancing_Strategy.h" +#include "orbsvcs/LoadBalancingS.h" +#include "ace/Containers.h" // Forward declarations class ReplicaProxy_Impl; -template class ACE_Unbounded_Set<ReplicaProxy_Impl *>; - -typedef ACE_Unbounded_Set<ReplicaProxy_Impl *> - ReplicaProxySet; +typedef ACE_Unbounded_Set<ReplicaProxy_Impl *> ReplicaProxySet; +typedef ACE_Unbounded_Set_Iterator<ReplicaProxy_Impl *> ReplicaProxySetIterator; -class Round_Robin_Strategy : public Load_Balancing_Strategy +class TAO_LoadBalancing_Export Round_Robin_Strategy : public Load_Balancing_Strategy { // = TITLE // Round Robin load balancing strategy @@ -42,19 +39,22 @@ class Round_Robin_Strategy : public Load_Balancing_Strategy // fashion. public: - Round_Robin_Strategy (void); // Constructor. + ~Round_Robin_Strategy (void); + // Destructor + + // = The Load_Balancing_Strategy methods virtual CORBA::Object_ptr replica (CORBA_Environment &ACE_TRY_ENV); - // Return the object reference to the Replica to which requests should - // be redirected. + virtual int insert (ReplicaProxy_Impl *); + virtual int remove (ReplicaProxy_Impl *); private: - ReplicaProxySet proxies_; // Set containing the ReplicaProxy servants. -}; + ACE_Unbounded_Set_Iterator<ReplicaProxy_Impl*> next_replica_; +}; #endif /* ROUND_ROBIN_STRATEGY_H */ diff --git a/TAO/orbsvcs/orbsvcs/orbsvcs.dsw b/TAO/orbsvcs/orbsvcs/orbsvcs.dsw index 2e005c2d794..2770ba3bab9 100644 --- a/TAO/orbsvcs/orbsvcs/orbsvcs.dsw +++ b/TAO/orbsvcs/orbsvcs/orbsvcs.dsw @@ -159,6 +159,18 @@ Package=<4> ###############################################################################
+Project: "LoadBalancing"=.\LoadBalancing.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "RTEvent"=.\RTEvent.dsp - Package Owner=<4>
Package=<5>
diff --git a/TAO/orbsvcs/tests/LoadBalancing/client.cpp b/TAO/orbsvcs/tests/LoadBalancing/client.cpp index 2855b63ef6e..f45d1eb61f9 100644 --- a/TAO/orbsvcs/tests/LoadBalancing/client.cpp +++ b/TAO/orbsvcs/tests/LoadBalancing/client.cpp @@ -7,7 +7,80 @@ int main (int argc, char *argv[]) { + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // Initialize ORB. + CORBA::ORB_var orb = + CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); + ACE_TRY_CHECK; + const char *ior = "file://test.ior"; + long timeout = 50000; // timeout in msecs + long iterations = 10000; // iterations + + // Parse the application options after the ORB has been + // initialized. + ACE_Get_Opt options (argc, argv, "k:t:"); + int c = 0; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = options.optarg; + break; + + case 't': + timeout = ACE_OS::atoi (options.optarg); + break; + + default: + ACE_ERROR_RETURN ((LM_ERROR, + "Usage: %s " + "[-k ReplicaIOR] " + "[-t timeout (msecs)] " + "[-i iterations] " + "\n", + argv[0]), + -1); + } + + CORBA::Object_var obj = + orb->string_to_object (ior); + + Hash_Replica_var hasher = + Has_Replica::_unchecked_narrow (obj.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + ACE_Throughput_Stats stats; + ACE_UINT64 test_start = ACE_OS::gethrtime (); + + for (long i = 0; i != iterations; ++i) + { + CORBA::String_var hash_result; + + ACE_UINT64 call_start = ACE_OS::gethrtime (); + hasher->do_hash (argv[0], hash_result.out (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + ACE_UINT64 end = ACE_OS::gethrtime (); + + stats.sample (end - test_start, end - call_start); + } + + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + stats.dump_results ("Hash Stats", gsf); + + orb->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "SYS_EX"); + } + ACE_ENDTRY; return 0; } diff --git a/TAO/orbsvcs/tests/LoadBalancing/server.cpp b/TAO/orbsvcs/tests/LoadBalancing/server.cpp index 1c1740ff18d..61598167705 100644 --- a/TAO/orbsvcs/tests/LoadBalancing/server.cpp +++ b/TAO/orbsvcs/tests/LoadBalancing/server.cpp @@ -15,7 +15,7 @@ main (int argc, char *argv[]) CORBA::ORB_init (argc, argv, "", ACE_TRY_ENV); ACE_TRY_CHECK; - CORBA::String_var balancer_ior; + const char *balancer_ior = "file://test.ior"; // Parse the application options after the ORB has been // initialized. @@ -26,7 +26,7 @@ main (int argc, char *argv[]) switch (c) { case 'k': - IOR = CORBA::string_dup (options.optarg); + balancer_ior = options.optarg; break; default: ACE_ERROR_RETURN ((LM_ERROR, @@ -53,15 +53,20 @@ main (int argc, char *argv[]) poa_manager->activate (ACE_TRY_ENV); ACE_TRY_CHECK; - CORBA::Object_ptr load_balancer = - orb->string_to_object (balancer_ior.in ()); + CORBA::Object_var obj = + orb->string_to_object (balancer_ior); + + LoadBalancing::LoadBalancer_ptr load_balancer = + LoadBalancing::LoadBalancer::_unchecked_narrow (obj.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; Hash_ReplicaControl control (load_balancer); orb->run (ACE_TRY_ENV); ACE_TRY_CHECK; - orb->shutdown (ACE_TRY_ENV); + poa->destroy (1, 1, ACE_TRY_ENV); ACE_TRY_CHECK; orb->destroy (ACE_TRY_ENV); @@ -73,6 +78,5 @@ main (int argc, char *argv[]) } ACE_ENDTRY; - return 0; } |