public Object getInstance(String deploymentId, String resource) { // First find in cache DeploymentCache<Object> deploymentCache = cacheInstance.get(deploymentId); if (deploymentCache == null) { deploymentCache = new DefaultDeploymentCache<Object>(); cacheInstance.put(deploymentId, deploymentCache); } Object instance = deploymentCache.get(resource); if (instance == null) { @SuppressWarnings("rawtypes") ProjectEngineFactory projectEngineFactory = get(deploymentId, resource); try { instance = projectEngineFactory.newInstance(); } catch (Exception e) { throw new ResourceCompileException( "Resource with name '" + resource + "' in deployment with id '" + deploymentId + "' compilation has been failed"); } deploymentCache.add(resource, instance); } return instance; }
public Object getInstance(String deploymentId, String resource) { // First find in cache DeploymentCache<Object> deploymentCache = cacheInstance.get(deploymentId); if (deploymentCache == null) { deploymentCache = new DefaultDeploymentCache<Object>(); cacheInstance.put(deploymentId, deploymentCache); } Object instance = deploymentCache.get(resource); if (instance == null) { @SuppressWarnings("rawtypes") ProjectEngineFactory projectEngineFactory = get(deploymentId, resource); try { instance = projectEngineFactory.newInstance(); } catch (Exception e) { throw new ResourceCompileException( "Resource with name '" + resource + "' in deployment with id '" + deploymentId + "' compilation has been failed"); } deploymentCache.add(resource, instance); } return instance; }