com.nexaweb.server.pushconnection.flushpolicies
Class IdlePeriodWithSizeThresholdFlushPolicy

java.lang.Object
  extended byTimerBasedFlushPolicy
      extended bycom.nexaweb.server.pushconnection.flushpolicies.IdlePeriodFlushPolicy
          extended bycom.nexaweb.server.pushconnection.flushpolicies.IdlePeriodWithSizeThresholdFlushPolicy

public class IdlePeriodWithSizeThresholdFlushPolicy
extends IdlePeriodFlushPolicy

This policy is based on the Idle Connection Policy and operates the same way, but has a threshold for indicating what size a passing message must be before it is considered activity. Messages below this threshold may freely flow over the push connection and the connection is still considered idle. This policy is used when your application sends larger messages down the push connection that would push content through the proxy server's internal IO buffer, interspersed with smaller messages that would generally not be big enough to push content through the buffer efficiently. It should be configured such that if there are enough large messages to move content through the proxy server's internal IO buffer in a timely fashion, then no action should be taken. However, if there are only small messages moving across the connection, the stream should be considered idle and action should be taken periodically to flush the buffer.

Example Configuration

   <policy>
      <rules>
         <match xpath="starts-with(/client-info/java-version, '1.4')" />
         <match xpath="starts-with(/client-info/java-vendor, 'Sun')" />
         <match xpath="contains(/client-info/user-agent, 'MSIE 6')" />
         <match address="127.0.0.*" />
      </rules>		 
      <configuration class="com.nexaweb.server.pushconnection.flushpolicies.IdlePeriodWithSizeThresholdFlushPolicy">
         <flush-size>8 K</flush-size>
         <period>10 sec.</period>
         <message-size-threshold>200 bytes</message-size-threshold>
      </configuration>
   </policy>

   <policy>
      <rules>
         <match xpath="starts-with(/client-info/java-version, '1.4')" />
         <match xpath="starts-with(/client-info/java-vendor, 'Sun')" />
         <match xpath="contains(/client-info/user-agent, 'MSIE 6')" />
         <match address="127.0.0.*" />
      </rules>		 
      <configuration class="com.nexaweb.server.pushconnection.flushpolicies.IdlePeriodWithSizeThresholdFlushPolicy">
         <is-stream-closed-on-flush>8 K</is-stream-closed-on-flush>
         <period>10 sec.</period>
         <message-size-threshold>200 bytes</message-size-threshold>
      </configuration>
   </policy>
 
 

See Also:
Serialized Form

Constructor Summary
IdlePeriodWithSizeThresholdFlushPolicy()
          This constructor is only for use by Nexaweb internally.
IdlePeriodWithSizeThresholdFlushPolicy(long idlePeriod, int messageSizeThreshold)
          Constructs a IdlePeriodWithSizeThresholdFlushPolicy with the specified idlePeriod and messageSizeThreshold which will return true from the isFlushMechanismStreamClose() method.
IdlePeriodWithSizeThresholdFlushPolicy(long idlePeriod, int flushSize, int messageSizeThreshold)
          Constructs a IdlePeriodWithSizeThresholdFlushPolicy with the specified idlePeriod, flushSize and messageSizeThreshold.
 
Method Summary
 void configure(Element policy)
           
protected  boolean messageMeetsFlushTaskResetCriteria(Flushable flushable, byte[] content)
           
 
Methods inherited from class com.nexaweb.server.pushconnection.flushpolicies.IdlePeriodFlushPolicy
getFlushSizeInBytes, getIdlePeriod, isStreamClosedOnFlush, onMessageSend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdlePeriodWithSizeThresholdFlushPolicy

public IdlePeriodWithSizeThresholdFlushPolicy()
This constructor is only for use by Nexaweb internally. If you wish to construct this object directly for use on a PushConnection, use IdlePeriodWithSizeThresholdFlushPolicy(long, int, int) or IdlePeriodWithSizeThresholdFlushPolicy(long, int).


IdlePeriodWithSizeThresholdFlushPolicy

public IdlePeriodWithSizeThresholdFlushPolicy(long idlePeriod,
                                              int flushSize,
                                              int messageSizeThreshold)
Constructs a IdlePeriodWithSizeThresholdFlushPolicy with the specified idlePeriod, flushSize and messageSizeThreshold.

Parameters:
idlePeriod - The period of time in milliseconds that the stream must remain idle before it is flushed.
flushSize - The size of the flush that will be used when flushing.
messageSizeThreshold - The size to use as the threshold.

IdlePeriodWithSizeThresholdFlushPolicy

public IdlePeriodWithSizeThresholdFlushPolicy(long idlePeriod,
                                              int messageSizeThreshold)
Constructs a IdlePeriodWithSizeThresholdFlushPolicy with the specified idlePeriod and messageSizeThreshold which will return true from the isFlushMechanismStreamClose() method.

Parameters:
idlePeriod - The period of time in milliseconds that the stream must remain idle before it is flushed.
messageSizeThreshold - The size to use as the threshold.
Method Detail

configure

public void configure(Element policy)
               throws ConfigurationException
Overrides:
configure in class IdlePeriodFlushPolicy
Throws:
ConfigurationException
See Also:
ConfigurableFlushPolicy.configure(Element)

messageMeetsFlushTaskResetCriteria

protected boolean messageMeetsFlushTaskResetCriteria(Flushable flushable,
                                                     byte[] content)
Overrides:
messageMeetsFlushTaskResetCriteria in class IdlePeriodFlushPolicy


Copyright © 2005 Nexaweb Technologies, Inc. All Rights Reserved.