Accessing pooled object from web application

Posted on 2006-03-21
Last Modified: 2010-04-16
Dear Friends
   I need guidance for below problem
 A win app which should instantiates say 5 object in an ary.And a web application residing in the same machine should access the objects from the memory.when 'user A' logsin the web app should search for  available free object(out of 5) from the memory and that object must be locked until unless 'user A' logsout in between if 'user B' logsin it should search for free object(out of 4) .At a time 5 user should access 5 differrnt object  
thanks in advane

Question by:dees
    LVL 10

    Expert Comment


    use constucter of that class and with the help of  variable you can keep track of those object
    LVL 12

    Accepted Solution

    There are lots of ways to implement a pool, but the real problem is sharing the objects between two different applications on the same machine. I have to say I don't know a simple way of doing that.

    One solution (not simple) will be to implement a Remoting service on IIS. This will host the pool as a Singleton object (an object of which there can only ever be a single instance of in a given application space). Your pool will be a collection of the objects that you want to pool. Each of these will be stored along with a flag that indicates if they are free or not. You will also need to implement some kind of pool manager that will maintain the pool and solve problems such as permanently checked-out objects caused by application crashes etc.

    This is not a simple problem, and therefore it won't have a simple solution, but with a little persistence you will be able to pull it all together. I couldn't find many good background articles, so I would first read up on what a singleton design pattern is:

    Then have a look at this for an idea of one method for implementing a singleton in .NET on IIS:

    If you think you can do all that, then you need to design your pool. You can use System.Collections.CollectionBase as the base of the collection that will hold you pooled objects, but you will need to do something along the lines of storing a wrapper class that will also store attributes such as CheckedOut, TimeOfCheckOut, UserWhoCheckedOut etc. Finally you need to decide on your pool management strategy, and design a timer-based class that is created with the pool and that looks after the pool.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now