1 7 package org.jboss.remoting.samples.oneway; 8 9 import org.jboss.remoting.Client; 10 import org.jboss.remoting.InvokerLocator; 11 12 17 public class OnewayClient 18 { 19 private static String transport = "socket"; 21 private static String host = "localhost"; 22 private static int port = 5400; 23 24 public void makeInvocation(String locatorURI) throws Throwable 25 { 26 InvokerLocator locator = new InvokerLocator(locatorURI); 27 System.out.println("Calling remoting server with locator uri of: " + locatorURI); 28 29 Client remotingClient = new Client(locator); 30 31 41 String payload1 = "Oneway call 1."; 42 System.out.println("Making oneway invocation with payload of '" + payload1 + "'"); 43 remotingClient.invokeOneway(payload1, null); 44 45 51 String payload2 = "Oneway call 2."; 52 System.out.println("Making oneway invocation with payload of '" + payload2 + "'"); 53 remotingClient.invokeOneway(payload2, null, true); 54 } 55 56 62 public static void main(String [] args) 63 { 64 if(args != null && args.length == 2) 65 { 66 transport = args[0]; 67 port = Integer.parseInt(args[1]); 68 } 69 String locatorURI = transport + "://" + host + ":" + port; 70 OnewayClient client = new OnewayClient(); 71 try 72 { 73 client.makeInvocation(locatorURI); 74 } 75 catch(Throwable e) 76 { 77 e.printStackTrace(); 78 } 79 } 80 81 82 } | Popular Tags |