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

david.lloyd@jboss.com do-not-reply at jboss.com
Tue Sep 16 11:22:50 EDT 2008

"barbacena" wrote : 
  | That is nice. I would suggest a javadoc on send,invoke and sendOneWay saying this.
It's on my todo list. :)

"barbacena" wrote : That means ordered execution need to be handled by the client. It is fine for me however I would like to serialize execution per (session) client. What is the API to get the current (session) client?

No, it means that the server will receive messages in order relative to the client, which means that if you send requests A B and C, the server will receive them in order A B and C.  Except that it's not working yet. :)

"barbacena" wrote : 
  | About this, I suggest a API change if it is possible. I would something like this:
  | context.sendReply(context.execute(new Callable<Integer>() {
  |   | 					@Override
  |   | 					public int call() {
  |   | 						System.out.println("Executing... " + request);
  |   | 						return value++;
  |   | 					}
  |   | 				}));
  |   | 

First, you don't have to use context.execute() if you don't want to.  You'd really only use this if for some reason your request would block for a very long time otherwise, for example, or if you have multiple background processes that must execute or you otherwise need concurrency on the server for some reason.  It's perfectly acceptable to send the reply from the main RequestListener.

Second, the sendReply() method always sends a reply immediately.  If you want to defer your reply until you do some asynchronous computation, you should invoke that method from the executed task (that is, in the background thread) *after* the computation is complete.

Finally, I would argue that the two approaches are really no different:

  | // this is hypothetical, not an actual method
  | context.executeAndSendReplyFromCallable(new Callable<Integer>() {
  |     public Integer call() {
  |         System.out.println("Executing... " + request);
  |         return value++;
  |     }
  | }));

  | context.execute(new Runnable() {
  |     public void run() {
  |         System.out.println("Executing... " + request);
  |         context.sendReply(value++);
  |     }
  | });

Though the latter actually requires error checking around the sendReply, which I think you'd be missing on the former.

anonymous wrote : anonymous wrote : Now the fact that "Remote: 4" comes before "Remote: 3" is just a plain old bug. :-) As soon as I get marshaling fixed up I'll come back to it - I think we just haven't integrated any ordering code yet. 
  | As you said if execution order is not guaranteed then this behavior isn't wrong unless only one thread executes the handleRequest.

Execution order is guaranteed within the actual RequestListener, but not within subtasks of the listener (if any; they are optional) that are started via context.execute().

anonymous wrote : Is the xnio trunk working for it or just the jar that you download in the ant build?

The XNIO trunk should be stable.  I plan to release from it soon, maybe this week if I have time.

anonymous wrote : I saw a wiki entry (or was it the docs of 2.5.0.ga) that when the system is under load it rejects some messages, is that what is the exception is for?

This exception is produced by the JDK Executor implementation.  Basically it means two things - I need to configure an Executor that has a longer queue and a better rejection policy, and I need to make sure that the Executor is not being removed before I'm done with it.  Either way, this won't be the behavior that you will see in the final product.

anonymous wrote : One more thing :)
  | Is TCP transport ready? If it is, can you post a sample using it :P I tried looking the M2 sample but the API changed and I could not find how to do it.

No, it's not ready yet... hopefully later this week or early next week there will be something to try.  But we'll see how much I can get done.

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

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

More information about the jboss-user mailing list