long start = System.currentTimeMillis();
HttpRequest hrequest = (HttpRequest) request;
HttpServletRequest hreq = (HttpServletRequest) hrequest.getRequest();
HttpSession session = hreq.getSession(false);
SimpleTcpReplicationManager manager = (SimpleTcpReplicationManager)request.getContext().getManager();
SimpleTcpCluster cluster = (SimpleTcpCluster)getContainer().getCluster();
if ( cluster == null ) {
log("No cluster configured for this request.",2);
return;
}
//first check for session invalidations
String[] invalidIds=manager.getInvalidatedSessions();
if ( invalidIds.length > 0 ) {
for ( int i=0;i<invalidIds.length; i++ ) {
try {
SessionMessage imsg = manager.requestCompleted(
invalidIds[i]);
if (imsg != null)
cluster.send(imsg);
}catch ( Exception x ) {
log("Unable to send session invalid message over cluster.",x,2);
}
}
}
String id = null;
if ( session != null )
id = session.getId();
else
return;
if ( id == null )
return;
if ( (request.getContext().getManager()==null) ||
(!(request.getContext().getManager() instanceof SimpleTcpReplicationManager)))
return;
String uri = hrequest.getDecodedRequestURI();
boolean filterfound = false;
for ( int i=0; (i<reqFilters.length) && (!filterfound); i++ )
{
java.util.regex.Matcher matcher = reqFilters[i].matcher(uri);
filterfound = matcher.matches();
}//for
if ( filterfound )
return;
if ( debug > 4 ) log("Invoking replication request on "+uri,4);
SessionMessage msg = manager.requestCompleted(id);
if ( msg == null ) return;
cluster.send(msg);
long stop = System.currentTimeMillis();
addClusterSendTime(stop-start);
}catch (Exception x)
{