Package mustachejava

Source Code of mustachejava.DeferredExample

package mustachejava;

import com.github.mustachejava.DeferringMustacheFactory;
import com.github.mustachejava.Mustache;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.concurrent.Executors;

/**
* This show how to use the deferred mustache factory.
* <p/>
* User: sam
* Date: 7/7/12
* Time: 12:32 PM
*/
public class DeferredExample {

  Object deferredpartial = DeferringMustacheFactory.DEFERRED;
  Object deferred = new DeferringMustacheFactory.DeferredCallable();
  boolean wait1second() throws InterruptedException {
    Thread.sleep(1000);
    return true;
  }

  public static void main(String[] args) throws IOException {
    DeferringMustacheFactory mf = new DeferringMustacheFactory();
    mf.setExecutorService(Executors.newCachedThreadPool());
    Mustache m = mf.compile("deferring.mustache");
    PrintWriter pw = new PrintWriter(System.out);
    m.execute(pw, new DeferredExample()).close();
  }
}
TOP

Related Classes of mustachejava.DeferredExample

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.