|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectTimerBasedFlushPolicy
com.nexaweb.server.pushconnection.flushpolicies.IdlePeriodFlushPolicy
This policy will take action if, after a message is sent, the connection remains idle for a specified period of time. This policy is used when your application sends groups of messages down the push connection with idle time in between. Configuring this policy to be tolerant of the time between messages in a group and taking action between groups is the goal.
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.IdlePeriodFlushPolicy">
<flush-size>8 K</flush-size>
<period>10 sec.</period>
</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.IdlePeriodFlushPolicy">
<is-stream-closed-on-flush>true</is-stream-closed-on-flush>
<period>10 sec.</period>
</configuration>
</policy>
| Constructor Summary | |
IdlePeriodFlushPolicy()
This constructor is only for use by Nexaweb internally. |
|
IdlePeriodFlushPolicy(long idlePeriod)
Constructs a IdlePeriodFlushPolicy with the specified idlePeriod which will return true from isFlushMechanismStreamClose(). |
|
IdlePeriodFlushPolicy(long idlePeriod,
int flushSize)
Constructs a IdlePeriodFlushPolicy with the specified idlePeriod and flushSize. |
|
| Method Summary | |
void |
configure(Element policy)
|
int |
getFlushSizeInBytes()
|
protected long |
getIdlePeriod()
|
boolean |
isStreamClosedOnFlush()
|
protected boolean |
messageMeetsFlushTaskResetCriteria(Flushable flushable,
byte[] content)
|
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 |
public IdlePeriodFlushPolicy()
IdlePeriodFlushPolicy(long, int) or
IdlePeriodFlushPolicy(long).
public IdlePeriodFlushPolicy(long idlePeriod,
int flushSize)
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.public IdlePeriodFlushPolicy(long idlePeriod)
idlePeriod - The period of time in milliseconds that the stream
must remain idle before it is flushed.| Method Detail |
public void configure(Element policy)
throws ConfigurationException
ConfigurationExceptionConfigurableFlushPolicy.configure(Element)public int getFlushSizeInBytes()
FlushPolicy#getFlushSizeInBytespublic boolean isStreamClosedOnFlush()
FlushPolicy#isStreamClosedOnFlush
public void onMessageSend(Flushable flushable,
byte[] content)
throws java.io.IOException
java.io.IOExceptionFlushPolicy#onMessageSend(Flushable,byte[])
protected boolean messageMeetsFlushTaskResetCriteria(Flushable flushable,
byte[] content)
protected long getIdlePeriod()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||