Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Windows Service Design - connection pool

Windows Service Design - connection pool

Scheduled Pinned Locked Moved C#
questiondesignsysadmin
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nlarson11
    wrote on last edited by
    #1

    Hello, I want to create a windows service that will act as a connection pool manager for a 3rd party tool to various apps (web, utilities, etc) that are running on same server. I'm struggling with how the other apps call this service without creating additional instances of the exe. I've played with load assembly and references and it seemingly is creating an additional instance. Proof: I have a static class that is populated (initialized) upon load of the service. When an app tries to create an instance of a different class that calls methods within the static class...the static class is empty (uninitialized). So my conclusuion is a second instance is created? How can I design this to do what I'm looking for... Thank you for your time... Nathan

    'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous

    L 1 Reply Last reply
    0
    • N nlarson11

      Hello, I want to create a windows service that will act as a connection pool manager for a 3rd party tool to various apps (web, utilities, etc) that are running on same server. I'm struggling with how the other apps call this service without creating additional instances of the exe. I've played with load assembly and references and it seemingly is creating an additional instance. Proof: I have a static class that is populated (initialized) upon load of the service. When an app tries to create an instance of a different class that calls methods within the static class...the static class is empty (uninitialized). So my conclusuion is a second instance is created? How can I design this to do what I'm looking for... Thank you for your time... Nathan

      'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      nlarson11 wrote:

      When an app tries to create an instance of a different class that calls methods within the static class...the static class is empty (uninitialized). So my conclusuion is a second instance is created?

      Within that application; a static class is loaded only once per application-domain. Why does it have to be a Windows Service? If you're referencing it, or loading it in another app, then it is being used as a class-library.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      N 1 Reply Last reply
      0
      • L Lost User

        nlarson11 wrote:

        When an app tries to create an instance of a different class that calls methods within the static class...the static class is empty (uninitialized). So my conclusuion is a second instance is created?

        Within that application; a static class is loaded only once per application-domain. Why does it have to be a Windows Service? If you're referencing it, or loading it in another app, then it is being used as a class-library.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        N Offline
        N Offline
        nlarson11
        wrote on last edited by
        #3

        Hello Eddy, thank you for your response... Windows service vs a class-library: My apps include a classic asp website, a asp.net wcf service site, a asp.net webforms site, a asp.net mvc site, as well as scheduled tasks. What keeps that library running and accessible from all calling apps? The intent is to use one pool, not one per app to cut down on the number of connections to our mainframe. The 3rd party tool creates two connections (first is to establish connection, second is the actual call to the service) per transaction to be able to call a specific service on our mainframe. The first connection can be "cached" / held on to which is what the pool manager is intended to do. Thanks again for your time..

        'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

        L 1 Reply Last reply
        0
        • N nlarson11

          Hello Eddy, thank you for your response... Windows service vs a class-library: My apps include a classic asp website, a asp.net wcf service site, a asp.net webforms site, a asp.net mvc site, as well as scheduled tasks. What keeps that library running and accessible from all calling apps? The intent is to use one pool, not one per app to cut down on the number of connections to our mainframe. The 3rd party tool creates two connections (first is to establish connection, second is the actual call to the service) per transaction to be able to call a specific service on our mainframe. The first connection can be "cached" / held on to which is what the pool manager is intended to do. Thanks again for your time..

          'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          nlarson11 wrote:

          The first connection can be "cached" / held on to which is what the pool manager is intended to do.

          It's still unclear where your class "is" - and the list of web-based apps doesn't simplify that. Where does the connection manager get it's connections from?

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

          N 1 Reply Last reply
          0
          • L Lost User

            nlarson11 wrote:

            The first connection can be "cached" / held on to which is what the pool manager is intended to do.

            It's still unclear where your class "is" - and the list of web-based apps doesn't simplify that. Where does the connection manager get it's connections from?

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

            N Offline
            N Offline
            nlarson11
            wrote on last edited by
            #5

            Sorry - never been gifted in painting a picture :( The pool, connections, and transactions to the mainframe are all created/handled in the windows service. An app creates an instance to a class within the windows service that will execute transaction logic making it's way to the mainframe. This logic checks first if the pool has a link and uses it if it does or creates a link and then passes it to the pool to hold on to.

            'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

            L 1 Reply Last reply
            0
            • N nlarson11

              Sorry - never been gifted in painting a picture :( The pool, connections, and transactions to the mainframe are all created/handled in the windows service. An app creates an instance to a class within the windows service that will execute transaction logic making it's way to the mainframe. This logic checks first if the pool has a link and uses it if it does or creates a link and then passes it to the pool to hold on to.

              'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              nlarson11 wrote:

              The pool, connections, and transactions to the mainframe are all created/handled in the windows service

              The Pool, Connection and Transaction are managed .NET classes? If yes, which clients will be using those classes? The static classes in there will be unique per AppDomain. You can't a static class to share resources among different applications - there's not a static class that's "global" across applications. A Windows-Service would only be usefull if there's an app that needs to run without user-supervision. It'd be comparable to writing a server-application, and yes, you could communicate with that. Is there an unmanaged resource that the Pool is protecting? What kind of connection is the user expecting? It "feels" like you're trying to limit database-connections - am I right?

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups