Search in sources :

Example 1 with ServiceDaemon

use of com.cosylab.acs.maci.ServiceDaemon in project ACS by ACS-Community.

the class ManagerImpl method initializeServiceDaemons.

/**
	 * Provides its own address to daemons.
	 * <p>
	 * @TODO: The manager should call this method regularly (e.g. once per minute),
	 *        so that also restarted service daemons get the manager address.
	 *        Or the daemons should resolve the naming service themselves and get it from there,
	 *        with possible problems when using different subnets.
	 */
private void initializeServiceDaemons() {
    // get CDB access daos
    DAOProxy dao = getManagerDAOProxy();
    // no data
    if (dao == null)
        return;
    String[] daemons;
    try {
        // query service daemon array
        daemons = dao.get_string_seq("ServiceDaemons");
    } catch (Throwable th) {
        // parameter is optional
        logger.log(Level.WARNING, "No list of services daemons available in the CDB. " + "In an operational environment using ACS daemons, this is a severe error!! " + "It is OK only if you run the system without using these daemons. ");
        return;
    }
    for (int i = 0; i < daemons.length; i++) {
        try {
            ServiceDaemon daemon = transport.getServiceDaemon(daemons[i]);
            if (daemon != null)
                daemon.setManagerReference(transport.getManagerReference());
            else
                throw new RuntimeException("Failed to resolve service daemon reference '" + daemons[i] + "'.");
        } catch (Throwable th) {
            // do not make scary logs...
            logger.config("Failed to set manager reference on service daemon on host '" + daemons[i] + "'.");
        //logger.log(Level.CONFIG,"Failed to set manager reference on service daemon on host '"+daemons[i]+"'.", th);
        }
    }
}
Also used : ServiceDaemon(com.cosylab.acs.maci.ServiceDaemon) DAOProxy(com.cosylab.cdb.client.DAOProxy)

Aggregations

ServiceDaemon (com.cosylab.acs.maci.ServiceDaemon)1 DAOProxy (com.cosylab.cdb.client.DAOProxy)1