@@ -0,0 +1,2598 @@
+/**%0A * Copyright (C) 2015 Red Hat, Inc.%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 */%0A  package io.fabric8.kubernetes.examples;%0A%0A  import io.fabric8.kubernetes.client.Callback;%0A  import io.fabric8.kubernetes.client.Config;%0A  import io.fabric8.kubernetes.client.ConfigBuilder;%0A  import io.fabric8.kubernetes.client.KubernetesClientException;%0A  import io.fabric8.kubernetes.client.dsl.ExecWatch;%0A  import io.fabric8.kubernetes.client.utils.InputStreamPumper;%0A  import io.fabric8.openshift.client.DefaultOpenShiftClient;%0A  import io.fabric8.openshift.client.OpenShiftClient;%0A%0A  import java.io.IOException;%0A  import java.util.concurrent.ExecutorService;%0A  import java.util.concurrent.Executors;%0A%0A/**%0A * @Author: Angel Misevski (https://github.com/amisevsk).%0A */%0Apublic class ExecLoopExample %7B%0A%0A  public static void main(String%5B%5D args) throws InterruptedException, IOException %7B%0A    String master = %22https://localhost:8443/%22;%0A    String podName = null;%0A%0A    if (args.length == 2) %7B%0A      master = args%5B0%5D;%0A      podName = args%5B1%5D;%0A    %7D%0A    if (args.length == 1) %7B%0A      podName = args%5B0%5D;%0A    %7D%0A%0A    Config config = new ConfigBuilder().withMasterUrl(master).build();%0A%0A      try (OpenShiftClient client = new DefaultOpenShiftClient(config)) %7B%0A        for (int i = 0; i %3C 10; System.out.println(%22i=%22 + i), i++) %7B%0A          ExecutorService executorService = Executors.newSingleThreadExecutor();%0A          try (ExecWatch watch = client.pods().withName(podName).redirectingOutput().exec(%22date%22);%0A               InputStreamPumper pump = new InputStreamPumper(watch.getOutput(), new SystemOutCallback())) %7B%0A              executorService.submit(pump);%0A              Thread.sleep(2000);%0A          %7D catch (Exception e) %7B%0A            throw KubernetesClientException.launderThrowable(e);%0A          %7D finally %7B%0A            executorService.shutdown();%0A          %7D%0A        %7D%0A      %7D%0A    System.out.println(%22Done.%22);%0A  %7D%0A%0A  private static class SystemOutCallback implements Callback%3Cbyte%5B%5D%3E %7B%0A    @Override%0A    public void call(byte%5B%5D data) %7B%0A      System.out.print(new String(data));%0A    %7D%0A  %7D%0A%7D%0A

Add ExecLoopExample.