Changeset 4701

Show
Ignore:
Timestamp:
06/12/08 16:45:02 (6 months ago)
Author:
xmlhacker
Message:

addition of load balancing worker queue

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/nuxleus/Source/Dependencies/Scope/Scope/HandlerBase.cs

    r4696 r4701  
    44using System.Text; 
    55 
    6 namespace VVMF.SOA.Common 
    7 
    8     public sealed class ScopeExceptionEventArg : EventArgs 
    9     { 
     6namespace VVMF.SOA.Common { 
     7    public sealed class ScopeExceptionEventArg : EventArgs { 
    108        public Exception Exception { get; internal set; } 
    119 
     
    1311    } 
    1412 
    15     public abstract class HandlerBase 
    16     { 
    17         public HandlerBase() 
    18         { 
     13    public abstract class HandlerBase { 
     14        public HandlerBase() { 
    1915            scope = new Scope(ScopeMethod); 
    2016            Enabled = true; 
    2117        } 
    22          
     18 
    2319        Scope scope; 
    2420 
    25         public Scope Scope 
    26         { 
     21        public Scope Scope { 
    2722            get { return scope; } 
    2823        } 
    2924 
    30         public static implicit operator Scope(HandlerBase handler) 
    31         { 
    32             if (handler == null) return new Scope(); 
     25        public static implicit operator Scope(HandlerBase handler) { 
     26            if (handler == null) 
     27                return new Scope(); 
    3328            return handler.scope; 
    3429        } 
     
    4439        public event EventHandler<ScopeExceptionEventArg> ScopeException; 
    4540 
    46         Scope.Chain ScopeMethod(Scope.Chain code) 
    47         { 
    48             if (inFlag || !Enabled) return (p) => { code(null); return null; }; 
     41        Scope.Chain ScopeMethod(Scope.Chain code) { 
     42            if (inFlag || !Enabled) 
     43                return (p) => { code(null); return null; }; 
    4944 
    50             return (p) =>  
    51             { 
     45            return (p) => { 
    5246                inFlag = true; 
    53                 try 
    54                 { 
     47                try { 
    5548                    OnEnterScope(EventArgs.Empty); 
    5649                    this.code = code; 
    5750                    Call(); 
    58                 } 
    59                 finally 
    60                 { 
     51                } finally { 
    6152                    OnLeaveScope(EventArgs.Empty); 
    6253                    inFlag = false; 
    6354                } 
    64                 return null;  
     55                return null; 
    6556            }; 
    6657        } 
     
    6859        Scope.Chain code; 
    6960 
    70         protected virtual void Call() 
    71         { 
    72             if (code != null) 
    73             { 
    74                 try 
    75                 { 
     61        protected virtual void Call() { 
     62            if (code != null) { 
     63                try { 
    7664                    code(null); 
    77                 } 
    78                 catch (Exception ex) 
    79                 { 
     65                } catch (Exception ex) { 
    8066                    ScopeExceptionEventArg e = new ScopeExceptionEventArg { Exception = ex }; 
    8167                    OnScopeException(e); 
    82                     if (!e.Handled) throw ex; 
    83                 } 
    84                 finally 
    85                 { 
     68                    if (!e.Handled) 
     69                        throw ex; 
     70                } finally { 
    8671                    code = null; 
    8772                } 
     
    8974        } 
    9075 
    91         protected virtual void OnEnterScope(EventArgs e) 
    92         { 
     76        protected virtual void OnEnterScope(EventArgs e) { 
    9377            EventHandler handler = EnterScope; 
    94             if (handler != null) handler(this, e); 
     78            if (handler != null) 
     79                handler(this, e); 
    9580        } 
    9681 
    97         protected virtual void OnLeaveScope(EventArgs e) 
    98         { 
     82        protected virtual void OnLeaveScope(EventArgs e) { 
    9983            EventHandler handler = LeaveScope; 
    100             if (handler != null) handler(this, e); 
     84            if (handler != null) 
     85                handler(this, e); 
    10186        } 
    10287 
    103         protected virtual void OnScopeException(ScopeExceptionEventArg e) 
    104         { 
     88        protected virtual void OnScopeException(ScopeExceptionEventArg e) { 
    10589            EventHandler<ScopeExceptionEventArg> handler = ScopeException; 
    106             if (handler != null) handler(this, e); 
     90            if (handler != null) 
     91                handler(this, e); 
    10792        } 
    10893    } 
  • trunk/nuxleus/Source/Nuxleus.Extension.Aws.Sdb/Sdb/GetAttributesResponse.cs

    r4487 r4701  
    1515using System.Xml; 
    1616 
    17 namespace Nuxleus.Extension.Aws.Sdb 
    18 
    19     public class GetAttributesResponse : Response 
    20     { 
     17namespace Nuxleus.Extension.Aws.Sdb { 
     18    public class GetAttributesResponse : Response { 
    2119        private ArrayList attributes = new ArrayList(); 
    2220        private string responseName = "GetAttributesResponse"; 
    2321 
    24         public GetAttributesResponse (string response) 
    25         { 
     22        public GetAttributesResponse(string response) { 
    2623            XmlDocument doc = new XmlDocument(); 
    2724            doc.LoadXml(response); 
     
    3128            processResponse(responseName, doc); 
    3229 
    33             foreach (XmlNode node in doc.ChildNodes) 
    34             { 
    35                 if (node.Name.Equals(responseName)) 
    36                 { 
    37                     foreach (XmlNode attributesNode in node.ChildNodes) 
    38                     { 
    39                         if (attributesNode.Name.Equals("Attribute")) 
    40                         { 
     30            foreach (XmlNode node in doc.ChildNodes) { 
     31                if (node.Name.Equals(responseName)) { 
     32                    foreach (XmlNode attributesNode in node.ChildNodes) { 
     33                        if (attributesNode.Name.Equals("Attribute")) { 
    4134                            string name = ""; 
    4235                            string value = ""; 
    4336 
    4437                            foreach (XmlNode attributeNode in 
    45                                  attributesNode.ChildNodes) 
    46                             { 
    47                                 if (attributeNode.Name.Equals("Name")) 
    48                                 { 
     38                                 attributesNode.ChildNodes) { 
     39                                if (attributeNode.Name.Equals("Name")) { 
    4940                                    name = attributeNode.InnerText; 
    5041                                } 
    51                                 if (attributeNode.Name.Equals("Value")) 
    52                                 { 
     42                                if (attributeNode.Name.Equals("Value")) { 
    5343                                    value = attributeNode.InnerText; 
    5444                                } 
     
    6252        } 
    6353 
    64         public ICollection Attributes () 
    65         { 
     54        public ICollection Attributes() { 
    6655            return attributes; 
    6756        } 
  • trunk/nuxleus/Source/Nuxleus.Extension.Aws/Nuxleus.Extension.Aws.csproj

    r4695 r4701  
    6767      <DependentUpon>Settings.settings</DependentUpon> 
    6868    </Compile> 
     69    <Compile Include="SimpleDB\Model\Attribute.cs" /> 
     70    <Compile Include="SimpleDB\Model\CreateDomain.cs" /> 
     71    <Compile Include="SimpleDB\Model\CreateDomainResponse.cs" /> 
     72    <Compile Include="SimpleDB\Model\DeleteAttributes.cs" /> 
     73    <Compile Include="SimpleDB\Model\DeleteAttributesResponse.cs" /> 
     74    <Compile Include="SimpleDB\Model\DeleteDomain.cs" /> 
     75    <Compile Include="SimpleDB\Model\DeleteDomainResponse.cs" /> 
     76    <Compile Include="SimpleDB\Model\Error.cs" /> 
     77    <Compile Include="SimpleDB\Model\ErrorResponse.cs" /> 
     78    <Compile Include="SimpleDB\Model\GetAttributes.cs" /> 
     79    <Compile Include="SimpleDB\Model\GetAttributesResponse.cs" /> 
     80    <Compile Include="SimpleDB\Model\GetAttributesResult.cs" /> 
     81    <Compile Include="SimpleDB\Model\ListDomains.cs" /> 
     82    <Compile Include="SimpleDB\Model\ListDomainsResponse.cs" /> 
     83    <Compile Include="SimpleDB\Model\ListDomainsResult.cs" /> 
     84    <Compile Include="SimpleDB\Model\PutAttributes.cs" /> 
     85    <Compile Include="SimpleDB\Model\PutAttributesResponse.cs" /> 
     86    <Compile Include="SimpleDB\Model\Query.cs" /> 
     87    <Compile Include="SimpleDB\Model\QueryResponse.cs" /> 
     88    <Compile Include="SimpleDB\Model\QueryResult.cs" /> 
     89    <Compile Include="SimpleDB\Model\ReplaceableAttribute.cs" /> 
     90    <Compile Include="SimpleDB\Model\ResponseMetadata.cs" /> 
    6991    <Compile Include="SimpleDB\SdbAction.cs" /> 
    7092    <Compile Include="SimpleDB\SimpleDBService.cs" /> 
  • trunk/nuxleus/Source/Nuxleus.Extension.Aws/SimpleDB/SimpleDBService.cs

    r4699 r4701  
    162162            request.Pipelined = true; 
    163163 
    164             Console.WriteLine("[] starting on thread: {0}", Thread.CurrentThread.ManagedThreadId); 
     164            Console.WriteLine("Start Request: Thread is background: {0}, Thread ID: {1}, Thread is managed: {2}", Thread.CurrentThread.IsBackground, Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.IsThreadPoolThread); 
    165165 
    166166            using (Stream newStream = request.GetRequestStream()) { 
     
    176176            } 
    177177 
    178             Console.WriteLine("Current thread id: {0}", Thread.CurrentThread.ManagedThreadId); 
     178            Console.WriteLine("End Request: Thread is background: {0}, Thread ID: {1}, Thread is managed: {2}", Thread.CurrentThread.IsBackground, Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.IsThreadPoolThread); 
    179179             
    180180        } 
  • trunk/nuxleus/Source/Nuxleus.Messaging/LoadBalancer/LoadBalancer.cs

    r4684 r4701  
    11using System; 
    22using System.Collections; 
     3using System.Threading; 
    34 
    45namespace Nuxleus.Messaging { 
  • trunk/nuxleus/Source/nuXleus.sln

    r4698 r4701  
    131131EndProject 
    132132Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScopeTest", "Dependencies\Scope\ScopeTest\ScopeTest.csproj", "{A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}" 
     133EndProject 
     134Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Loadbalancer_Test", "Loadbalancer_Test\Loadbalancer_Test.csproj", "{8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}" 
    133135EndProject 
    134136Global 
     
    10601062                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|x64.ActiveCfg = Release|Any CPU 
    10611063                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|x86.ActiveCfg = Release|Any CPU 
     1064                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Debug|.NET.ActiveCfg = Debug|Any CPU 
     1065                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 
     1066                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Debug|Any CPU.Build.0 = Debug|Any CPU 
     1067                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 
     1068                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 
     1069                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Debug|x64.ActiveCfg = Debug|Any CPU 
     1070                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Debug|x86.ActiveCfg = Debug|Any CPU 
     1071                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Release|.NET.ActiveCfg = Release|Any CPU 
     1072                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Release|Any CPU.ActiveCfg = Release|Any CPU 
     1073                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Release|Any CPU.Build.0 = Release|Any CPU 
     1074                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 
     1075                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Release|Mixed Platforms.Build.0 = Release|Any CPU 
     1076                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Release|x64.ActiveCfg = Release|Any CPU 
     1077                {8B0AB3D7-981B-46C7-AD7D-8C2FADA0625D}.Release|x86.ActiveCfg = Release|Any CPU 
    10621078        EndGlobalSection 
    10631079        GlobalSection(SolutionProperties) = preSolution