Esempio n. 1
0
BACIMonitor::~BACIMonitor() {
	
  destroyed_m = true;

  ACS_TRACE("baci::BACIMonitor::~BACIMonitor");
  ACS_DEBUG_PARAM("baci::BACIMonitor::~BACIMonitor", "Destroying monitor '%s'", name_m.c_str());

  // remove monitor (if not yet)
  property_mp->removeMonitor(this);

  // Call done() and remove CB
  if (archivingMonitor_m==false)
    {
      Completion completion = ACSErrTypeOK::ACSErrOKCompletion();

      CBDescOut descOut;
      if (property_mp->getComponent()->finishCallback(callbackID_m, 
					      property_mp->getLastValue(), 
					      descOut, completion)==false)
	  {
	  property_mp->getComponent()->removeCallback(callbackID_m);
	  }
    }

  ACS_DEBUG_PARAM("baci::BACIMonitor::~BACIMonitor", "Monitor '%s' destroyed.", name_m.c_str());

}
baci::ActionRequest 
SimpleBACIComponent::invokeAction(int function,
				  baci::BACIComponent *cob_p, 
				  const int &callbackID, 
				  const CBDescIn &descIn, 
				  baci::BACIValue *value_p, 
				  Completion &completion, 
				  CBDescOut &descOut) 
{
    switch(function) 
	{
	case ACTION:
	{
	    ACS_DEBUG_PARAM("::SimpleBACIComponent::Action", "%s", getComponent()->getName());
    
	    completion.timeStamp = getTimeStamp();
	    completion.type=ACSErr::ACSErrTypeOK;
	    completion.code = ACSErrTypeOK::ACSErrOK;

	    return baci::reqInvokeDone;
	}
	default:
	    return baci::reqDestroy;
	}
}
/* ----------------------------------------------------------------*/
SlowDestructionComponent::~SlowDestructionComponent()
{
    // ACS_TRACE is used for debugging purposes
    ACS_TRACE("::SlowDestructionComponent::~SlowDestructionComponent");
    ACS_DEBUG_PARAM("::SlowDestructionComponent::~SlowDestructionComponent", "Destroying %s... Sleeping 7 seconds", name());
   sleep(7);
}
Esempio n. 4
0
BACIComponent::BACIComponent( ACS::ThreadManager *thrMgr,
			      const ACE_CString& _name,
			      const ACE_CString& _type,
			      CharacteristicModelImpl *characteristicModel,
			      size_t actionThreadStackSize,
			      size_t monitorThreadStackSize,
			      const ACS::TimeInterval& _actionThreadResponseTime,
			      const ACS::TimeInterval& _actionThreadSleepTime,
			      const ACS::TimeInterval& _monitorThreadResponseTime,
			      const ACS::TimeInterval& _monitorThreadSleepTime) :
    name_m(_name),
    type_m(_type),
    characteristicModel_mp(characteristicModel),
    actionThread_mp(BACIThread::NullBACIThread),
    monitorThread_mp(BACIThread::NullBACIThread),
    threadManager_mp(thrMgr),
    inDestructionState_m(false),
    actionThreadStackSize_m(actionThreadStackSize),
    monitoringThreadStackSize_m(monitorThreadStackSize)
{

  ACS_TRACE("baci::BACIComponent::BACIComponent");
  ACS_DEBUG_PARAM("baci::BACIComponent::BACIComponent", "Creating Component '%s'", name_m.c_str());

  // set action thread sleep time
  setRTResponseTime(_actionThreadResponseTime);
  setRTSleepTime(_actionThreadSleepTime);

  // set monitor thread sleep time
  setMTResponseTime(_monitorThreadResponseTime);
  setMTSleepTime(_monitorThreadSleepTime);
}//BACIComponent
Esempio n. 5
0
void logBatchUsingMacrosGeneralLogger()
{
	std::cout << "Log batch for logger [" << "GeneralLogger" << "]. USING ACS MACROS." << std::endl;

	// Test macros
	{
		AUTO_TRACE("TEST_MACROS");
		ACS_LOG(LM_RUNTIME_CONTEXT, __PRETTY_FUNCTION__, (LM_INFO, "LM_RUNTIME_CONTEXT inside TEST_MACROS"));
		ACS_LOG(LM_SOURCE_INFO, __PRETTY_FUNCTION__, (LM_INFO, "LM_SOURCE_INFO inside TEST_MACROS"));
	}

	ACS_LOG(LM_RUNTIME_CONTEXT, __PRETTY_FUNCTION__, (LM_INFO, "LM_RUNTIME_CONTEXT outside TEST_MACROS"));
	ACS_LOG( LM_SOURCE_INFO, __PRETTY_FUNCTION__, (LM_INFO, "LM_SOURCE_INFO outside TEST_MACROS"));

	ACS_TRACE(__PRETTY_FUNCTION__);

    ACS_SHORT_LOG((LM_INFO, "Test ACS_SHORT_LOG with LM_INFO"));

    //ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_SHUTDOWN, "Test of LM_SHUTDOWN log")); // NOT logging a thing
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_TRACE, "Test of LM_TRACE log"));
    //ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_DELOUSE, "Test of LM_DELOUSE log")); // Not logginf a thing
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_DEBUG, "Test of LM_DEBUG log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_INFO, "Test of LM_INFO log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_NOTICE, "Test of LM_NOTICE log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_WARNING, "Test of LM_WARNING log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_ERROR, "Test of LM_ERROR log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_CRITICAL, "Test of LM_CRITICAL log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_ALERT, "Test of LM_ALERT log"));
    ACS_LOG( LM_FULL_INFO, __PRETTY_FUNCTION__, (LM_EMERGENCY, "Test of LM_EMERGENCY log"));

    // Debug messages
    ACS_DEBUG(__PRETTY_FUNCTION__, "Test of ACS_DEBUG macro");
    ACS_DEBUG_PARAM(__PRETTY_FUNCTION__, "Test of ACS_DEBUG_PARAM macro with param: %s", "param1");
} // 17 + 2 messages (entering + exiting)
void
ErrorComponent::sleepingCmd(CORBA::Short nb_seconds)
{
	ACS_DEBUG_PARAM("ErrorComponent::sleepingCmd","Sleeping for %d second(s)",nb_seconds);
	sleep(nb_seconds);
	ACS_DEBUG("ErrorComponent::sleepingCmd","Exiting...");
	return;
}
Esempio n. 7
0
void BACIMonitor::resume()
{
  ACS_TRACE("baci::BACIMonitor::resume");
  ACS_DEBUG_PARAM("baci::BACIMonitor::resume", "'%s' resumed", name_m.c_str());
  if (suspended_m==true) {
    suspended_m=false;
    monitorStateChanged();
    property_mp->updateMonitorStates();
  }
}
Esempio n. 8
0
/* ----------------------------------------------------------------*/
CounterSupplierImpl::~CounterSupplierImpl()
{
    // ACS_TRACE is used for debugging purposes
    ACS_TRACE("::CounterSupplier::~CounterSupplier");

    if (m_CounterSupplier_p != NULL) {
    	m_CounterSupplier_p->disconnect();
    	m_CounterSupplier_p = NULL;
    }

    ACS_DEBUG_PARAM("::CounterSupplier::~CounterSupplier", "Destroying %s...", name());
}
// Implementation skeleton destructor
enumpropTestDeviceImpl::~enumpropTestDeviceImpl (void)
{
  ACS_TRACE("enumpropTestDeviceImpl::~enumpropTestDeviceImpl");
  if (getComponent())
      ACS_DEBUG_PARAM("::BaciTestClassImpl::~BaciTestClassImpl", "Destroying %s...", getComponent()->getName());

  // stop threads
  if (getComponent())
      getComponent()->stopAllThreads();

  // properties
  if (m_currentState) { m_currentState->destroy(); m_currentState=0; }
  if (m_currentStateRW) { m_currentStateRW->destroy(); m_currentStateRW=0; }

  ACS_DEBUG("::eumpropTestDeviceImpl::~enumpropTestDeviceImpl", "Properties destroyed");
  
  ACS_DEBUG("::enumpropTestDeviceImpl::~enumpropTestDeviceImpl", "Component destroyed");
}//~
Esempio n. 10
0
BACIComponent::~BACIComponent()
{
  ACS_TRACE("baci::BACIComponent::~BACIComponent");

  // set destruction flag
  inDestructionState_m = true;

  if (threadManager_mp!=0)
      {
      threadManager_mp->terminateAll();
      }

  // the threads are no more alive, so I can ...

  // remove all left actions (in case it was canceled)
  BACIAction *action_p;
  ThreadSyncGuard guard(&actionQueueMutex_m);
  while (getActionCount() > 0)
    {
      action_p = popAction();
      if (action_p)
	  {
	  delete action_p;
	  }
    }
  guard.release();

  // remove all left callbacks
  BACICallback* callback_p;
  ThreadSyncGuard guard1(&callbackTableMutex_m);
  int h = callbackTable_m.first();
  while (h != 0)
    {
      int nh = callbackTable_m.next(h);
      callback_p = callbackTable_m[h];
      callbackTable_m.deallocate(h);
      delete callback_p;
      h = nh;
    }
  guard1.release();

  ACS_DEBUG_PARAM("baci::BACIComponent::~BACIComponent", "Component '%s' destroyed.", name_m.c_str());
}//~BACIComponent
Esempio n. 11
0
int acslogErrorServer (char *szCmdLn){
  int  argc;
  char *argv[100];

  argc = argUnpack(szCmdLn, argv);
  argv[0] = " acslogErrorServer";
#else
  int acslogErrorServer (int argc, char *argv[]){
#endif // defined( MAKE_VXWORKS )

  CORBA::ORB_var orb;
  

  if (argc<2){
    ACE_OS::printf ("usage: acslogErrorServer <server_name> [destination_server_name] \n");
    return -1;
  }
  
  try
    {
      // Initialize the ORB
      ACS_DEBUG(" acslogErrorServer", "Initialising ORB ... ");
      orb = CORBA::ORB_init (argc, argv, 0);
      ACS_DEBUG ("acslogErrorServer", "ORB initialsed !");
    }
  catch( CORBA::Exception &ex )
    {
      ACE_PRINT_EXCEPTION (ex, "Failed to initalise ORB");
      return -1;
    }

  // create logging proxy
  ACS_DEBUG (" acslogErrorServer", "Creating logging proxy ... ");
  LoggingProxy *m_logger = new LoggingProxy(0, 0, 31, 0);
  LoggingProxy::init (m_logger);  
  ACS_DEBUG (" acslogErrorServer", "Logging proxy successfully created !");

  try
    {

      //Naming Service 
      ACS_DEBUG (" acslogErrorServer", "Resolving  Naming service ... ");
      ACE_CString nameService;
      nameService +="corbaloc::";
      nameService += ACSPorts::getIP();
      nameService += ":"; 
      nameService += ACSPorts::getNamingServicePort().c_str();
      nameService += "/"; 
      nameService += acscommon::NAMING_SERVICE_NAME;

      CORBA::Object_var naming_obj = orb->string_to_object(nameService.c_str());
      if (!CORBA::is_nil (naming_obj.in ()))
	{
	  CosNaming::NamingContext_var naming_context =
	    CosNaming::NamingContext::_narrow (naming_obj.in ());
	  ACS_DEBUG ("acslogErrorServer", "Naming Service resolved !");

	  CosNaming::Name name;
	  name.length(1);
	  name[0].id = CORBA::string_dup("Log");
	  CORBA::Object_var log_obj = naming_context->resolve(name);

	  if (!CORBA::is_nil (log_obj.in()))
	    {
	      Logging::AcsLogService_var logger = Logging::AcsLogService::_narrow(log_obj.in());
	      ACS_DEBUG ("acslogErrorServer", "Logging Service resolved !");

	      m_logger->setCentralizedLogger(logger.in());
	    }
	  else
	    {
	      ACS_DEBUG ("acslogErrorServer", "Failed to initialise the Logging Service!");
	    }

	}
      else
	{
	  ACS_DEBUG ("acslogErrorServer", "Failed to initialise the NameService!");
	}//if-else
    }
  catch( CORBA::Exception &ex )
    {
      ACE_PRINT_EXCEPTION(ex, "Failed to get and set the centralized logger");
    }

  try
    {
      //Get a reference to the RootPOA
      CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
      
      PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in());
      
   
      PortableServer::POAManager_var poa_manager = root_poa->the_POAManager();
      
      /* 
      CORBA::PolicyList policy_list;
      policy_list.length(5);
      policy_list[0] = root_poa->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT);
     policy_list[1] =  root_poa->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID);
      policy_list[2] = root_poa->create_id_assignment_policy(PortableServer::USER_ID); 
      policy_list[3] = root_poa->create_servant_retention_policy(PortableServer::NON_RETAIN); 
      policy_list[4] =  root_poa->create_lifespan_policy (PortableServer::PERSISTENT);
      printf("policies are created !\n");

      PortableServer::POA_var poa = root_poa->create_POA("cdbSrv", poa_manager.in(), policy_list);
      printf("Poa created !\n");

      for (CORBA::ULong i = 0; i < policy_list.length (); ++i) {
	CORBA::Policy_ptr policy = policy_list[i];
	policy->destroy ();
      }
      printf("Policies are destructed !\n");
      */


#ifdef MAKE_VXWORKS      
      ACSError::processName (szCmdLn);
#else 
      char *buf;
      ACE_OS::argv_to_string (argv, buf);
      ACSError::processName (buf);
      delete[] buf;
#endif      
      ACS_DEBUG ("acslogErrorServer", "Creating test object ...");
      ESTest_var dest;
      
      if (argc>2){
	ACS_DEBUG ("acslogErrorServer", "Getting object reference ... ");
	char refName[64];
	sprintf(refName, "file://%s.ior", argv[2]);
	CORBA::Object_var destObj = orb->string_to_object (refName);
	

	ACS_DEBUG ("acslogErrorServer", "Narrowing it .... ");
	dest = ESTest::_narrow (destObj.in());
      }//if

      ESTestImpl  esTest (dest.in(), argv[1]);
      ESTest_var testObj = esTest._this ();
      
           
      poa_manager->activate ();
      
      ACS_DEBUG ("acslogErrorServer","POA Manager -> activate");
      
      ACS_DEBUG_PARAM ("acslogErrorServer", "Writing ior to the file: %s .... ", argv[1]);
      char* ior =  orb->object_to_string (testObj.in());
      
      
      char fileName[64];
      sprintf(fileName, "%s.ior", argv[1]);
      FILE *output_file = ACE_OS::fopen (fileName, "w");
      if (output_file == 0) {
	ACS_SHORT_LOG ((LM_ERROR,
			   "Cannot open output files for writing IOR: ior.ior"));
	return  -1;
      }

      int result = ACE_OS::fprintf (output_file, "%s", ior);
      if (result < 0) {
	ACS_SHORT_LOG ((LM_ERROR,
			   "ACE_OS::fprintf failed while writing %s to ior.ior\n", ior));
	return  -1;
      }

      ACE_OS::fclose (output_file);
      
      ACS_DEBUG ("acslogErrorServer", "Waiting for requests ...");
      orb->run ();
      
      ACS_DEBUG ("acslogErrorServer", "ORB -> run");
    }
  catch( CORBA::Exception &ex )
    {
      ACE_PRINT_EXCEPTION (ex, "EXCEPTION CAUGHT");
      return -1;
    }
  
  return 0;
}//startErrorServer
Esempio n. 12
0
/* ----------------------------------------------------------------*/
execComponentTestImpl::~execComponentTestImpl()
{
    ACS_TRACE("::execComponentTestImpl::~execComponentTestImpl");
    ACS_DEBUG_PARAM("::execComponentTestImpl::~execComponentTestImpl", "Destroying %s...", name());
}
Esempio n. 13
0
int acserrTestServer (char *szCmdLn){
    ACE_OS_Object_Manager ace_os_object_manager;
    ACE_Object_Manager ace_object_manager;
  int  argc;
  char *argv[100];

  argc = argUnpack(szCmdLn, argv);
  argv[0] = "errorServer";
#else
  int acserrTestServer (int argc, char *argv[]){
#endif // defined( MAKE_VXWORKS )

  

  if (argc<2){
    ACE_OS::printf ("usage: errorServer <server_name> [destination_server_name] \n");
    return -1;
  }

  ACE_OS::signal(SIGINT,  TerminationSignalHandler);  // Ctrl+C
  ACE_OS::signal(SIGTERM, TerminationSignalHandler);  // termination request

  // create logging proxy
  LoggingProxy m_logger (0, 0, 31, 0);
  LoggingProxy::init (&m_logger); 

  // creating ORB
  ACS_TEST_INIT_CORBA;

  // init ACS error system (and inside also logging)
//  ACSError::init (orb.ptr());

  try
  {
      //Get a reference to the RootPOA
      CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
      
      PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in());
      
   
      PortableServer::POAManager_var poa_manager = root_poa->the_POAManager();
      

#ifdef MAKE_VXWORKS      
      ErrorTraceHelper::setProcessName (szCmdLn);
#else 
      char *buf;
      ACE_OS::argv_to_string (argv, buf);
      ACSError::setProcessName (buf); // = ErrorTraceHelper::setProcessName (buf);
      delete[] buf;
#endif      
      ACS_DEBUG ("errorServer", "Creating test object ...");
      acserrTest_var dest;
      
      if (argc>2){
	ACS_DEBUG ("errorServer", "Getting object reference ... ");
	char refName[64];
	sprintf(refName, "file://%s.ior", argv[2]);
	CORBA::Object_var destObj = orb->string_to_object (refName);
	

	ACS_DEBUG ("errorServer", "Narrowing it .... ");
	dest = acserrTest::_narrow (destObj.in());
      }//if

      acserrTestImpl  esTest (dest.in(), argv[1]);
      acserrTest_var testObj = esTest._this ();
      
           
      poa_manager->activate ();
      
      ACS_DEBUG ("errorServer","POA Manager -> activate");
      
      ACS_DEBUG_PARAM ("errorServer", "Writing ior to the file: %s .... ", argv[1]);
      char* ior =  orb->object_to_string (testObj.in());
      
      
      char fileName[64];
      sprintf(fileName, "%s.ior", argv[1]);
      FILE *output_file = ACE_OS::fopen (fileName, "w");
      if (output_file == 0) {
	ACS_SHORT_LOG((LM_ERROR,
			   "Cannot open output files for writing IOR: ior.ior"));
	return -1;
      }

      int result = ACE_OS::fprintf (output_file, "%s", ior);
      if (result < 0) {
	ACS_SHORT_LOG ((LM_ERROR,
			   "ACE_OS::fprintf failed while writing %s to ior.ior", ior));
	return  -1;
      }

      ACE_OS::fclose (output_file);
      
      ACS_DEBUG ("errorServer", "Waiting for requests ...");
      orb->run ();
      
  }
  catch( CORBA::Exception &ex )
  {
  ex._tao_print_exception("EXCEPTION CAUGHT");
    return -1;
  }

//  orb->shutdown(true); //wait until all requests have completed

  LoggingProxy::done();
  std::cout << std::flush;
  sleep(3);
  return 0;
}//startErrorServer


#ifndef MAKE_VXWORKS
int main(int argc, char *argv[])
{
  return acserrTestServer (argc, argv); 
}
/* ----------------------------------------------------------------*/
ErrorComponent::~ErrorComponent()
{
    // ACS_TRACE is used for debugging purposes
    ACS_TRACE("::ErrorComponent::~ErrorComponent");
    ACS_DEBUG_PARAM("::ErrorComponent::~ErrorComponent", "Destroying %s...", name());
}
Esempio n. 15
0
void actionThreadWorker(void* param) {

  if (param==0) return;

  BACIThreadParameter* baciParameter_p = static_cast<BACIThreadParameter*>(param);
  BACIThread* myself_p = baciParameter_p->getBACIThread();
  BACIComponent* component_p = (BACIComponent*)baciParameter_p->getParameter();

  if (BACIThread::InitThread)
      {
      BACIThread::InitThread(myself_p->getName().c_str());
      }

  ACS_TRACE("baci::actionThreadWorker");

  BACIAction* action_p = 0;

  bool pushActionBack;
  int callbackID;
  BACICallback* callback_p = 0;
  CBDescOut descOut;
  ActionRequest request = reqNone;

  ACS_DEBUG_PARAM("baci::actionThreadWorker", "%s", component_p->getName());

  while (myself_p->check()==true &&
	 component_p->isInDestructionState()==false)
    {
      if (myself_p->isSuspended()==false &&
	  component_p->isInDestructionState()==false &&
	  (component_p->getActionCount()>0))
	{
	  if ( (action_p = component_p->popAction()) != 0 )
	    {
	      Completion completion;

	      callbackID = action_p->getCallbackID();
	      callback_p = component_p->getCallback(callbackID);

	      if (callback_p==0)
		{
		  //ACS_LOG(LM_RUNTIME_CONTEXT, "baci::actionThreadWorker",
		  //		(LM_CRITICAL, "Callback not found: %s", component_p->getName()));
		  delete action_p;
		  continue;
		}

              if (action_p->isCompleted()==true)
		{
		  completion = action_p->getCompletion();
		  request = reqInvokeDone;
		}
              else
		{
		CompletionImpl co;
		request = action_p->invoke(callback_p->getComponent(),
					   callbackID,
					   callback_p->getDescIn(),
					   action_p->getValueRef(),
					   co,
					   descOut);
		if (co.isErrorFree())
		    {
		    completion = co;
		    }
		else
		    {
		    completion = CouldntPerformActionCompletion(co,
							  __FILE__,
							  __LINE__,
							  "baci::actionThreadWorker");					    }//if-else
		}//if-else

	      pushActionBack = false;

	      switch (request)
		{
		case reqNone: break;
		case reqInvokeWorking:
		  component_p->dispatchCallback(callbackID, action_p->getValue(), descOut, completion);
                  pushActionBack = true;
		  break;
		case reqInvokeDone:
		  pushActionBack = !component_p->finishCallback(callbackID, action_p->getValue(),
							descOut, completion);
		  if (pushActionBack==false)
		    {
		      //component_p->removeCallback(callbackID); /// already removed
		      delete action_p;
		    }
                  else if (callback_p->isOK()==true)
		      {
		      action_p->setCompletion(completion);
		      }
                  else
		    {
		      pushActionBack = false;      // drop message
		      //component_p->removeCallback(callbackID);
		      delete action_p;
		    }
		  break;
		case reqDestroy:
		  component_p->removeCallback(callbackID);
		  delete action_p;
		default:
		  // error msg
		  ACS_LOG(LM_RUNTIME_CONTEXT, "baci::actionThreadWorker",
			  (LM_ERROR, "Wrong request for action in Component %s! Return value must type of 'enum ActionRequest { reqNone, reqInvokeWorking, reqInvokeDone, reqDestroy }'",
			   component_p->getName()));
		  break;
		}

	      if (pushActionBack==true)
		  {
		  component_p->pushAction(action_p);
		  }
	    }
	}
      if (myself_p->exitRequested()==false)
	  {
	  myself_p->sleep();
	  }
    }

  delete baciParameter_p;
  myself_p->setStopped();

  if (BACIThread::DoneThread)
      {
      BACIThread::DoneThread();
      }
}
Esempio n. 16
0
/* ----------------------------------------------------------------*/
TestLogLevelsComp::~TestLogLevelsComp()
{
    // ACS_TRACE is used for debugging purposes
    ACS_TRACE("::TestLogLevelsComp::~TestLogLevelsComp");
    ACS_DEBUG_PARAM("::TestLogLevelsComp::~TestLogLevelsComp", "Destroying %s...", name());
}
Esempio n. 17
0
void monitorThreadWorker(void* param) {

  if (param==0)
      {
      return;
      }

  BACIThreadParameter* baciParameter_p = static_cast<BACIThreadParameter*>(param);
  BACIThread* myself_p = baciParameter_p->getBACIThread();
  BACIComponent* component_p = (BACIComponent*)baciParameter_p->getParameter();

  if (BACIThread::InitThread)
      {
      BACIThread::InitThread(myself_p->getName().c_str());
      }

  ACS_TRACE("baci::monitorThreadWorker");

  ACS::TimeInterval pollInterval, time, lastPollTime;
  BACIValue value;
  bool timeTriggered;
  BACIProperty* property_p=0;
  CBDescOut descOut;

  ACS_DEBUG_PARAM("baci::monitorThreadWorker", "%s", component_p->getName());

  // already in getPropertAt ?!!!
  //ThreadSyncGuard guard(component_p->&property_mpVectorMutex);

  while (myself_p->check()==true &&
	 component_p->isInDestructionState()==false)
    {
      if (myself_p->isSuspended()==false)
	{
	  // sync. monitors
	  time = getTimeStamp();

	  //guard.acquire();
	  for (int n=0;
	       component_p->isInDestructionState()==false && n < component_p->getPropertyCount() && myself_p->exitRequested()==false;
	       n++)
	    {
	      property_p = component_p->getPropertyAt(n);
	      if (property_p==0 || property_p->isInDestructionState()==true)
		  {
		  continue;
		  }
	      if ((property_p->getMonitorCount() > 0) &&
		  ((property_p->getPollInterval() > 0) || property_p->hasTriggerOnValueMonitor()==true ||
		  property_p->hasTriggerOnValuePercentMonitor()==true))
		  {
		  pollInterval = property_p->getPollInterval();
		  //if we're dealing with a property containing trigger by value monitors AND
		  //the minimum monitor time is NOT default AND
		  //it's less than the main polling interval...

		  if ((property_p->hasTriggerOnValueMonitor()==true ||
				property_p->hasTriggerOnValuePercentMonitor()==true) &&
		      (property_p->getMonMinTriggerTime()!=0) &&
		      (property_p->getMonMinTriggerTime()<pollInterval))
		      {
		      pollInterval = property_p->getMonMinTriggerTime();
		      }


		  lastPollTime = property_p->getLastPollTime();
		  //time = getTimeStamp();

		  // time fix
		  ACS::TimeInterval etime = time;
		  if (pollInterval!=0)
		    {
		      etime -= calculateModulus(time-lastPollTime, pollInterval);
		      timeTriggered = (etime-lastPollTime)>=pollInterval;
		    }
		  else
		      {
		      timeTriggered = false;
		      }

		  //timeTriggered = (time-lastPollTime)>=pollInterval;
		  //if (timeTriggered==true)//property_p->hasTriggerOnValueMonitor() || timeTriggered)
		  if (property_p->hasTriggerOnValueMonitor() || property_p->hasTriggerOnValuePercentMonitor() || timeTriggered == true)
		    {
		    CompletionImpl co;

			  value.reset();
		      property_p->getValue(property_p,
					   (BACIValue*)&value,
					   co,
					   descOut);

		      property_p->setLastValue(value); // !!!
		      //property_p->setLastCompletion(completion); // !!!
		      if (timeTriggered==true)
			  {
			  property_p->setLastPollTime(etime); // !!! do not set in case of error
			  }
		      //property_p->setLastPollTime(time); // !!! do not set in case of error
		      if( co.isErrorFree() )
			  {
			  property_p->dispatchMonitors(co, descOut);
			  }
		      else
			  {
			  CanNotGetValueCompletion errComp(co,
							  __FILE__,
							  __LINE__,
							  "baci::monitorThreadWorker");
			  property_p->dispatchMonitors(errComp, descOut);
			  }//if-else
		    }
		}
	    }
	  //guard.release();

	}
      if (myself_p->exitRequested()==false)
	  {
	  myself_p->sleep();
	  }
    }

  delete baciParameter_p;
  myself_p->setStopped();

  if (BACIThread::DoneThread)
      {
      BACIThread::DoneThread();
      }
}