@@ -0,0 +1,2003 @@
+/*%0A * Copyright 2015 the original author or authors.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage net.kuujo.copycat.examples.server;%0A%0Aimport net.kuujo.copycat.Copycat;%0Aimport net.kuujo.copycat.cluster.Member;%0Aimport net.kuujo.copycat.cluster.NettyCluster;%0Aimport net.kuujo.copycat.cluster.NettyMember;%0Aimport net.kuujo.copycat.raft.log.Log;%0Aimport net.kuujo.copycat.raft.log.StorageLevel;%0A%0A/**%0A * Server example.%0A *%0A * @author %3Ca href=%22http://github.com/kuujo%22%3EJordan Halterman%3C/a%3E%0A */%0Apublic class ServerExample %7B%0A%0A  /**%0A   * Starts the server.%0A   */%0A  public static void main(String%5B%5D args) throws Exception %7B%0A    if (args.length %3C 2)%0A      throw new IllegalArgumentException(%22must supply a server ID and at least one ID:host:port triple%22);%0A%0A    int serverId = Integer.valueOf(args%5B0%5D);%0A%0A    NettyCluster.Builder builder = NettyCluster.builder()%0A      .withMemberId(serverId)%0A      .withMemberType(Member.Type.ACTIVE);%0A%0A    for (int i = 1; i %3C args.length; i++) %7B%0A      String%5B%5D parts = args%5Bi%5D.split(%22:%22);%0A      builder.addMember(NettyMember.builder()%0A        .withId(Integer.valueOf(parts%5B0%5D))%0A        .withHost(parts%5B1%5D)%0A        .withPort(Integer.valueOf(parts%5B2%5D))%0A        .build());%0A    %7D%0A%0A    Copycat copycat = Copycat.builder()%0A      .withCluster(builder.build())%0A      .withLog(Log.builder()%0A        .withStorageLevel(StorageLevel.MEMORY)%0A        .build())%0A      .build();%0A%0A    copycat.open().join();%0A%0A    while (copycat.isOpen()) %7B%0A      Thread.sleep(1000);%0A    %7D%0A  %7D%0A%0A%7D%0A

Add basic server example.