org.logicblaze.lingo
Class DefaultResultJoinStrategy

java.lang.Object
  extended by org.logicblaze.lingo.DefaultResultJoinStrategy
All Implemented Interfaces:
ResultJoinStrategy

public class DefaultResultJoinStrategy
extends java.lang.Object
implements ResultJoinStrategy

A default implementation of ResultJoinStrategy which will add together collection results, unblock the calling thread when there is a single result and let the handler timeout with whatever the default handler timeout policy is.

Version:
$Revision$

Constructor Summary
DefaultResultJoinStrategy()
           
 
Method Summary
 int getMaximumResults()
           
 int getMinimumResults()
           
 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.
 void setMaximumResults(int maximumResults)
           
 void setMinimumResults(int minimiumResults)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResultJoinStrategy

public DefaultResultJoinStrategy()
Method Detail

unblockCallerThread

public boolean unblockCallerThread(org.springframework.remoting.support.RemoteInvocationResult response,
                                   int responseCount)
Description copied from interface: ResultJoinStrategy
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.

Specified by:
unblockCallerThread in interface ResultJoinStrategy

removeHandler

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

Specified by:
removeHandler in interface ResultJoinStrategy

mergeResponses

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

Specified by:
mergeResponses in interface ResultJoinStrategy

unblockAfterTimeout

public boolean unblockAfterTimeout(org.springframework.remoting.support.RemoteInvocationResult currentResult,
                                   long waitSoFarMillis)
Description copied from interface: ResultJoinStrategy
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.

Specified by:
unblockAfterTimeout in interface ResultJoinStrategy

getMaximumResults

public int getMaximumResults()

setMaximumResults

public void setMaximumResults(int maximumResults)

getMinimumResults

public int getMinimumResults()

setMinimumResults

public void setMinimumResults(int minimiumResults)


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