com.nexaweb.server.pushconnection.flushpolicies
Class ThroughputFlushPolicy

java.lang.Object
  extended byTimerBasedFlushPolicy
      extended bycom.nexaweb.server.pushconnection.flushpolicies.ThroughputFlushPolicy

public class ThroughputFlushPolicy
extends TimerBasedFlushPolicy

The throughput flush policy is used to flush when it detects lulls in network traffic over a persistent connection.

This policy will perform its action when the throughput on the connection falls below a specified level for a specified period. This is similar to the Idle Connection Policy With Activity Threshold in that it operates on the assumption that it doesn't need to do anything if there is enough content flowing naturally to keep things moving through the proxy server's internal IO buffer.

This policy is used when the application has relatively continuous activity (or bursts of activity) but with varying message sizes. The throughput policy ensures that if enough content is flowing to ensure movement through the proxy's internal IO buffer no action is taken, but otherwise take action at the end of the specified sample period.

Example Configurations

   <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.ThroughputFlushPolicy">
         <flush-size>8 K</flush-size>
         <measurement-period>10 sec.</measurement-period>
         <minimum-throughput>4 K</minimum-throughput>
      </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.1" />
      </rules>		 
      <configuration class="com.nexaweb.server.pushconnection.flushpolicies.ThroughputFlushPolicy">
         <is-stream-closed-on-flush>true</is-stream-closed-on-flush>
         <measurement-period>10 sec.</measurement-period>
         <minimum-throughput>4 K</minimum-throughput>
      </configuration>
   </policy>
 

See Also:
Serialized Form

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

Constructor Detail

ThroughputFlushPolicy

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


ThroughputFlushPolicy

public ThroughputFlushPolicy(int minimumThroughput,
                             int flushSize,
                             long samplePeriod)
Constructs a ThroughputFlushPolicy with the specified minimumThroughput, flushSize and samplePeriod.

Parameters:
minimumThroughput - The minimum number of bytes that must travel across the push connection over the period to avoid a flush.
flushSize - The size of the flush that will be used when flushing.
samplePeriod - The interval over which the throughput will be measured.

ThroughputFlushPolicy

public ThroughputFlushPolicy(int minimumThroughput,
                             long samplePeriod)
Constructs a ThroughputFlushPolicy with the specified minimumThroughput and samplePeriod which will return true from the isFlushMechanismStreamClose() method.

Parameters:
minimumThroughput - The minimum number of bytes that must travel across the push connection over the period to avoid a flush.
samplePeriod - The interval over which the throughput will be measured.
Method Detail

configure

public void configure(Element policy)
               throws ConfigurationException
Throws:
ConfigurationException
See Also:
ConfigurableFlushPolicy.configure(Element)

getFlushSizeInBytes

public int getFlushSizeInBytes()
See Also:
FlushPolicy.getFlushSizeInBytes()

isStreamClosedOnFlush

public boolean isStreamClosedOnFlush()
See Also:
FlushPolicy.isStreamClosedOnFlush()

onMessageSend

public void onMessageSend(Flushable flushable,
                          byte[] content)
                   throws java.io.IOException
Throws:
java.io.IOException
See Also:
FlushPolicy.onMessageSend(Flushable,byte[])


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