Package tcg.syscontrol.cos

Examples of tcg.syscontrol.cos.ICosManagedProcess


        //update the active reference, if necessary
        if (status == CosProcessStatusEnum.StatRunningControl)
        {
          logger_.trace("Changing the active reference...");
           //then get the associated managed process from peer
          ICosManagedProcess processRef = null;
          try
          {
            processRef = peer.reference.cosGetManagedProcess2(entity);
            peer.errorCounter = 0;
          }
View Full Code Here


   */
  public String cosGetProcessStatusString(short index) throws CosIndexOutOfBoundException
  {
    if (index < 0 || index >= managedProcesses_.size())
      throw new CosIndexOutOfBoundException();
    ICosManagedProcess processRef = managedProcesses_.get(index).reference;

    String status = "";
    if (CorbaManager.isValidReference(processRef))
    {
      try
      {
        status = processRef.cosGetStatusString();
      }
      catch(Exception ex)
      {
        logger_.error("Can not get status string for "
                + managedProcesses_.get(index).entity
View Full Code Here

    ManagedProcessStruct process = managedProcesses_.get(entity)
    if (process == null)
    {
      throw new CosUnknownProcessException();
    }
    ICosManagedProcess processRef = process.reference;

    String status = "";
    if (CorbaManager.isValidReference(processRef))
    {
      try
      {
        status = processRef.cosGetStatusString();
      }
      catch(Exception ex)
      {
        logger_.error("Can not get status string for " + entity
                + ". Exception: " + ex.getMessage());
View Full Code Here

    ManagedProcessStruct process = managedProcesses_.get(entity)
    if (process == null)
    {
      return;
    }
    ICosManagedProcess processRef = process.reference;

    //just pass it to the process
    if (CorbaManager.isValidReference(processRef))
    {
      try
      {
        processRef.cosSetLogLevel(loglevel);
      }
      catch(Exception ex)
      {
        logger_.error("Can not send log level for " + entity
            + " to " + CorbaHelper.LogLevelToString(loglevel)
View Full Code Here

    ManagedProcessStruct process = managedProcesses_.get(entity)
    if (process == null)
    {
      return;
    }
    ICosManagedProcess processRef = process.reference;

    //just pass it to the process
    if (CorbaManager.isValidReference(processRef))
    {
      try
      {
        processRef.cosSetLogLevelDetail(logger, loglevel);
      }
      catch(Exception ex)
      {
        logger_.error("Can not send log level for " + logger
            + " @ " + entity + " to " + CorbaHelper.LogLevelToString(loglevel)
View Full Code Here

  }

  private ICosManagedProcess get_active_managed_process(ManagedProcessStruct process)
  {
    //try to use local reference if the local corba server is in CONTROL
    ICosManagedProcess processRef = null;
    if (process.runtime.state == CosProcessStatusEnum.StatRunningControl
        && process.reference != null)
    {
      processRef = process.reference;
      //validate it
      try
      {
        processRef.cosPollControl();
      }
      catch (Exception ex)
      {
        //ignore. just reset the reference
        logger_.trace("Can not poll control local managed process.");
        processRef = null;
      }
    }
   
    //if the local process is not suitable, try to get from peers. always use the first one found
    if (processRef == null)
    {   
      Iterator<PeerManagerStruct> it = activePeers_.values().iterator();
      while(it.hasNext() && processRef == null)
      {
        //precautions
        if (it.next().reference == null)
          continue;
        //get from peer and validate it
        try
        {
          processRef = it.next().reference.cosGetManagedProcess2(process.entity);
          if (processRef != null)
          {
            processRef.cosPollControl();
          }
          it.next().errorCounter = 0;
        }
        catch(CosUnknownProcessException ue)
        {
View Full Code Here

    params[0].value = Integer.toString(portNo_);
   
    ManagedProcessStruct   process = null;
    String          iorString = "";
    org.omg.CORBA.Object  obj = null;
    ICosManagedProcess    processRef = null;
    long          processId = 0;
    CosOperationModeEnum  operMode = null;
   
    //try connecting to existing/zombie processes
    Iterator<ManagedProcessStruct> itProcess = managedProcesses_.values().iterator();
    while (itProcess.hasNext())
    {
      process = itProcess.next();
     
      //get the ior string
      iorString = CorbaManager.readIor(process.entity);
      if (iorString.length() == 0)
      {
        continue;
      }
   
      //build the managed process reference
      obj = CorbaManager.stringToObject(iorString);
      if (obj != null)
      {
        processRef = ICosManagedProcessHelper.narrow(obj);
        if (processRef == null)
        {
          logger_.warn("Invalid IOR to process " + process.entity + ". IOR String: "
                  + iorString);
          continue;
        }
      }  //if (obj != null)
     
      //critical section
      synchronized(managedProcesses_)
      {
        //reconnect to the zombie process
        processId = 0;
        for (int i=0; i<CORBA_ERROR_THRESHOLD; i++)
        {
          try
          {
            //notify process about our new port
            processRef.cosSetParams(params);
            //get the process id
            processId = processRef.cosGetProcessId();
            //get operation mode
            operMode = processRef.cosGetOperationMode();
            //notify managed process of a restart
            //ideally, the managed process should then re-register to the process manager
            //TODO
            break;
          }
View Full Code Here

    CorbaHelper.getInstance();
   
    String ior = "corbaloc::localhost:7777/GenericAgent";

    ICosManagedProcess process = null;
    try
    {
      //Object obj = orb_.string_to_object(ior);
      Object obj = CorbaHelper.stringToObject(ior);
      process = ICosManagedProcessHelper.narrow(obj);
    }
    catch (Exception ex)
    {
      logger_.error("Can not get reference to process manager: " + ior + ". "
          + "Exception: " + ex.toString());
      return;
    }
   
    if (process == null)
    {
      logger_.error("Can not get reference to process manager: " + ior);
      return;
    }
   
    String statusStr = "";
    for (int i=0; i<10; i++)
    {
      try
      {
        statusStr = process.cosGetStatusString();
      }
      catch (Exception ex)
      {
        logger_.warn("Can not get status string. Exception: " + ex.toString());
        continue;
View Full Code Here

TOP

Related Classes of tcg.syscontrol.cos.ICosManagedProcess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.