INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Dynamic packages in a multi-threaded application

Dynamic packages in a multi-threaded application

(OP)
Hi all,

I've written a service application that provides a HTTP server. It uses a database driven menu system to provide different webpages (system management stuff). I've written the first few functions and all is ok. Now I want to deploy for many people to be able to use, but also continue development on new functions without interrupting anyone who may be using the existing functions - at the moment, I'll need to stop the service, copy across the updated .exe and restart the service.

It occurred to me that I could use dynamic packages - when a function is used, it loads the package, and unloads when done. Adding new packages or modifying existing packages should be as easy as a copy/paste of the .BPL file, and no stop/restart of the service application is required.

Before I embark on this approach, I've realised that this is a multi-threaded environment - the package load/unloads will occur during one of the TIdHTTPServer context threads. So if two people are trying to use the same function, it would try to load the same package twice. I've googled for information on whether this is allowed or not, and can't find anything.

Do I need to manage the package loading/unloading outside of the TIdHTTPServer thread context? Or can the same package be loaded multiple times? Or should I be staying away from this type of thing altogether for this project?

Your thoughts and experience are much appreciated.

Thanks,

Griffyn

RE: Dynamic packages in a multi-threaded application

This product might help you (or at least inspire you). I haven't used it but I'm tempted by it often.

http://www.dragonsoft.us/products_dsps.php

You might consider not using constant load/reload cycles but use their method of telling the system to unload a module and then reload it when you've completed your installation.

Another challenge of loading/unloading on the fly is what happens if you want to post an update and users are trying to load that part of the framework? Using the idea of managing the process of taking down part of the framework for maintenance is appealing in this case.

RE: Dynamic packages in a multi-threaded application

(OP)
I like the 'update' approach better. Dynamically load all packages, have a timer event monitor for package updates, use a TMREWSync object to lock out any threads, unload package, copy in new update, load package.

Thanks for the idea :)

RE: Dynamic packages in a multi-threaded application

(OP)
Confirmation if anyone is interested - this has been implemented, and is working really well. The downsides of working with packages is that I had to enable the Build with Runtime packages option for the project. Which means I had to identify and deploy a whole bunch (about 15) of other .BPL files with the .exe

At one point, I considered swapping over to using DLLs, which I've used in the past, but these don't play nice with classes (instantiating classes declared in the DLL seems tricky and would need to have interfaces for the classes at the least).

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close