• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Accessing pooled object from web application

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

Dees
0
dees
Asked:
dees
1 Solution
 
SystemExpertCommented:

use constucter of that class and with the help of  variable you can keep track of those object
0
 
AGBrownCommented:
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:
http://www.dofactory.com/Patterns/PatternSingleton.aspx

Then have a look at this for an idea of one method for implementing a singleton in .NET on IIS:
http://www.codeproject.com/dotnet/ShareObjDotNet.asp

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.

Andy
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now