HttpSession session = request.getSession(false);
if (!( request.getContext().getManager() instanceof ClusterManager) ) return;
ClusterManager manager = (ClusterManager)request.getContext().getManager();
CatalinaCluster cluster = (CatalinaCluster)getContainer().getCluster();
if ( cluster == null ) {
log.warn("No cluster configured for this request.");
return;
}
//first check for session invalidations
String[] invalidIds=manager.getInvalidatedSessions();
if ( invalidIds.length > 0 ) {
for ( int i=0;i<invalidIds.length; i++ ) {
try {
ClusterMessage imsg = manager.requestCompleted(invalidIds[i]);
if (imsg != null)
cluster.send(imsg);
}catch ( Exception x ) {
log.error("Unable to send session invalid message over cluster.",x);
}
}
}
String id = null;
if ( session != null )
id = session.getId();
else
return;
if ( id == null )
return;
if ( (request.getContext().getManager()==null) ||
(!(request.getContext().getManager() instanceof ClusterManager)))
return;
String uri = request.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;
log.debug("Invoking replication request on "+uri);
ClusterMessage msg = manager.requestCompleted(id);
if ( msg == null ) return;
cluster.send(msg);
long stop = System.currentTimeMillis();
addClusterSendTime(stop-totalstart,stop-start);
}catch (Exception x)
{