All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.distributeme.test.roundrobinwithfotonext.client.PrintForever Maven / Gradle / Ivy

package org.distributeme.test.roundrobinwithfotonext.client;

import net.anotheria.moskito.webui.embedded.StartMoSKitoInspectBackendForRemote;
import org.distributeme.core.ServiceLocator;
import org.distributeme.test.roundrobinwithfotonext.RoundRobinService;


/**
 * This will just print something out forever.
 */
public class PrintForever extends Client{
	public static void main(String a[]) throws Exception{

		StartMoSKitoInspectBackendForRemote.startMoSKitoInspectBackend();

		RoundRobinService service = ServiceLocator.getRemote(RoundRobinService.class);

		long start = System.currentTimeMillis();
		int errors = 0 ; int replies = 0;
		long counter = 0;
		while(true){
			try{
				service.print("Hello Nr. "+(counter++));
				replies++;
			}catch(Exception e){
				errors++;
			}
			if (replies/1000*1000==replies) {
				long end = System.currentTimeMillis();
				System.out.println("errors: " + errors + ", replies: " + replies + ", time: " + (end - start) + " ms");
				start = System.currentTimeMillis();

			}
		}
		
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy