[jboss-user] [Remoting] - Re: Remoting 3 trunk - Ordered delivery problem

barbacena do-not-reply at jboss.com
Tue Sep 16 18:38:31 EDT 2008


Tried but did not work (deadlocked?!).

public final class ClientToServerToClientExample {
  | 
  | 	public static void main(String[] args) throws Exception {
  | 		Security.addProvider(new Provider());
  | 		RequestListener<Object, String> listenerServer = new AbstractRequestListener<Object, String>() {
  | 
  | 			@Override
  | 			public void handleRequest(final RequestContext<String> context, final Object request) throws RemoteExecutionException {
  | 				System.out.println("In the server: " + request);
  | 				try {
  | 					Client<Object, String> client = (Client) request;
  | 					client.send("Message from server...");
  | 					context.sendReply("Processed client message");
  | 				} catch (Exception e) {
  | 					e.printStackTrace();
  | 				}
  | 			}
  | 		};
  | 		RequestListener<Object, String> listenerClient = new AbstractRequestListener<Object, String>() {
  | 
  | 			@Override
  | 			public void handleRequest(RequestContext<String> context, Object request) throws RemoteExecutionException {
  | 				System.out.println("In the client: " + request);
  | 				try {
  | 					context.sendReply("Processed server message");
  | 				} catch (Exception e) {
  | 					e.printStackTrace();
  | 				}
  | 			}
  | 		};
  | 		Endpoint endpointServer = Remoting.createEndpoint("server");
  | 		Endpoint endpointClient = Remoting.createEndpoint("client");
  | 		Client<Object, String> server = null;
  | 		Client<Object, String> client = null;
  | 		try {
  | 			server = Remoting.createLocalClient(endpointServer, listenerServer);
  | 			client = Remoting.createLocalClient(endpointClient, listenerClient);
  | 			server.invoke(client);
  | 		} finally {
  | 			IoUtils.safeClose(server);
  | 			Remoting.closeEndpoint(endpointServer);
  | 		}
  | 	}
  | 
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176952#4176952

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4176952



More information about the jboss-user mailing list