Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 06-15-2007
Djaunl Djaunl is offline
Registered User
 
Name: Dan Gresh
Organization: LLE
Project: EP control systems
 
Join Date: Mar 2007
Posts: 15
Ice.Communicator.shutdown() not working

Hi all,

I'm using an Ice.Communicator (IC) for an IceStorm service. I am subscribing to the topic appropriately, and calling IC.waitForShutdown(). This works fine.

However, I want to unsubscribe to the topic and call IC.shutdown(), then call IC.destroy(). However, when I try to call these three methods, only IC.destroy() seems to work, and I get an Exception:

Code:
Ice.CommunicatorDestroyedException
	at IceInternal.Instance.proxyFactory(Instance.java:78)
	at Ice.ObjectPrxHelperBase.__handleException(ObjectPrxHelperBase.java:820)
	at IceStorm.TopicPrxHelper.unsubscribe(TopicPrxHelper.java:257)
	at IceStorm.TopicPrxHelper.unsubscribe(TopicPrxHelper.java:235)
	at imaq.matlab.IMAQObserverClient.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
This is the way my code to subscribe and wait is set up. Assume everything is set up correctly (which it is); the variable names should be self-explanatory, as I used the same ones from the documentation:

Code:
			try {
				topic = topicManager.retrieve(topicName);
				Map qos = null;
				topic.subscribe(qos, subscriber);
			} catch (IceStorm.NoSuchTopic e) {
				throw new Exception();
			}

			adapter.activate();
			ic.waitForShutdown();
			topic.unsubscribe(subscriber);
Here is the method I am using to try to call IC.shutdown() and other such things. This is in the same class:

Code:
	public void stop() {
		System.err.println("DEBUG: attempting to unsubscribe");
		topic.unsubscribe(subscriber);
		System.err.println("DEBUG: attempting to shutdown IC");
		ic.shutdown();
		System.err.println("DEBUG: attempting to destroy IC");
		ic.destroy();
	}
When I call this method, it goes through all the DEBUG statements, and finally destroys the IC, giving the Exception I posted above.

Is there another way I should be doing this? I don't like destroying the IC and getting an Exception. Do I need to provide more information for a reliable answer?

Thank you very much,
Dan
Reply With Quote
  #2 (permalink)  
Old 06-15-2007
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,543
Hi,

You're getting this exception because the communicator is already destroyed at the time you call unsubscribe() on the topic. That's because you call destroy() on the communicator right after shutdown().

Calling ic.destroy() after topic.unsubscribe() should fix your problem.

Cheers,
Benoit.
Reply With Quote
  #3 (permalink)  
Old 06-18-2007
Djaunl Djaunl is offline
Registered User
 
Name: Dan Gresh
Organization: LLE
Project: EP control systems
 
Join Date: Mar 2007
Posts: 15
Thank you for the helpful reply; this worked perfectly!
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
Ice::Communicator gesly Comments 4 04-25-2007 02:50 PM
python: shutdown of communicator hangs hiasl Help Center 6 02-05-2007 02:50 PM
Ice 3.1: Communicator.setDefaultContext() stephan Help Center 8 07-20-2006 04:40 PM
Notification on communicator shutdown stephan Help Center 11 10-13-2004 05:38 PM
Ice timeouts, callbacks, and shutdown. rhochmuth Help Center 1 09-09-2004 11:50 AM


All times are GMT -4. The time now is 12:05 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.