[ 
https://issues.apache.org/jira/browse/SCB-625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16509235#comment-16509235
 ] 

ASF GitHub Bot commented on SCB-625:
------------------------------------

liubao68 commented on a change in pull request #741: [SCB-625] ProduceProcessor 
use SPI to support extends
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/741#discussion_r194624755
 
 

 ##########
 File path: 
common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/produce/ProduceProcessorManager.java
 ##########
 @@ -17,24 +17,38 @@
 
 package org.apache.servicecomb.common.rest.codec.produce;
 
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
 import javax.ws.rs.core.MediaType;
 
 import org.apache.servicecomb.foundation.common.RegisterManager;
+import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
 
 public final class ProduceProcessorManager extends RegisterManager<String, 
ProduceProcessor> {
+  private static final List<ProduceProcessor> produceProcessor = 
SPIServiceUtils.getAllService(ProduceProcessor.class);
+
   private static final String NAME = "produce processor mgr";
 
   public static final String DEFAULT_TYPE = MediaType.APPLICATION_JSON;
 
   public static final ProduceProcessorManager INSTANCE = new 
ProduceProcessorManager();
 
-  public static final ProduceProcessor JSON_PROCESSOR = new 
ProduceJsonProcessor();
+  public static final ProduceProcessor JSON_PROCESSOR = 
SPIServiceUtils.getTargetService(ProduceProcessor.class, 
ProduceJsonProcessor.class);
 
-  public static final ProduceProcessor PLAIN_PROCESSOR = new 
ProduceTextPlainProcessor();
+  public static final ProduceProcessor PLAIN_PROCESSOR = 
SPIServiceUtils.getTargetService(ProduceProcessor.class, 
ProduceTextPlainProcessor.class);
 
   public static final ProduceProcessor DEFAULT_PROCESSOR = JSON_PROCESSOR;
 
   private ProduceProcessorManager() {
     super(NAME);
+    Map<String, Object> map = new ConcurrentHashMap<>();
 
 Review comment:
   Maybe use a normal Set of keys is enough, do not need a map or concurrent 
map here. 

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


> ProduceProcessor use SPI to support extends
> -------------------------------------------
>
>                 Key: SCB-625
>                 URL: https://issues.apache.org/jira/browse/SCB-625
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: WeiChao
>            Assignee: WeiChao
>            Priority: Major
>
> Currently ProduceProcessor supporting text/plain and JSON, needs to be 
> changed to SPI to support extensions, e.g. www/url-encoded



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to