class MLEnvironmentFactory {

	public static synchronized MLEnvironment get(Long mlEnvId) {
		if (!map.containsKey(mlEnvId)) {
			if (mlEnvId.equals(DEFAULT_ML_ENVIRONMENT_ID)) {
				setDefault(new MLEnvironment());
			} else {
				throw new IllegalArgumentException(
					String.format("Cannot find MLEnvironment for MLEnvironmentId %s." +
						" Did you get the MLEnvironmentId by calling getNewMLEnvironmentId?", mlEnvId));
			}
		}

		return map.get(mlEnvId);
	}

}