예제 #1
0
void
ServerCache::preUpdate(const ServerInfo& newInfo, bool noRestart)
{
    Lock sync(*this);

    const string& id = newInfo.descriptor->id;
    ServerEntryPtr entry = getImpl(id);
    assert(entry);

    if(!noRestart)
    {
        ServerInfo info = entry->getInfo();
        forEachCommunicator(RemoveCommunicator(*this, entry))(info.descriptor, newInfo.descriptor);
        _nodeCache.get(info.node)->removeServer(entry);
    }

    if(_traceLevels && _traceLevels->server > 0)
    {
        Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
        out << "updating server `" << id << "'";
        if(noRestart)
        {
            out << " with no restart";
        }
    }
}
예제 #2
0
ServerEntryPtr
ServerCache::postUpdate(const ServerInfo& info, bool noRestart)
{
    Lock sync(*this);

    ServerEntryPtr entry = getImpl(info.descriptor->id);
    assert(entry);

    ServerInfo oldInfo = entry->getInfo();
    entry->update(info, noRestart);

    if(!noRestart)
    {
        _nodeCache.get(info.node, true)->addServer(entry);
        forEachCommunicator(AddCommunicator(*this, entry, info.application))(oldInfo.descriptor, info.descriptor);
    }

    if(_traceLevels && _traceLevels->server > 0)
    {
        Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
        out << "updated server `" << info.descriptor->id << "' (`" << info.uuid << "', `" << info.revision << "')";
    }

    return entry;
}
예제 #3
0
ServerEntryPtr
ServerCache::remove(const string& id, bool noRestart)
{
    Lock sync(*this);

    ServerEntryPtr entry = getImpl(id);
    assert(entry);

    ServerInfo info = entry->getInfo();
    forEachCommunicator(RemoveCommunicator(*this, entry))(info.descriptor);

    _nodeCache.get(info.node)->removeServer(entry);

    entry->destroy(noRestart); // This must be done after otherwise some allocatable objects
                               // might allocate a destroyed server.

    if(_traceLevels && _traceLevels->server > 0)
    {
        Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
        out << "removed server `" << id << "'";
    }

    return entry;
}