org.logicblaze.lingo
Interface ResultJoinStrategy

All Known Implementing Classes:
DefaultResultJoinStrategy

public interface ResultJoinStrategy

A Strategy pattern describing how to join multiple results together, to decide when it is safe to unblock the calling client thread and when a request can be considered to be complete.

Version:
$Revision$

Method Summary
 org.springframework.remoting.support.RemoteInvocationResult mergeResponses(org.springframework.remoting.support.RemoteInvocationResult currentResult, org.springframework.remoting.support.RemoteInvocationResult newResult, int responseCount)
          Merges the new response with the previous response object.
 boolean removeHandler(org.springframework.remoting.support.RemoteInvocationResult response, int responseCount)
          Returns true if there have been sufficient responses to remove the handler from the system.
 boolean unblockAfterTimeout(org.springframework.remoting.support.RemoteInvocationResult currentResult, long waitSoFarMillis)
          After we timeout in the ResultJoinHandler waiting for responses this method is called to see if we should stop processing and return the results we have (or null if none).
 boolean unblockCallerThread(org.springframework.remoting.support.RemoteInvocationResult response, int responseCount)
          Returns true if the calling thread should be unblocked after calling the method and so returning the current value of the invocation result; future responses could still mutate the result object if required.
 

Method Detail

unblockCallerThread

boolean unblockCallerThread(org.springframework.remoting.support.RemoteInvocationResult response,
                            int responseCount)
Returns true if the calling thread should be unblocked after calling the method and so returning the current value of the invocation result; future responses could still mutate the result object if required. The default implementation will return true after a single response is returned.


removeHandler

boolean removeHandler(org.springframework.remoting.support.RemoteInvocationResult response,
                      int responseCount)
Returns true if there have been sufficient responses to remove the handler from the system. Typically handlers should expire after some inactivity timeout.


mergeResponses

org.springframework.remoting.support.RemoteInvocationResult mergeResponses(org.springframework.remoting.support.RemoteInvocationResult currentResult,
                                                                           org.springframework.remoting.support.RemoteInvocationResult newResult,
                                                                           int responseCount)
Merges the new response with the previous response object. The default implementation just merges collections together otherwise the first response wins.


unblockAfterTimeout

boolean unblockAfterTimeout(org.springframework.remoting.support.RemoteInvocationResult currentResult,
                            long waitSoFarMillis)
After we timeout in the ResultJoinHandler waiting for responses this method is called to see if we should stop processing and return the results we have (or null if none). It passes in the current result and the approximate amount of time in milliseconds we have waited so far. Returns true to unblock and return the result otherwise false to continue waiting.



Copyright © 2011 LogicBlaze, Inc.. All Rights Reserved.