+ Reply to Thread
Results 1 to 7 of 7

Thread: reload/re-init a plugin

  1. #1
    Member
    Join Date
    Jul 2010
    Posts
    39
    Thanks
    1
    Thanked 0 Times in 0 Posts

    reload/re-init a plugin

    Is there a way to reload a non-responding plugin without shutting the server. We have cases where we want to reload a server plugin and it be nice without shutting down the server. That way we can have a signal handler to maybe reload on demand or maybe some other way(timer bases?).

    Any insight will be appreciated.

    regards,
    bota

  2. #2
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,209
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    Are you talking about restarting a plugin using possibly new compiled code for it, or just restarting an instance of a plugin? Room plugins are destroyed when the room is destroyed (as long as there isn't another object on the server that is referencing them). What I have done in the past sometimes with dynamic rooms is have a timer on the room plugin and after X amount of time I lock the room, and if the plugin is still running after an additional X amount of time I destroy the room (which kills the plugin). If somebody wants to join the room after it is locked, I just create a new instance of the room - very easily done if the the room + plugin is a GameManager "game", so they just use a QuickJoinGameRequest to join the room in the first place.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Member
    Join Date
    Jul 2010
    Posts
    39
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I was thinking more of a server level plugin and restarting the same code?. Is there any way?. Is it any better in the upcoming ES5 version?. And how about the new compiled code?

    Thanks for the quick responses
    regards,

  4. #4
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,209
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    Reloading of a changed extension is planned but will not be available for the first version of ES5. I don't know if we have plans for reloading of a single plugin.

    Possible workaround:
    Use a ManagedObjectFactory, with the code that the plugin uses in the ManagedObject class. Periodically, the ManagedObjectFactory can create a fresh instance of the ManagedObject class. Or you could bury it even deeper and have the ManagedObject periodically create a fresh instance of yet a third class. Any plugin in the same extension can acquire the single instance of the ManagedObject for the server via the ManagedObjectFactory. This would not kill an instance that a plugin is currently using, but the next time that it acquires the object it would get the fresh instance. Let me know if you need more details; we have several examples that use ManagedObjects.

    Note: this still doesn't use changed source code, just makes a fresh instance of the class using the same version of the compiled source code.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  5. #5
    Member
    Join Date
    Jul 2010
    Posts
    39
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks Teresa,

    That sounds interesting, i won't mind looking at the sample code for using ManagedObject to use it.

    regards,

  6. #6
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,209
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    I do not have an example of a ManagedObject or factory that periodically generates a new instance of one of its objects. For ES4.0.6, you can see examples of ManagedObjects in your installation folder/examples for ConnectionPool and DatabaseExample. There are further examples in the following wiki tutorials:
    Logging chat by room
    Simple Database Login
    Persisting User Info
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  7. #7
    Member
    Join Date
    Jul 2010
    Posts
    39
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks. much appreciated

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts