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. Remoting and Finalize

Remoting and Finalize

Scheduled Pinned Locked Moved C#
databasequestionworkspace
5 Posts 3 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.
  • A Offline
    A Offline
    Adam Turner
    wrote on last edited by
    #1

    I want to setup a remote singleton that keeps a sequence (and increments it). I get the last sequence number from a database and before the object is garbage collected i want to save the value back to the database. Should/Can i implement this in the singleton's finalize method or is there someway to use ILease and when Sponsorship times out, then save to the database?

    P P 2 Replies Last reply
    0
    • A Adam Turner

      I want to setup a remote singleton that keeps a sequence (and increments it). I get the last sequence number from a database and before the object is garbage collected i want to save the value back to the database. Should/Can i implement this in the singleton's finalize method or is there someway to use ILease and when Sponsorship times out, then save to the database?

      P Offline
      P Offline
      Philip Fitzsimons
      wrote on last edited by
      #2

      nope your are meant to use dispose (IDisposable) for this kind of thing. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIDisposableClassDisposeTopic.asp[^]


      "When the only tool you have is a hammer, a sore thumb you will have."

      A 1 Reply Last reply
      0
      • A Adam Turner

        I want to setup a remote singleton that keeps a sequence (and increments it). I get the last sequence number from a database and before the object is garbage collected i want to save the value back to the database. Should/Can i implement this in the singleton's finalize method or is there someway to use ILease and when Sponsorship times out, then save to the database?

        P Offline
        P Offline
        Paresh Gheewala
        wrote on last edited by
        #3

        check out this site itself there is a singleton sample !!!

        A 1 Reply Last reply
        0
        • P Paresh Gheewala

          check out this site itself there is a singleton sample !!!

          A Offline
          A Offline
          Adam Turner
          wrote on last edited by
          #4

          I know that. I am using it as a base for some work that i am doing. But i dont know when the remoted object is destroyed, so i wanted to know about Finalize, since MarshalByRefObject doesnt derive from Componnet so doesnt have Dispose.

          1 Reply Last reply
          0
          • P Philip Fitzsimons

            nope your are meant to use dispose (IDisposable) for this kind of thing. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIDisposableClassDisposeTopic.asp[^]


            "When the only tool you have is a hammer, a sore thumb you will have."

            A Offline
            A Offline
            Adam Turner
            wrote on last edited by
            #5

            MarshalByRefObject doesnt derive from Componnet so doesnt have Dispose, and you need to derive a remoted object from MarshalByRefObject.

            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