/*
 * Copyright (C) 2005 Joerg Schaible
 * Created on 25-Jul-2005 by Joerg Schaible
 * See license.txt for license details
 */
package proxytoys.examples.overview;

import com.thoughtworks.proxy.factory.CglibProxyFactory;
import com.thoughtworks.proxy.factory.StandardProxyFactory;
import static com.thoughtworks.proxy.toys.failover.Failover.failoverable;
import static com.thoughtworks.proxy.toys.future.Future.future;
import static com.thoughtworks.proxy.toys.future.Future.typedFuture;

import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.text.DateFormat;
import java.text.Format;
import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author J&ouml;rg Schaible
 */
public class FutureToyExample {

    public static void packageOverviewExample1() throws InterruptedException {
        List slowList = new SlowArrayList();

        List fasterList = typedFuture(List.class).with(slowList)
                          .build(new CglibProxyFactory());
        System.out.println("Items in list: " + fasterList.size());
        Thread.sleep(100);
        System.out.println("Items in list: " + fasterList.size());
    }


    public static void main(String[] args) throws InterruptedException {
        System.out.println();
        System.out.println();
        System.out.println("Running Future Toy Example");
        System.out.println();
        System.out.println("Example 1 of Package Overview:");
        packageOverviewExample1();
    }

    private static class SlowArrayList extends ArrayList {
        @Override
        public boolean add(final Object o) {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                    }
                    SlowArrayList.super.add(o);
                }
            });

            return true;
        }
    }
}
@@ -20,24 +20,26 @@
  200
-5 Joerg Schaible
+9 Thoughtworks Ltd
 %0A * 
@@ -53,37 +53,35 @@
  on 
-25-Jul
+13-Oct
 -200
-5
+9
  by 
-Joerg Schaible
+Paul Hammant
 %0A * 
@@ -169,638 +169,178 @@
 ort 
-com.thoughtworks.proxy.factory.CglibProxyFactory;%0Aimport com.thoughtworks.proxy.factory.StandardProxyFactory;%0Aimport static com.thoughtworks.proxy.toys.failover.Failover.failoverable;%0Aimport static com.thoughtworks.proxy.toys.future.Future.future;%0Aimport static com.thoughtworks.proxy.toys.future.Future.typedFuture;%0A%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.DataInput;%0Aimport java.io.DataInputStream;%0Aimport java.io.IOException;%0Aimport java.text.DateFormat;%0Aimport java.text.Format;%0Aimport java.text.MessageFormat;%0Aimport java.text.NumberFormat;%0Aimport java.util.ArrayList;%0Aimport java.util.Date;%0Aimport java.util.List
+static com.thoughtworks.proxy.toys.future.Future.typedFuture;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport com.thoughtworks.proxy.factory.CglibProxyFactory
 ;%0A%0A%0A

Fix copyright.