Archived

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

problem when call another service at start function.

Maybe it's not a bug, but it's little discommodiousness.



I'll work with multiple service on a single IceBox server.

I want to call another service in start function(that is

IceBox::Service member), it must initialize it-self in

start function. But Ice can not specify the Services

startup order, so be desirous to call another service in

start function maybe fail, because that service maybe

not loaded by IceBox. It's a little bit discommodiousness.

maybe i can do it by another way, Can you help me?

thanks a lot.


sample code:

void
MyService1I::start(
const ::std::string& name,
const ::Ice::CommunicatorPtr& communicator,
const ::Ice::StringSeq& args)
{
m_adapter = communicator->createObjectAdapter(name);

// !!!! this call maybe fail. !!!
::jf::accounts::Connection conn = getSystemConn();

m_fs = new FilesysI( conn );
m_adapter->add( m_fs, Ice::stringToIdentity( gProxyName ) );


m_adapter->activate();
}

::jf::accounts::ConnectionPrx MyServiceI::getSystemConn(void) const
{
if ( m_system_conn ) {
return m_system_conn;
}

Ice::PropertiesPtr properties = getFilesys()->getProperties();
const std::string proxyProperty = jf::accounts::gProxyName + ".Proxy";
std::string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
throw jf::GenericError e;
}
Ice::ObjectPrx base = getFilesys()->getCommunicator()->stringToProxy(proxy);
::jf::accounts::AccountsPrx twoway = ::jf::accounts::AccountsPrx::checkedCast(base->ice_twoway()->ice_timeout(-1)->ice_secure(false));
m_system_conn = twoway->findConnection( jf::accounts::getSystemConnID() );
return m_system_conn;
}

Comments

  • mes
    mes California
    The next Ice release will provide the ability to specify the load order of the IceBox services. Until then, you can control the load order by using service names that produce the desired order.

    - Mark
  • thans. btw: Can you publish a roadmap?

    We can arrange rate of progress to be rationalization.

    like: http://www.go-mono.com/mono-roadmap.html