* Constructs a new local instance manager.
*
*/
public LocalInstanceManager() throws Exception {
final Configuration config = GlobalConfiguration.getConfiguration();
// get the default instance type
InstanceType type = null;
final String descr = config.getString(LOCALINSTANCE_TYPE_KEY, null);
if (descr != null) {
LOG.info("Attempting to parse default instance type from string " + descr);
type = InstanceTypeFactory.constructFromDescription(descr);
if (type == null) {
LOG.warn("Unable to parse default instance type from configuration, using hardware profile instead");
}
}
this.defaultInstanceType = (type != null) ? type : createDefaultInstanceType();
LOG.info("Default instance type is " + this.defaultInstanceType.getIdentifier());
this.networkTopology = NetworkTopology.createEmptyTopology();
this.instanceTypeDescriptionMap = new SerializableHashMap<InstanceType, InstanceTypeDescription>();
numTaskManagers = GlobalConfiguration.getInteger(ConfigConstants
.LOCAL_INSTANCE_MANAGER_NUMBER_TASK_MANAGER, 1);
for(int i=0; i< numTaskManagers; i++){
Configuration tm = new Configuration();
int ipcPort = GlobalConfiguration.getInteger(ConfigConstants.TASK_MANAGER_IPC_PORT_KEY,
ConfigConstants.DEFAULT_TASK_MANAGER_IPC_PORT);
int dataPort = GlobalConfiguration.getInteger(ConfigConstants.TASK_MANAGER_DATA_PORT_KEY,
ConfigConstants.DEFAULT_TASK_MANAGER_DATA_PORT);
tm.setInteger(ConfigConstants.TASK_MANAGER_IPC_PORT_KEY, ipcPort + i);
tm.setInteger(ConfigConstants.TASK_MANAGER_DATA_PORT_KEY, dataPort + i);
GlobalConfiguration.includeConfiguration(tm);
TaskManager t = new TaskManager();
taskManagers.add(t);