Results 1 to 6 of 6

Thread: Can deactivated object adapter really be reactivated ?

  1. #1
    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

    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)

  2. #2
    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
    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)

  3. #3
    dwayne's Avatar
    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
    397
    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
    Dwayne Boone

  4. #4
    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
    Thank you, I see.
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

  5. #5
    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

    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!
    Last edited by rc_hz; 08-23-2006 at 10:32 AM.
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

  6. #6
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find object in object adapter by its proxy
    By dnnbg in forum Help Center
    Replies: 2
    Last Post: 02-25-2009, 04:09 AM
  2. How to tell (in C++) when an adapter is deactivated
    By mefoster in forum Help Center
    Replies: 8
    Last Post: 10-06-2006, 09:24 AM
  3. Replicated Object Adapter
    By vsonnathi in forum Help Center
    Replies: 3
    Last Post: 04-13-2005, 03:30 PM
  4. Proxy reconnection to reactivated adapter
    By brian in forum Help Center
    Replies: 4
    Last Post: 01-21-2004, 05:49 PM
  5. How does the object adapter work?
    By catalin in forum Help Center
    Replies: 0
    Last Post: 10-29-2003, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •