Exemplo n.º 1
0
 void alloc()
 {
     m_operation->perform(m_kind, m_allocation, m_size, m_offset, m_alignment);
 }
Exemplo n.º 2
0
 void free()
 {
     m_freeOperation->perform(m_kind, m_allocation);
 }
Exemplo n.º 3
0
void
IceGridManager::performOp( Operation &op, int timeoutMs )
{
    // serialize access to admin proxy
//     IceUtil::Mutex::Lock lock(adminMutex_);

    // minimize critical section in order to be able to perform multiple operations
    // simultaneously
    IceGrid::AdminPrx iceGridAdmin;
    gbxutilacfr::Tracer* tracer;
    {
        IceUtil::Mutex::Lock lock(adminMutex_);

        if ( !iceGridAdmin_ ) {
            string warn = "Operation "+op.toString()+" could not be performed because the proxy to IceGrid/Admin is NULL. "
                        + "Session state: "+IceGridSession::toString( getState() );
            throw SessionNotConnectedException( ERROR_INFO, warn );
        }

        // NOTE: cannot currently change timeout because changing timeout invalidates the secure session!
        // use the specified timeout
//         if ( timeoutMs>0 )
//             iceGridAdmin = IceGrid::AdminPrx::uncheckedCast( iceGridAdmin_->ice_timeout( timeoutMs ) );
//         else
            iceGridAdmin = iceGridAdmin_;

        tracer = &context_.tracer();
    }
    // end of critical section

    stringstream exceptionSS;
    gbxiceutilacfr::Timer timer;
    try {
        stringstream debugSS;
        debugSS<<"IceGridManager: performing "<<op.toString()<<" with timeout="<<timeoutMs<<"ms";
        tracer->debug( debugSS.str(),7 );
//         context_.tracer().debug( debugSS.str(),5 );

        // notice the use of the local copy of the Admin proxy
        op.perform( iceGridAdmin );
//         op.perform( iceGridAdmin_ );

        stringstream ss;
        ss << "IceGridManager: "<<op.toString()<<" done.  Took "<<timer.elapsedSec()<<"s";
        tracer->debug( ss.str(),10 );
//         context_.tracer().debug( ss.str(),10 );
        return;
    }
    catch ( const Ice::ObjectNotExistException &e ) {
        exceptionSS << "IceGridManager: "<<op.toString()<<"(): caught exception after "
                <<timer.elapsedSec()<<"s : "<<e;
    }
    catch ( const Ice::TimeoutException &e ) {
        exceptionSS << "IceGridManager: "<<op.toString()<<"(): caught exception after "
                <<timer.elapsedSec()<<"s : "<<e;
    }

    tracer->error( exceptionSS.str() );
//     context_.tracer().error( exceptionSS.str() );
    // destroy old admin proxy, it's no longer valid
//     {
//         IceUtil::Mutex::Lock lock(adminMutex_);
//         iceGridAdmin_ = 0;
//     }
//     tryCreateSession();

    throw gbxutilacfr::Exception( ERROR_INFO, exceptionSS.str() );    
}