You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/10/01 20:40:44 UTC

[GitHub] [maven] Tibor17 commented on a change in pull request #286: [MNG-6656] Introduce base for build/consumer process

Tibor17 commented on a change in pull request #286: [MNG-6656] Introduce base for build/consumer process
URL: https://github.com/apache/maven/pull/286#discussion_r330264585
 
 

 ##########
 File path: maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelCacheManager.java
 ##########
 @@ -0,0 +1,74 @@
+package org.apache.maven.model.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.xml.filter.DependencyKey;
+
+/**
+ * 
+ * @author Robert Scholte
+ * @since 3.7.0
+ */
+@Named
+@Singleton
+public class DefaultModelCacheManager implements ModelCacheManager
+{
+    private static final Map<Path, Model> MODELCACHE = Collections.synchronizedMap( new HashMap<Path, Model>() );
+    
+    private static final Map<DependencyKey, Model> DEPKEYMODELCACHE =
 
 Review comment:
   do not use `HashMap` and  `synchronizedMap`. We are in modern Java since of 2004/J5. Use `ConcurrentHashMap` and there use J8 methods. But as I said before target 1.8 does not make sense without adapting the code to J8 (before this PR). It can be done by a plugin...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services