项目:tomcat7
文件:ReplicationValve.java
/**
* Fix memory leak for long sessions with many changes,when no backup member exists!
* @param request current request after response is generated
* @param isCrossContext check crosscontext threadlocal
*/
protected void resetReplicationRequest(Request request,boolean isCrossContext) {
Session contextSession = request.getSessionInternal(false);
if(contextSession instanceof DeltaSession){
resetDeltaRequest(contextSession);
((DeltaSession)contextSession).setPrimarySession(true);
}
if(isCrossContext) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
Iterator<DeltaSession> iter = sessions.iterator();
for(; iter.hasNext() ;) {
Session session = iter.next();
resetDeltaRequest(session);
if(session instanceof DeltaSession)
((DeltaSession)contextSession).setPrimarySession(true);
}
}
}
}
项目:apache-tomcat-7.0.73-with-comment
文件:ReplicationValve.java
/**
* Fix memory leak for long sessions with many changes,boolean isCrossContext) {
Session contextSession = request.getSessionInternal(false);
if(contextSession instanceof DeltaSession){
resetDeltaRequest(contextSession);
((DeltaSession)contextSession).setPrimarySession(true);
}
if(isCrossContext) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
Iterator<DeltaSession> iter = sessions.iterator();
for(; iter.hasNext() ;) {
Session session = iter.next();
resetDeltaRequest(session);
if(session instanceof DeltaSession)
((DeltaSession)contextSession).setPrimarySession(true);
}
}
}
}
项目:lazycat
文件:ReplicationValve.java
/**
* Fix memory leak for long sessions with many changes,when no backup
* member exists!
*
* @param request
* current request after response is generated
* @param isCrossContext
* check crosscontext threadlocal
*/
protected void resetReplicationRequest(Request request,boolean isCrossContext) {
Session contextSession = request.getSessionInternal(false);
if (contextSession instanceof DeltaSession) {
resetDeltaRequest(contextSession);
((DeltaSession) contextSession).setPrimarySession(true);
}
if (isCrossContext) {
List<DeltaSession> sessions = crossContextSessions.get();
if (sessions != null && sessions.size() > 0) {
Iterator<DeltaSession> iter = sessions.iterator();
for (; iter.hasNext();) {
Session session = iter.next();
resetDeltaRequest(session);
if (session instanceof DeltaSession)
((DeltaSession) contextSession).setPrimarySession(true);
}
}
}
}
项目:tomcat7
文件:ReplicationValve.java
/**
* Send all changed cross context sessions to backups
* @param containerCluster
*/
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) {
Session session = iter.next();
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",session.getManager().getContainer().getName() ));
sendMessage(session,(ClusterManager)session.getManager(),containerCluster);
if(doStatistics()) {
nrOfCrossContextSendRequests++;
}
}
}
}
项目:apache-tomcat-7.0.73-with-comment
文件:ReplicationValve.java
/**
* Send all changed cross context sessions to backups
* @param containerCluster
*/
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) {
Session session = iter.next();
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",containerCluster);
if(doStatistics()) {
nrOfCrossContextSendRequests++;
}
}
}
}
项目:lazycat
文件:ReplicationValve.java
/**
* Send all changed cross context sessions to backups
*
* @param containerCluster
*/
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
List<DeltaSession> sessions = crossContextSessions.get();
if (sessions != null && sessions.size() > 0) {
for (Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext();) {
Session session = iter.next();
if (log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",session.getManager().getContainer().getName()));
sendMessage(session,(ClusterManager) session.getManager(),containerCluster);
if (doStatistics()) {
nrOfCrossContextSendRequests++;
}
}
}
}
项目:class-guard
文件:ReplicationValve.java
/**
* Send all changed cross context sessions to backups
* @param containerCluster
*/
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) {
Session session = iter.next();
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",containerCluster);
if(doStatistics()) {
nrOfCrossContextSendRequests++;
}
}
}
}
项目:class-guard
文件:ReplicationValve.java
/**
* Fix memory leak for long sessions with many changes,boolean isCrossContext) {
Session contextSession = request.getSessionInternal(false);
if(contextSession instanceof DeltaSession){
resetDeltaRequest(contextSession);
((DeltaSession)contextSession).setPrimarySession(true);
}
if(isCrossContext) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
Iterator<DeltaSession> iter = sessions.iterator();
for(; iter.hasNext() ;) {
Session session = iter.next();
resetDeltaRequest(session);
if(session instanceof DeltaSession)
((DeltaSession)contextSession).setPrimarySession(true);
}
}
}
}
项目:apache-tomcat-7.0.57
文件:ReplicationValve.java
/**
* Send all changed cross context sessions to backups
* @param containerCluster
*/
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) {
Session session = iter.next();
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",containerCluster);
if(doStatistics()) {
nrOfCrossContextSendRequests++;
}
}
}
}
项目:apache-tomcat-7.0.57
文件:ReplicationValve.java
/**
* Fix memory leak for long sessions with many changes,boolean isCrossContext) {
Session contextSession = request.getSessionInternal(false);
if(contextSession instanceof DeltaSession){
resetDeltaRequest(contextSession);
((DeltaSession)contextSession).setPrimarySession(true);
}
if(isCrossContext) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
Iterator<DeltaSession> iter = sessions.iterator();
for(; iter.hasNext() ;) {
Session session = iter.next();
resetDeltaRequest(session);
if(session instanceof DeltaSession)
((DeltaSession)contextSession).setPrimarySession(true);
}
}
}
}
项目:WBSAirback
文件:ReplicationValve.java
/**
* Send all changed cross context sessions to backups
* @param containerCluster
*/
protected void sendCrossContextSession(CatalinaCluster containerCluster) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
for(Iterator<DeltaSession> iter = sessions.iterator(); iter.hasNext() ;) {
Session session = iter.next();
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",containerCluster);
if(doStatistics()) {
nrOfCrossContextSendRequests++;
}
}
}
}
项目:WBSAirback
文件:ReplicationValve.java
/**
* Fix memory leak for long sessions with many changes,boolean isCrossContext) {
Session contextSession = request.getSessionInternal(false);
if(contextSession instanceof DeltaSession){
resetDeltaRequest(contextSession);
((DeltaSession)contextSession).setPrimarySession(true);
}
if(isCrossContext) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null && sessions.size() >0) {
Iterator<DeltaSession> iter = sessions.iterator();
for(; iter.hasNext() ;) {
Session session = iter.next();
resetDeltaRequest(session);
if(session instanceof DeltaSession)
((DeltaSession)contextSession).setPrimarySession(true);
}
}
}
}
项目:tomcat7
文件:ReplicationValve.java
/**
* Register all cross context sessions inside endAccess.
* Use a list with contains check,that the Portlet API can include a lot of fragments from same or
* different applications with session changes.
*
* @param session cross context session
*/
public void registerReplicationSession(DeltaSession session) {
List<DeltaSession> sessions = crossContextSessions.get();
if(sessions != null) {
if(!sessions.contains(session)) {
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.registerSession",session.getIdInternal(),session.getManager().getContainer().getName()));
sessions.add(session);
}
}
}
项目:tomcat7
文件:ReplicationValve.java
/**
* Log the interesting request parameters,invoke the next Valve in the
* sequence,and log the interesting response parameters.
*
* @param request The servlet request to be processed
* @param response The servlet response to be created
*
* @exception IOException if an input/output error occurs
* @exception servletexception if a servlet error occurs
*/
@Override
public void invoke(Request request,Response response)
throws IOException,servletexception
{
long totalstart = 0;
//this happens before the request
if(doStatistics()) {
totalstart = System.currentTimeMillis();
}
if (primaryIndicator) {
createPrimaryIndicator(request) ;
}
Context context = request.getContext();
boolean isCrossContext = context != null
&& context instanceof StandardContext
&& ((StandardContext) context).getCrossContext();
try {
if(isCrossContext) {
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.add"));
//FIXME add Pool of Arraylists
crossContextSessions.set(new ArrayList<DeltaSession>());
}
getNext().invoke(request,response);
if(context != null && cluster != null
&& context.getManager() instanceof ClusterManager) {
ClusterManager clusterManager = (ClusterManager) context.getManager();
// valve cluster can access manager - other cluster handle replication
// at host level - hopefully!
if(cluster.getManager(clusterManager.getName()) == null)
return ;
if(cluster.hasMembers()) {
sendReplicationMessage(request,totalstart,isCrossContext,clusterManager,cluster);
} else {
resetReplicationRequest(request,isCrossContext);
}
}
} finally {
// Array must be remove: Current master request send endAccess at recycle.
// Don't register this request session again!
if(isCrossContext) {
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.remove"));
// crossContextSessions.remove() only exist at Java 5
// register ArrayList at a pool
crossContextSessions.set(null);
}
}
}
项目:tomcat7
文件:ReplicationValve.java
/**
* Reset DeltaRequest from session
* @param session HttpSession from current request or cross context session
*/
protected void resetDeltaRequest(Session session) {
if(log.isDebugEnabled()) {
log.debug(sm.getString("ReplicationValve.resetDeltaRequest",session.getManager().getContainer().getName() ));
}
((DeltaSession)session).resetDeltaRequest();
}
项目:apache-tomcat-7.0.73-with-comment
文件:ReplicationValve.java
/**
* Register all cross context sessions inside endAccess.
* Use a list with contains check,session.getManager().getContainer().getName()));
sessions.add(session);
}
}
}
项目:apache-tomcat-7.0.73-with-comment
文件:ReplicationValve.java
/**
* Log the interesting request parameters,isCrossContext);
}
}
} finally {
// Array must be remove: Current master request send endAccess at recycle.
// Don't register this request session again!
if(isCrossContext) {
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.remove"));
// crossContextSessions.remove() only exist at Java 5
// register ArrayList at a pool
crossContextSessions.set(null);
}
}
}
项目:apache-tomcat-7.0.73-with-comment
文件:ReplicationValve.java
/**
* Reset DeltaRequest from session
* @param session HttpSession from current request or cross context session
*/
protected void resetDeltaRequest(Session session) {
if(log.isDebugEnabled()) {
log.debug(sm.getString("ReplicationValve.resetDeltaRequest",session.getManager().getContainer().getName() ));
}
((DeltaSession)session).resetDeltaRequest();
}
项目:lazycat
文件:ReplicationValve.java
/**
* Register all cross context sessions inside endAccess. Use a list with
* contains check,that the Portlet API can include a lot of fragments from
* same or different applications with session changes.
*
* @param session
* cross context session
*/
public void registerReplicationSession(DeltaSession session) {
List<DeltaSession> sessions = crossContextSessions.get();
if (sessions != null) {
if (!sessions.contains(session)) {
if (log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.registerSession",session.getManager().getContainer().getName()));
sessions.add(session);
}
}
}
项目:lazycat
文件:ReplicationValve.java
/**
* Log the interesting request parameters,and log the interesting response parameters.
*
* @param request
* The servlet request to be processed
* @param response
* The servlet response to be created
*
* @exception IOException
* if an input/output error occurs
* @exception servletexception
* if a servlet error occurs
*/
@Override
public void invoke(Request request,Response response) throws IOException,servletexception {
long totalstart = 0;
// this happens before the request
if (doStatistics()) {
totalstart = System.currentTimeMillis();
}
if (primaryIndicator) {
createPrimaryIndicator(request);
}
Context context = request.getContext();
boolean isCrossContext = context != null && context instanceof StandardContext
&& ((StandardContext) context).getCrossContext();
try {
if (isCrossContext) {
if (log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.add"));
// FIXME add Pool of Arraylists
crossContextSessions.set(new ArrayList<DeltaSession>());
}
getNext().invoke(request,response);
if (context != null && cluster != null && context.getManager() instanceof ClusterManager) {
ClusterManager clusterManager = (ClusterManager) context.getManager();
// valve cluster can access manager - other cluster handle
// replication
// at host level - hopefully!
if (cluster.getManager(clusterManager.getName()) == null)
return;
if (cluster.hasMembers()) {
sendReplicationMessage(request,isCrossContext);
}
}
} finally {
// Array must be remove: Current master request send endAccess at
// recycle.
// Don't register this request session again!
if (isCrossContext) {
if (log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.remove"));
// crossContextSessions.remove() only exist at Java 5
// register ArrayList at a pool
crossContextSessions.set(null);
}
}
}
项目:lazycat
文件:ReplicationValve.java
/**
* Reset DeltaRequest from session
*
* @param session
* HttpSession from current request or cross context session
*/
protected void resetDeltaRequest(Session session) {
if (log.isDebugEnabled()) {
log.debug(
sm.getString("ReplicationValve.resetDeltaRequest",session.getManager().getContainer().getName()));
}
((DeltaSession) session).resetDeltaRequest();
}
项目:class-guard
文件:ReplicationValve.java
/**
* Register all cross context sessions inside endAccess.
* Use a list with contains check,session.getManager().getContainer().getName()));
sessions.add(session);
}
}
}
项目:class-guard
文件:ReplicationValve.java
/**
* Reset DeltaRequest from session
* @param session HttpSession from current request or cross context session
*/
protected void resetDeltaRequest(Session session) {
if(log.isDebugEnabled()) {
log.debug(sm.getString("ReplicationValve.resetDeltaRequest",session.getManager().getContainer().getName() ));
}
((DeltaSession)session).resetDeltaRequest();
}
项目:apache-tomcat-7.0.57
文件:ReplicationValve.java
/**
* Register all cross context sessions inside endAccess.
* Use a list with contains check,session.getManager().getContainer().getName()));
sessions.add(session);
}
}
}
项目:apache-tomcat-7.0.57
文件:ReplicationValve.java
/**
* Reset DeltaRequest from session
* @param session HttpSession from current request or cross context session
*/
protected void resetDeltaRequest(Session session) {
if(log.isDebugEnabled()) {
log.debug(sm.getString("ReplicationValve.resetDeltaRequest",session.getManager().getContainer().getName() ));
}
((DeltaSession)session).resetDeltaRequest();
}
项目:WBSAirback
文件:ReplicationValve.java
/**
* Register all cross context sessions inside endAccess.
* Use a list with contains check,session.getManager().getContainer().getName()));
sessions.add(session);
}
}
}
项目:WBSAirback
文件:ReplicationValve.java
/**
* Reset DeltaRequest from session
* @param session HttpSession from current request or cross context session
*/
protected void resetDeltaRequest(Session session) {
if(log.isDebugEnabled()) {
log.debug(sm.getString("ReplicationValve.resetDeltaRequest",session.getManager().getContainer().getName() ));
}
((DeltaSession)session).resetDeltaRequest();
}
项目:class-guard
文件:ReplicationValve.java
/**
* Log the interesting request parameters,isCrossContext);
}
}
} finally {
// Array must be remove: Current master request send endAccess at recycle.
// Don't register this request session again!
if(isCrossContext) {
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.remove"));
// crossContextSessions.remove() only exist at Java 5
// register ArrayList at a pool
crossContextSessions.set(null);
}
}
}
项目:apache-tomcat-7.0.57
文件:ReplicationValve.java
/**
* Log the interesting request parameters,isCrossContext);
}
}
} finally {
// Array must be remove: Current master request send endAccess at recycle.
// Don't register this request session again!
if(isCrossContext) {
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.remove"));
// crossContextSessions.remove() only exist at Java 5
// register ArrayList at a pool
crossContextSessions.set(null);
}
}
}
项目:WBSAirback
文件:ReplicationValve.java
/**
* Log the interesting request parameters,response);
if(context != null) {
Manager manager = context.getManager();
if (manager != null && manager instanceof ClusterManager) {
ClusterManager clusterManager = (ClusterManager) manager;
CatalinaCluster containerCluster = (CatalinaCluster) getContainer().getCluster();
if (containerCluster == null) {
if (log.isWarnEnabled())
log.warn(sm.getString("ReplicationValve.nocluster"));
return;
}
// valve cluster can access manager - other cluster handle replication
// at host level - hopefully!
if(containerCluster.getManager(clusterManager.getName()) == null)
return ;
if(containerCluster.hasMembers()) {
sendReplicationMessage(request,containerCluster);
} else {
resetReplicationRequest(request,isCrossContext);
}
}
}
} finally {
// Array must be remove: Current master request send endAccess at recycle.
// Don't register this request session again!
if(isCrossContext) {
if(log.isDebugEnabled())
log.debug(sm.getString("ReplicationValve.crossContext.remove"));
// crossContextSessions.remove() only exist at Java 5
// register ArrayList at a pool
crossContextSessions.set(null);
}
}
}