Java Code Examples for org.apache.tinkerpop.gremlin.driver.Cluster#Builder

The following examples show how to use org.apache.tinkerpop.gremlin.driver.Cluster#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConcurrencyConfig.java    From amazon-neptune-tools with Apache License 2.0 6 votes vote down vote up
Cluster.Builder applyTo(Cluster.Builder clusterBuilder){
    if (concurrency == 1){
        return clusterBuilder;
    }

    int minPoolSize = max(concurrency, 2);
    int maxPoolSize =  max(concurrency, 8);
    int minSimultaneousUsage = 1;
    int maxSimultaneousUsage = 1;
    int minInProcess = 1;
    int maxInProcess = 1;

    return clusterBuilder.
            minConnectionPoolSize(minPoolSize).
            maxConnectionPoolSize(maxPoolSize).
            minSimultaneousUsagePerConnection(minSimultaneousUsage).
            maxSimultaneousUsagePerConnection(maxSimultaneousUsage).
            minInProcessPerConnection(minInProcess).
            maxInProcessPerConnection(maxInProcess);
}
 
Example 2
Source File: AbstractTinkerpopClientService.java    From nifi with Apache License 2.0 6 votes vote down vote up
protected Cluster buildCluster(ConfigurationContext context) {
    String contactProp = context.getProperty(CONTACT_POINTS).evaluateAttributeExpressions().getValue();
    int port = context.getProperty(PORT).evaluateAttributeExpressions().asInteger();
    String path = context.getProperty(PATH).evaluateAttributeExpressions().getValue();
    String[] contactPoints = contactProp.split(",[\\s]*");
    Cluster.Builder builder = Cluster.build();
    for (String contactPoint : contactPoints) {
        builder.addContactPoint(contactPoint.trim());
    }

    builder.port(port).path(path);

    builder = setupSSL(context, builder);

    transitUrl = String.format("gremlin%s://%s:%s%s", usesSSL ? "+ssl" : "",
            contactProp, port, path);

    return builder.create();
}
 
Example 3
Source File: AbstractTinkerpopClientService.java    From nifi with Apache License 2.0 5 votes vote down vote up
protected Cluster.Builder setupSSL(ConfigurationContext context, Cluster.Builder builder) {
    if (context.getProperty(SSL_CONTEXT_SERVICE).isSet()) {
        SSLContextService service = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
        builder
                .enableSsl(true)
                .keyStore(service.getKeyStoreFile())
                .keyStorePassword(service.getKeyStorePassword())
                .keyStoreType(service.getKeyStoreType())
                .trustStore(service.getTrustStoreFile())
                .trustStorePassword(service.getTrustStorePassword());
        usesSSL = true;
    }

    return builder;
}
 
Example 4
Source File: AbstractRemoteGraphProvider.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
public static Cluster.Builder createClusterBuilder(final Serializers serializer) {
    // match the content length in the server yaml
    return TestClientFactory.build().maxContentLength(1000000).serializer(serializer);
}
 
Example 5
Source File: TestClientFactory.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
public static Cluster.Builder build() {
    return Cluster.build("localhost").port(45940);
}