Archived

This forum has been archived. Please start a new discussion on GitHub.

IceBox.ServiceManagerI.run() Visibility Question

Hello there,

Howdy. I've a quick question regarding the visibility of run() method in the class: IceBox.ServiceManagerI.

I need to extend it outside of the IceBox package and run() method is package level. What is the intent and is there a possibility to make it protected?

I'm trying to provide hooks to start and shutdown services/communicator thru an admin console and would like to extend IceBox.Application.

Any help is greatly appreciated.

Thanks,
Venkatesh

Comments

  • benoit
    benoit Rennes, France
    I don't see any reasons why it couldn't be protected -- we can certainly change it to be protected instead.

    However, I wonder why you're not using the standard way of shutting down the IceBox server, i.e.: by invoking the shutdown() method on the service manager interface. Invoking shutdown() on the service manager interface will in turn call stop() on each of your services. Is there any particular reasons why you don't use this method and have to extend the service manager interface instead?

    Benoit.
  • Thanks Benoit for your quick reply.

    How else can I get a handle to IceBox.ServiceManagerI instance w/o extending application?

    I'm providing an interface with JMX to start and stop services as you ahve described.

    Thanks,
    Venkatesh
  • benoit
    benoit Rennes, France
    If you just need to stop all the services and shutdown the IceBox server, you can just invoke the shutdown() method on the service manager object, for that, you just need to get its proxy (take a look at the source code of the IceBox admin tool to see how the proxy is obtained, src/IceBox/Admin.java for example).

    But if you intent to provide more functionality such as start and stop of services individually (without shutting down the IceBox server), you will indeed need to extend the service manager implementation to provide this additional functionality.

    Benoit.
  • Thanks again for your quick reply.

    I need to be able to administer individual services. When can I expect this change?

    Venkatesh
  • benoit
    benoit Rennes, France
    We will fix this for the next patch release, 2.1.1. Of course, in the meantime, you can simply change it by hand in the source code ;).

    Benoit.
  • Thanks for the advice. :cool: Will do so.

    Again, thanks a million.

    Venkatesh
  • benoit
    benoit Rennes, France
    Actually, after looking a bit closer at the code, the IceBox.ServiceManagerI class is also marked as final so this needs to be removed as well if you want to extend it.

    Note that depending on how much functionality you want to add, you might be better off providing your own implementation of the IceBox::ServiceManager interface. It might be much easier than trying to extend our existing implementation (which wasn't really thought to be extended as you found out ;)).

    Benoit.
  • Hi Benoit,

    Thanks for your reply. Its a very interesting observation. I like your suggestion but lemme scibble some code to convey what I'm trying to do.
    public class ServicesBootstrapAgent extends Ice.Application 
                    implements Runnable , ServicesBootstrapAgentMBean {
    
        private ServiceManagerI serviceManager;
    
    .....
    
        public int run(String[] args) {
            serviceManager = new ServiceManagerI(this, args);
            return serviceManagerImpl.run();
        }
    
    ....
    
    }
    

    I'm basically doing what Server class is doing but with a handle/reference to serviceManager. This gives me a fine-grain control since I have access to start, stop, shutdown, etc, public methods on the instance which can be exposed.

    I hope I've conveyed the intent.

    Thanks,
    Venkatesh