Package de.linwave.gtm.spring.client

Source Code of de.linwave.gtm.spring.client.HelloMain

package de.linwave.gtm.spring.client;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import de.linwave.gtm.spring.server.GTM;
import de.linwave.gtm.spring.server.Info;
import de.linwave.gtm.spring.server.ObjectContainer;

public class HelloMain
{
  private static ObjectContainer db = GTM.getInstance();

  /**
   *
   * @throws Exception
   */
  public void testHello() throws Exception
  {
    long OID=0;
   
    System.out.println( db.echo( "FROM hello" ));
    long t1 = System.currentTimeMillis();
    for (int i=0; i<1000; i++) {
      OID = db.store( new Info("Hello from client"));
      if (i % 100 == 0)
        System.out.println("Stored with oid=" + OID);
    }
    long t2 = System.currentTimeMillis();
   
    for (long oid = OID; oid > OID - 10; oid--) {
      try {
        Info info = db.getByID(Info.class, oid);
        System.out.println(oid + " " + info);
      } catch (Exception ex) {
        System.err.println(ex.getMessage());
      }
    }
   
    System.out.println("Adding 1000 Info's took " + (t2 - t1) + " ms.");
  }

  /**
   *
   * @param args
   */
  public static void main(String[] args)
  {
    HelloMain main = new HelloMain();
    try {
      main.testHello();
    } catch (Exception ex) {
      System.err.println(ex.getMessage());
    }
  }
}
TOP

Related Classes of de.linwave.gtm.spring.client.HelloMain

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.