Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2013 BlackLocus Licensed 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 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.
package com.blacklocus.jres;
This is a thread-safe way to initialize a singleton resource. The class just needs to be referenced by whatever execution entry path.
    static void triggerStaticInit(){}
    static final Node node;
    static {
        File dir = new File(System.getProperty("") + "/ElasticSearchTestInstance");
        if (dir.exists()) {
        Settings settings = ImmutableSettings.settingsBuilder()
                .put("http.port", 9201)
                .put("index.number_of_shards", 1)
                .put("index.number_of_replicas", 0)
         = NodeBuilder.nodeBuilder().local(true).settings(settings).clusterName("junit_test_cluster").node();
New to GrepCode? Check out our FAQ X