Go Back   ZeroC Forums > Comments

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-23-2006
rc_hz rc_hz is offline
Registered User
 
Name: Eric RC
Organization: www.genband.com
Project: No project yet
 
Join Date: Jul 2004
Location: Hangzhou, China
Posts: 189
Send a message via MSN to rc_hz
-->
Can deactivated object adapter really be reactivated ?

In page 733 of Ice 3.1.0 manul:
Code:
...
Once an adapter has been deactivated, you can reactivate it again. Any attempt to use a deactivated object adapter results in an ObjectAdapterDeactivatedException.
...
However, the following code throws an exception:
Code:
public class Server {
	public static void main(String[] args) {
		int status = 0;
		Ice.Communicator ic = null;
		try {
			ic = Ice.Util.initialize(args);
			Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints(
					"SimplePrinterAdapter", "default -p 10000");
			Ice.Object object = new PrinterI();
			adapter.add(object, ic.stringToIdentity("SimplePrinter"));
			System.out.println("1....");
			adapter.activate();
			System.out.println("2....");
			adapter.deactivate();
			System.out.println("3....");
			adapter.activate();
			//adapter.hold();			//error
			System.out.println("4....");
			ic.waitForShutdown();
		} catch (Ice.LocalException e) {
			e.printStackTrace();
			status = 1;
		} catch (Exception e) {
			System.err.println(e.getMessage());
			status = 1;
		}
		if (ic != null) {
			// Clean up
			//
			try {
				ic.destroy();
			} catch (Exception e) {
				System.err.println(e.getMessage());
				status = 1;
			}
		}
		System.exit(status);
	}
}
The exception is as follows:
Code:
D:\>java Server
1....
2....
3....
Ice.ObjectAdapterDeactivatedException
    name = "SimplePrinterAdapter"
        at Ice.ObjectAdapterI.checkForDeactivation(ObjectAdapterI.java:946)
        at Ice.ObjectAdapterI.activate(ObjectAdapterI.java:40)
        at Server.main(Server.java:25)
__________________
Eric RC
www.genband.com (telecommunication)
I like ICE (Ice for C++/Java/Python)
Reply With Quote
  #2 (permalink)  
Old 08-23-2006
rc_hz rc_hz is offline
Registered User
 
Name: Eric RC
Organization: www.genband.com
Project: No project yet
 
Join Date: Jul 2004
Location: Hangzhou, China
Posts: 189
Send a message via MSN to rc_hz
-->
In my option, since ObjectAdapter has three states: hold, active, inactive, it is better that we don't allow an deactivated ObjectAdapter to be reactivated.
__________________
Eric RC
www.genband.com (telecommunication)
I like ICE (Ice for C++/Java/Python)
Reply With Quote
  #3 (permalink)  
Old 08-23-2006
dwayne's Avatar
dwayne dwayne is offline
ZeroC Staff
 
Name: Dwayne Boone
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Jan 2005
Location: St. John's, Newfoundland
Posts: 207
Hi,

That is a typo in the manual. It should read

Code:
Once an adapter has been deactivated, you cannot reactivate it again.
However, as of Ice 3.1.0 it is possible to recreate an adapter with the same name as a deactivated adapter as soon as waitForDeactivate() returns on the first adapter.

Regards,
Dwayne
Reply With Quote
  #4 (permalink)  
Old 08-23-2006
rc_hz rc_hz is offline
Registered User
 
Name: Eric RC
Organization: www.genband.com
Project: No project yet
 
Join Date: Jul 2004
Location: Hangzhou, China
Posts: 189
Send a message via MSN to rc_hz
-->
Thank you, I see.
__________________
Eric RC
www.genband.com (telecommunication)
I like ICE (Ice for C++/Java/Python)
Reply With Quote
  #5 (permalink)  
Old 08-23-2006
rc_hz rc_hz is offline
Registered User
 
Name: Eric RC
Organization: www.genband.com
Project: No project yet
 
Join Date: Jul 2004
Location: Hangzhou, China
Posts: 189
Send a message via MSN to rc_hz
-->
Another:

Page 733, Line 22 ~ 24:
Code:
  You can reactivate an inactive adapter by calling activate on it, but only once waitForDeactivate has returned.

Page 734, Line 6 ~ 7:
Code:
  Once an adapter is in the inactive state, it can be reactivated again, but only once waitForDeactivate has returned. Calling hold, waitForHold, or deactivate on an adapter that is in the inactive state has no effect.
Maybe, it is not a typo. I am confused!
__________________
Eric RC
www.genband.com (telecommunication)
I like ICE (Ice for C++/Java/Python)

Last edited by rc_hz : 08-23-2006 at 11:32 AM.
Reply With Quote
  #6 (permalink)  
Old 08-23-2006
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
Object adapters cannot be reactivated. You can recreate an object adapter with the same name (after waitForDeactivate() returns), but you cannot reactivate an existing object adapter. Sorry for the confusion, and we will fix the manual.
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
How to tell (in C++) when an adapter is deactivated mefoster Help Center 8 10-06-2006 10:24 AM
Replicated Object Adapter vsonnathi Help Center 3 04-13-2005 04:30 PM
Adding an Object to Adapter Jennie Help Center 3 11-02-2004 05:15 PM
Proxy reconnection to reactivated adapter brian Help Center 4 01-21-2004 06:49 PM
how to get an object adapter from the communicator paulling Help Center 1 11-26-2003 01:29 AM


All times are GMT -4. The time now is 05:23 AM.


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.