void SthenoCore::startService(const UUIDPtr& sid, ServiceParamsPtr& params, UUIDPtr& iid, UUIDPtr& deployUUIDD) throw (RuntimeException&, ServiceException&) { ACE_Time_Value start = ACE_OS::gettimeofday(); if (!isValid()) { throw RuntimeException(RuntimeException::INVALID_RUNTIME); } list<UUIDPtr> filterList; UUIDPtr runtimeUUID; this->getUUID(runtimeUUID); LaunchServiceSiteQuery* query = new LaunchServiceSiteQuery(runtimeUUID, sid, filterList); DiscoveryPtr discovery; try { m_overlay->getDiscovery(discovery); } catch (OverlayException& ex) { throw RuntimeException(RuntimeException::INVALID_OVERLAY); } //DiscoveryQueryReply* reply = m_overlay->getDiscovery()->executeQuery(query); DiscoveryQueryReply* reply = discovery->executeQuery(query); if (reply == 0) { throw RuntimeException(RuntimeException::INVALID_OVERLAY); } LaunchServiceSiteQueryReply* replyNarrow = new LaunchServiceSiteQueryReply(reply); //printf("PoL UUID=%s\n", replyNarrow->getUUID()->toString().c_str()); deployUUIDD = replyNarrow->getUUID(); //printf("Before service remote deployment\n"); MeshPtr meshPtr; try { getOverlay()->getMesh(meshPtr); } catch (OverlayException& ex) { throw RuntimeException(RuntimeException::INVALID_OVERLAY); } //getOverlay()->getMesh()->createRemoteService(replyNarrow->getMeshSAPInfo().get(), replyNarrow->getUUID(), sid, params, iid); try { meshPtr->createRemoteService(replyNarrow->getMeshSAPInfo().get(), replyNarrow->getUUID(), sid, params, iid); } catch (ServiceException& se) { delete replyNarrow; throw se; } //printf("After service remote deployment\n"); ACE_Time_Value end = ACE_OS::gettimeofday(); end -= start; if (trace()) { MeshPtr meshPtr; this->getOverlay()->getMesh(meshPtr); UUIDPtr fid; meshPtr->getFID(fid); if (params->getFTParams().null()) { TraceRuntimeSingleton::instance()->logRemoteServiceCreation(this->m_peerID, fid, sid, iid, end); } else { TraceRuntimeSingleton::instance()->logRemoteServiceCreationFT(this->m_peerID, fid, sid, iid, end); } } delete replyNarrow; }
void SthenoCore::startService(UUIDPtr& sid, UUIDPtr& peerID, ServiceParamsPtr& params, UUIDPtr& iid) throw (RuntimeException&, ServiceException&) { ACE_Time_Value start = ACE_OS::gettimeofday(); FindPeerQuery* queryPeer = new FindPeerQuery(peerID); DiscoveryPtr discovery; try { m_overlay->getDiscovery(discovery); } catch (OverlayException& ex) { throw RuntimeException(RuntimeException::INVALID_OVERLAY); } DiscoveryQueryReply* replyPeer = discovery->executeQuery(queryPeer); FindPeerQueryReply* replyPeerNarrow = new FindPeerQueryReply(replyPeer); if (replyPeerNarrow->isException()) { printf("Peer is now known!\n"); throw ServiceException(ServiceException::SERVICE_NOT_KNOWN); } printf("Before service remote deployment SAP=%s\n", replyPeerNarrow->getPeerInfo()->getFID()->toString().c_str()); MeshPtr meshPtr; try { getOverlay()->getMesh(meshPtr); } catch (OverlayException& ex) { throw RuntimeException(RuntimeException::INVALID_OVERLAY); } try { meshPtr->createRemoteService(replyPeerNarrow->getPeerInfo()->getMeshSAP().get(), peerID, sid, params, iid); } catch (ServiceException& se) { delete replyPeerNarrow; throw se; } printf("After service remote deployment\n"); ACE_Time_Value end = ACE_OS::gettimeofday(); end -= start; if (trace()) { MeshPtr meshPtr; this->getOverlay()->getMesh(meshPtr); UUIDPtr fid; meshPtr->getFID(fid); if (params->getFTParams().null()) { TraceRuntimeSingleton::instance()->logRemoteServiceCreation(this->m_peerID, fid, sid, iid, end); } else { TraceRuntimeSingleton::instance()->logRemoteServiceCreationFT(this->m_peerID, fid, sid, iid, end); } } delete replyPeerNarrow; }