Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-01-2006
programmerdad programmerdad is offline
Registered User
 
 
Join Date: Aug 2006
Location: London, Ontario, Canada
Posts: 8
resource disposal in shared servant

Hello, this is my first project with Ice. So I'm virtually retarded.
I've created a servant that will do a database lookup and return a simple struct of details, without maintaining any state other than a database connection. The main point being that the (expensive, IBM UniVerse on AIX) database connection will be shared. The main client at this point will be web pages, but other apps in the future. Where I am stuck is how to implement the disposal of the resource (database connection) when the clients share the servant, and none of them will explicitly destroy the servant?

If I fail to properly close the connection before the servant is disposed of, the driver throws an exception. To tide me over, I've added a 'destroy' operation on the servant which closes the conn, and closing it after each client is done, at the price that I've lost the main reason for sharing the servant.

Servant's in C#. The C# finalizer does not get called before the exception is thrown, so that's out. I'm using a locator, and I looked at ServantLocator.deactivate, but the only parameter is category. How do I id the servant in deactivate?

Am I going about this in the wrong way?

Thanks

signature added

Last edited by programmerdad : 08-01-2006 at 06:53 PM.
Reply With Quote
  #2 (permalink)  
Old 08-01-2006
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,060
Welcome to the forums! In order for us to assist you you must first fill in your signature details as described in the link in my signature.
Reply With Quote
  #3 (permalink)  
Old 08-01-2006
programmerdad programmerdad is offline
Registered User
 
 
Join Date: Aug 2006
Location: London, Ontario, Canada
Posts: 8
signature

sorry I've added my signature
__________________
Chris Cauchi
Scholar's Choice
Ice Project: core enterprise services rewrite
Reply With Quote
  #4 (permalink)  
Old 08-01-2006
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,060
You should read Michi's lifecycle article in issue 11 of Connections. http://www.zeroc.com/newsletter. After that if you still have questions let us know
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Who will reap the abandoned resource? OrNot Help Center 8 01-19-2006 10:01 AM
A Question about Shared and GCShared OrNot Help Center 3 06-23-2005 12:03 AM
can i create servant instance from shared library?help! lanbo Help Center 10 02-24-2005 08:27 AM
shared my Slice2CppTask source code with u! lanbo Comments 1 01-04-2005 08:03 PM
Resource / Code Snippet Submission? amrufon Comments 0 10-29-2003 04:21 AM


All times are GMT -4. The time now is 09:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.