Test::RemoteEvictorI::RemoteEvictorI(const CommunicatorPtr& communicator, const string& envName,
                                     const string& category, bool transactional) :
    _envName(envName),
    _category(category)
{
    _evictorAdapter = communicator->createObjectAdapterWithEndpoints(Ice::generateUUID(), "default");
 
    Initializer* initializer = new Initializer;
    
    if(transactional)
    {
        _evictor = Freeze::createTransactionalEvictor(_evictorAdapter, envName, category, Freeze::FacetTypeMap(), initializer);
    }
    else
    {
        _evictor = Freeze::createBackgroundSaveEvictor(_evictorAdapter, envName, category, initializer);
    }

    //
    // Check that we can get an iterator on a non-existing facet
    //
    Freeze::EvictorIteratorPtr p = _evictor->getIterator("foo", 1);
    test(p->hasNext() == false);


    initializer->init(this, _evictor);

    _evictorAdapter->addServantLocator(_evictor, category);
    _evictorAdapter->activate();
}
void
Test::RemoteEvictorI::destroyAllServants(const string& facetName, const Current&)
{
    //
    // Don't use such a small value in real applications!
    //
    Ice::Int batchSize = 1;

    Freeze::EvictorIteratorPtr p = _evictor->getIterator(facetName, batchSize);
    while(p->hasNext())
    {
        _evictor->remove(p->next());
    }
}
Exemple #3
0
Casino::PlayerPrxSeq
BankI::getPlayers(const Ice::Current& current) const
{
    Casino::PlayerPrxSeq result;

    Freeze::EvictorIteratorPtr p = _playerEvictor->getIterator("", 10);

    while(p->hasNext())
    {
        Ice::Identity ident = p->next();
        result.push_back(Casino::PlayerPrx::uncheckedCast(current.adapter->createProxy(ident)));
    }

    return result;
}
Exemple #4
0
vector<CasinoStore::PersistentBetPrx>
BankI::getBets(const Ice::ObjectAdapterPtr& adapter) const
{
    vector<CasinoStore::PersistentBetPrx> result;

    Freeze::EvictorIteratorPtr p = _betEvictor->getIterator("", 100);

    while(p->hasNext())
    {
        Ice::Identity ident = p->next();
        result.push_back(CasinoStore::PersistentBetPrx::uncheckedCast(adapter->createProxy(ident)));
    }

    return result;
}