Example usage for org.apache.commons.collections HashBag HashBag

List of usage examples for org.apache.commons.collections HashBag HashBag

Introduction

In this page you can find the example usage for org.apache.commons.collections HashBag HashBag.

Prototype

public HashBag() 

Source Link

Document

Constructs an empty HashBag.

Usage

From source file:org.apache.metron.indexing.adapters.ESTimedRotatingAdapter.java

@Override
public boolean initializeConnection(String ip, int port, String cluster_name, String index_name,
        String document_name, int bulk_size, String date_format) throws Exception {

    bulk_set = new HashBag();

    _LOG.trace("[Metron] Initializing ESBulkAdapter...");

    try {/*  ww  w .  ja v  a  2  s  . c  o  m*/
        _ip = ip;
        _port = port;
        _cluster_name = cluster_name;
        _index_name = index_name;
        _document_name = document_name;
        _bulk_size = bulk_size;

        dateFormat = new SimpleDateFormat(date_format);

        System.out.println("Bulk indexing is set to: " + _bulk_size);

        ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder();

        if (tuning_settings != null && tuning_settings.size() > 0) {
            builder.put(tuning_settings);
        }

        builder.put("cluster.name", _cluster_name);
        builder.put("client.transport.ping_timeout", "500s");

        settings = builder.build();

        client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(_ip, _port));

        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}