{
void holdRequests();
void activeRequests();
+ StringVec listVars();
+ ByteVec fetchSerializedContent(in string varName) raises (SALOME::SALOME_Exception);
};
interface DataScopeServerBase
_orb->shutdown(0);
}
-RequestSwitcher::RequestSwitcher(CORBA::ORB_ptr orb)
+RequestSwitcher::RequestSwitcher(CORBA::ORB_ptr orb, DataScopeServerBase *ds):_ds(ds)
{
CORBA::Object_var obj(orb->resolve_initial_references("RootPOA"));
PortableServer::POA_var poa(PortableServer::POA::_narrow(obj));
_poa_manager_under_control->activate();
}
+SALOME::StringVec *RequestSwitcher::listVars()
+{
+ return _ds->listVars();
+}
+
+SALOME::ByteVec *RequestSwitcher::fetchSerializedContent(const char *varName)
+{
+ return _ds->fetchSerializedContent(varName);
+}
+
DataScopeServerBase::DataScopeServerBase(CORBA::ORB_ptr orb, SALOME::DataScopeKiller_var killer, const std::string& scopeName):_globals(0),_locals(0),_pickler(0),_orb(CORBA::ORB::_duplicate(orb)),_name(scopeName),_killer(killer)
{
}
{
if(_rs.isNull())
{
- _rs=new RequestSwitcher(_orb);
+ _rs=new RequestSwitcher(_orb,this);
}
CORBA::Object_var obj(_rs->activate());
return SALOME::RequestSwitcher::_narrow(obj);
private:
CORBA::ORB_var _orb;
};
-
+
+ class DataScopeServerBase;
+
+ /*!
+ * Servant activated by a specific POA (single thread) having itself its specific POA_manager.
+ * This class is able to hold/active the default POA_manager shared by other POA than this.
+ */
class SALOMESDS_EXPORT RequestSwitcher : public POA_SALOME::RequestSwitcher, public POAHolder
{
public:
- RequestSwitcher(CORBA::ORB_ptr orb);
+ RequestSwitcher(CORBA::ORB_ptr orb, DataScopeServerBase *ds);
void holdRequests();
void activeRequests();
+ SALOME::StringVec *listVars();
+ SALOME::ByteVec *fetchSerializedContent(const char *varName);
PortableServer::POA_var getPOA() const { return _poa_for_request_control; }
private:
PortableServer::POA_var _poa_for_request_control;
PortableServer::POAManager_var _poa_manager_under_control;
+ //! handle on its creator to give access to services when _poa_manager_under_control is in hold mode.
+ DataScopeServerBase *_ds;
};
class KeyWaiter;
l.acquire() ; l2.acquire()
cv=mp.Condition(mp.Lock())
dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName)
- #assert(isCreated)
+ self.assertTrue(isCreated)
p=mp.Process(target=func_test7,args=(scopeName,l,l2,cv))
p.start()
l.acquire()
rs.holdRequests() # the aim of the test is here. main process is occupied 1s -> holdRequests is Expected to wait
s=(datetime.now()-s).total_seconds()
rs.activeRequests()
- assert(s>=0.99*nbOfSecWait and s<nbOfSecWait*1.01) # expect to be not locked
+ self.assertTrue(s>=0.99*nbOfSecWait and s<nbOfSecWait*1.01) # expect to be not locked
# finishing
p.join()
pass
pass
-unittest.main()
+if __name__=="__main__":
+ unittest.main()