/* * Copyright (C) 2015 higherfrequencytrading.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ package net.openhft.chronicle.set; import net.openhft.chronicle.hash.ChronicleHashStatelessClientBuilder; import net.openhft.chronicle.map.ChronicleMapBuilder; import net.openhft.chronicle.map.ChronicleMapStatelessClientBuilder; import java.io.IOException; import java.net.InetSocketAddress; import java.util.concurrent.TimeUnit; public final class ChronicleSetStatelessClientBuilder implements ChronicleHashStatelessClientBuilder< ChronicleSetStatelessClientBuilder, ChronicleSet> { public static ChronicleSetStatelessClientBuilder of(InetSocketAddress serverAddress) { return new ChronicleSetStatelessClientBuilder<>(serverAddress); } private final ChronicleMapStatelessClientBuilder mapClientBuilder; ChronicleSetStatelessClientBuilder(InetSocketAddress serverAddress) { Class eClass = null; this.mapClientBuilder = ChronicleMapBuilder.of(eClass, DummyValue.class, serverAddress); } @Override public ChronicleSetStatelessClientBuilder timeout(long timeout, TimeUnit units) { mapClientBuilder.timeout(timeout, units); return this; } @Override public ChronicleSetStatelessClientBuilder name(String name) { mapClientBuilder.name(name); return this; } @Override public ChronicleSetStatelessClientBuilder tcpBufferSize(int tcpBufferSize) { mapClientBuilder.tcpBufferSize(tcpBufferSize); return this; } @Override public ChronicleSet create() throws IOException { return new SetFromMap<>(mapClientBuilder.create()); } }