SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-07-2006, 11:54 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
A means to check if Sage is shutting down?

I'd like to try and close my socket server in java in a happy manner when Sage closes. Right now, my server stays in an infinite loop, even if a client disconnects (then it just waits for a new one), but I could put in some kind of check to see if Sage is closing and then I could close the server socket. I've looked through the API for some kind of IsShuttingDown() call, but nothing. I found Exit(), but that closes Sage,which isn't my goal here.
Reply With Quote
  #2  
Old 08-08-2006, 12:19 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
How about: java.lang.Runtime.addShutdownHook(java.lang.Thread)
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #3  
Old 08-08-2006, 04:53 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I don't know if this would be of any help, but there is an ApplicationExiting hook that can be used in the STV, where you could shut things down when SageTV is about to exit. But, this would only be useful when using a SageTV UI; the service wouldn't call such a hook since it doesn't use an STV. Niel's suggestion is probably better, but I figured I would toss this one out anyway.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #4  
Old 08-08-2006, 05:13 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
... and if you just need to close the socket(s), don't worry about it -- the OS will do that for you when the application exits...

If you need to send some 'i am shutting down' message to the clients, then thats different
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #5  
Old 08-08-2006, 09:40 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, I'm trying to track down a problem I'm having. I can get my CQC driver to connect as a client to my Sage/java server just fine...and they're all happy. However, when I close Sage, my CQC driver does not detect that the socket has been closed...it still acts like it's connected. So I'd like to see if I send the socketserver.close() command, if that would do it.

Now that I think about it, I guess I can just send a command and have Sage close the server manually without exitting altogether, and then I'll see how the other side reacts. Then I'll know if it's a bug in the CQC side, or if I really do need to manually kill the server.

thanks for the info, nielm...I'll probably do that also.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.