Github user steveblackmon commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/348#discussion_r95085434
  
    --- Diff: 
streams-contrib/streams-persist-neo4j/src/main/java/org/apache/streams/neo4j/http/Neo4jHttpClient.java
 ---
    @@ -0,0 +1,84 @@
    +package org.apache.streams.neo4j.http;
    +
    +import org.apache.streams.neo4j.Neo4jConfiguration;
    +
    +import com.google.common.base.Preconditions;
    +
    +import org.apache.http.client.HttpClient;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.util.Map;
    +import java.util.concurrent.ConcurrentHashMap;
    +
    +public class Neo4jHttpClient {
    +
    +    private static final Logger LOGGER = LoggerFactory
    +            .getLogger(Neo4jHttpClient.class);
    +
    +    public Neo4jConfiguration config;
    +
    +    private HttpClient client;
    +
    +    private Neo4jHttpClient(Neo4jConfiguration neo4jConfiguration) {
    +        this.config = neo4jConfiguration;
    +        try {
    +            this.start();
    +        } catch (Exception e) {
    +            e.printStackTrace();
    +            this.client = null;
    +        }
    +    }
    +
    +    private static Map<Neo4jConfiguration, Neo4jHttpClient> INSTANCE_MAP = 
new ConcurrentHashMap<Neo4jConfiguration, Neo4jHttpClient>();
    +
    +    public static Neo4jHttpClient getInstance(Neo4jConfiguration 
neo4jConfiguration) {
    +        if (    INSTANCE_MAP != null &&
    +                INSTANCE_MAP.size() > 0 &&
    +                INSTANCE_MAP.containsKey(neo4jConfiguration)
    +                )
    +            return INSTANCE_MAP.get(neo4jConfiguration);
    +        else {
    +            Neo4jHttpClient instance = new 
Neo4jHttpClient(neo4jConfiguration);
    +            if( instance != null && instance.client != null ) {
    +                INSTANCE_MAP.put(neo4jConfiguration, instance);
    +                return instance;
    +            } else {
    +                return null;
    +            }
    +        }
    +    }
    +
    +    public void start() throws Exception {
    +
    +        Preconditions.checkNotNull(config);
    +        Preconditions.checkArgument(
    +                config.getScheme().startsWith("http")
    +        );
    +
    +        LOGGER.info("Neo4jConfiguration.start {}", config);
    +
    +        Preconditions.checkNotNull(client);
    --- End diff --
    
    ✔️ 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to