public static void example1(String... args)  {

        /* Synchronous service. */
        final TodoManager todoManagerImpl = new TodoManager();

        /*
        Create the service which manages async calls to todoManagerImpl.
         */
        final ServiceQueue serviceQueue = serviceBuilder()
                .setServiceObject(todoManagerImpl)
                .build().startServiceQueue();


        /* Create Asynchronous proxy over Synchronous service. */
        final TodoManagerClientInterface todoManager = serviceQueue.createProxy(TodoManagerClientInterface.class);

        serviceQueue.startCallBackHandler();


        System.out.println("This is an async call");
        /* Asynchronous method call. */
        todoManager.add(new Todo("Call Mom", "Give Mom a call"));


        AtomicInteger countTracker = new AtomicInteger(); //Hold count from async call to service

        System.out.println("This is an async call to count");

        todoManager.count(count -> {
            System.out.println("This lambda expression is the callbackWithTimeout " + count);

            countTracker.set(count);
        });


        todoManager.clientProxyFlush(); //Flush all methods. It batches calls.

        Sys.sleep(100);

        System.out.printf("This is the count back from the server %d\n", countTracker.get());


        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());
        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());
        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());
        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());

    }
public static void example1(String... args)  {

        
        final TodoManager todoManagerImpl = new TodoManager();

        
        final ServiceQueue serviceQueue = serviceBuilder()
                .setServiceObject(todoManagerImpl)
                .build().startServiceQueue();


        
        final TodoManagerClientInterface todoManager = serviceQueue.createProxy(TodoManagerClientInterface.class);

        serviceQueue.startCallBackHandler();


        System.out.println("This is an async call");
        
        todoManager.add(new Todo("Call Mom", "Give Mom a call"));


        AtomicInteger countTracker = new AtomicInteger(); 

        System.out.println("This is an async call to count");

        todoManager.count(count -> {
            System.out.println("This lambda expression is the callbackWithTimeout " + count);

            countTracker.set(count);
        });


        todoManager.clientProxyFlush(); 

        Sys.sleep(100);

        System.out.printf("This is the count back from the server %d\n", countTracker.get());


        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());
        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());
        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());
        System.out.printf("END EXAMPLE 1 %s \n", countTracker.get());

    }
public static void example1 ( String ... args ) { /* Synchronous service. */ final TodoManager todoManagerImpl = new TodoManager ( ) ; /*
        Create the service which manages async calls to todoManagerImpl.
         */ final ServiceQueue serviceQueue = serviceBuilder ( ) . setServiceObject ( todoManagerImpl ) . build ( ) . startServiceQueue ( ) ; /* Create Asynchronous proxy over Synchronous service. */ final TodoManagerClientInterface todoManager = serviceQueue . createProxy ( TodoManagerClientInterface . class ) ; serviceQueue . startCallBackHandler ( ) ; System . out . println ( "This is an async call" ) ; /* Asynchronous method call. */ todoManager . add ( new Todo ( "Call Mom" , "Give Mom a call" ) ) ; AtomicInteger countTracker = new AtomicInteger ( ) ; //Hold count from async call to service System . out . println ( "This is an async call to count" ) ; todoManager . count ( count -> { System . out . println ( "This lambda expression is the callbackWithTimeout " + count ) ; countTracker . set ( count ) ; } ) ; todoManager . clientProxyFlush ( ) ; //Flush all methods. It batches calls. Sys . sleep ( 100 ) ; System . out . printf ( "This is the count back from the server %d\n" , countTracker . get ( ) ) ; System . out . printf ( "END EXAMPLE 1 %s \n" , countTracker . get ( ) ) ; System . out . printf ( "END EXAMPLE 1 %s \n" , countTracker . get ( ) ) ; System . out . printf ( "END EXAMPLE 1 %s \n" , countTracker . get ( ) ) ; System . out . printf ( "END EXAMPLE 1 %s \n" , countTracker . get ( ) ) ; }
You can use services in process
You can use services in process