Thursday, May 17, 2012
Google Custom Search

ClearCanvas Highlights

Download our Open Source software
Watch some Videos
Get the Source
Check out our Licensing
Join our  Forums
Some Research: OICR IPP-Trials

Our Community

Membership Membership:
Latest New User Latest: JBauza
New Today New Today: 19
New Yesterday New Yesterday: 33
User Count Overall: 22559

People Online People Online:
Visitors Visitors: 9
Members Members: 2
Total Total: 11

Online Now Online Now:
01: radialheadfx
02: JBauza

ClearCanvas Community Forums

Graceful Shutdown
Last Post 2012-02-02 01:20 PM by chafey. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
chafey
Veteran Member
Veteran Member
Posts:95

--
2012-02-01 11:46 AM  

I have a DICOM SCP that runs as a Windows Service that I would like to gracefully shutdown in response to the Service Control Manager's Stop command.  I know I can call DicomServer.StopListening() to stop listening for new associations, but I still need to deal with any open associations.  Ideally I would let any open associations complete, but an SCU could keep the association open indefinitely so I still need a timeout mechanism to abort associations still open after a given timeout. 

So a few questions:

1) Any feedback, tips or ideas on how to best do this?

2) To abort open associations, I need to enumerate them.  I didn't find any central list that CC keeps of open associations so I think I need to manage that myself.  My plan is to add the DicomServer to a list every time a new association is created and hook the NetworkClosed event so I can remove it when it is done.  Is there a cleaner or easier way than this? 

3) How does the CC ImageServer handle this?  I looked through the code and couldn't find any references to shutting down open associations.  

Thanks!

Chris

steve
Senior Member
Senior Member
Posts:1932

--
2012-02-02 10:32 AM  
Chris,

With the ImageServer, we somewhat decided to punt on this early on and have never addressed it. At the time, I believe the argument was that we just didn't want to abort an association on a modality sending to the server, so we left the association open.

So, you're right, there's no real example on how to do this. I think you're on the best path as to how to track/manage this. Although, I did alittle looking into the code, and I suspect the current code is not going to support this that well. Specifically, the NetworkClosed event is not always called, it appears. It looks like the code should be modified to call the NetworkClosed event from the CloseNetwork method in DicomClient & DicomServer, and that would ensure that the event is called. Additionally, there's not a good event when an association is received in the server to handle every case. There probably should be a static event on DicomServer that is called by the constructor of DicomServer when an incoming association is created to really be able to do this properly.

Anyways, I created ticket #9662 to attempt to address this. I'm not quite sure when we'll get to it, but I'll keep it on the list...

Steve
Real-time support available to Clinical Edition and Team Edition customers
chafey
Veteran Member
Veteran Member
Posts:95

--
2012-02-02 01:20 PM  
Steve - Thanks for your prompt reply - it is really helpful to learn that the NetworkClosed event may not be generated. In practice the current behavior is reasonable so it seems safe to punt on it (although the perfectionist in me isn't happy). Maybe the perfectionist in me will some day drive me to contribute a fix for this back :)

Chris
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2012 ClearCanvas Inc.