File store = sessionStore(context.getPath()); if (store == null) { getLogger().debug("No session store file found"); return; if (getLogger().isDebugEnabled()) { getLogger().debug("Loading sessions from " + store.getAbsolutePath()); if (getLogger().isDebugEnabled()) { getLogger().debug("Creating custom object input stream for class loader"); if (getLogger().isDebugEnabled()) { getLogger().debug("Creating standard object input stream"); if (getLogger().isDebugEnabled()) { getLogger().debug("No persisted data file found"); getLogger().error("Exception loading sessions", e); try { fis.close(); Integer count = (Integer) ois.readObject(); int n = count.intValue(); if (getLogger().isDebugEnabled()) { getLogger().debug("Loading " + n + " persisted sessions"); if (getLogger().isDebugEnabled()) { getLogger().debug("Loaded session " + session.getId() + " is older than cached copy");
private void handlePossibleFailover(Request request, DeltaSessionManager manager, String localJvmRoute) { String sessionId = request.getRequestedSessionId(); if (sessionId != null) { if (manager.getLogger().isDebugEnabled()) { StringBuilder builder = new StringBuilder(); builder.append(this).append(": Handling failover of session ").append(sessionId) .append(" from ").append(requestJvmRoute).append(" to ").append(localJvmRoute); manager.getLogger().debug(builder.toString()); builder.append(this).append(": Caught exception attempting to find session ") .append(sessionId).append(" in ").append(manager); manager.getLogger().warn(builder.toString(), e); builder.append(this).append(": Did not find session ").append(sessionId) .append(" to failover in ").append(manager); manager.getLogger().warn(builder.toString()); } else { request.changeSessionId(newSessionId);
protected void unregisterJvmRouteBinderValve() { if (getLogger().isDebugEnabled()) { getLogger().debug(this + ": Unregistering JVM route binder valve"); } if (jvmRouteBinderValve != null) { getPipeline().removeValve(jvmRouteBinderValve); } }
/** * get Cluster DeltaManager * * @param request current request * @return manager or null */ protected Manager getManager(Request request) { Manager manager = request.getContext().getManager(); if (log.isDebugEnabled()) { if(manager != null) log.debug(sm.getString("jvmRoute.foundManager", manager, request.getContext().getName())); else log.debug(sm.getString("jvmRoute.notFoundManager", request.getContext().getName())); } return manager; }
/** * Notify interested listeners that attribute has been removed. */ private void notifyAttributeRemoved(String name, Object value) { Object listeners[] = context.getApplicationEventListeners(); if ((listeners == null) || (listeners.length == 0)) { return; } ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(context.getServletContext(), getRequest(), name, value); for (int i = 0; i < listeners.length; i++) { if (!(listeners[i] instanceof ServletRequestAttributeListener)) { continue; } ServletRequestAttributeListener listener = (ServletRequestAttributeListener) listeners[i]; try { listener.attributeRemoved(event); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); context.getLogger().error(sm.getString("coyoteRequest.attributeEvent"), t); // Error valve will pick this exception up and display it to user attributes.put(RequestDispatcher.ERROR_EXCEPTION, t); } } }
private void undeploy(DeployedApplication app) { if (log.isInfoEnabled()) log.info(sm.getString("hostConfig.undeploy", app.name)); Container context = host.findChild(app.name); try { host.removeChild(context); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.warn(sm.getString ("hostConfig.context.remove", app.name), t); } deployed.remove(app.name); }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { Manager manager = request.getContext().getManager(); DeltaSessionFacade session = null; session = (DeltaSessionFacade) request.getSession(false); DeltaSessionManager dsm = ((DeltaSessionManager) manager); if (session != null) { dsm.removeTouchedSession(session.getId()); session.commit(); if (dsm.getTheContext().getLogger().isDebugEnabled()) { dsm.getTheContext().getLogger().debug(session + ": Committed."); if (dsm.getTheContext().getLogger().isDebugEnabled()) { dsm.getTheContext().getLogger().debug(session + ": Not valid so not committing.");
/** * 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().getContext().getName() )); } ((DeltaSession)session).resetDeltaRequest(); }
/** * Register host. */ private void registerHost(Host host) { String[] aliases = host.findAliases(); mapper.addHost(host.getName(), aliases, host); for (Container container : host.findChildren()) { if (container.getState().isAvailable()) { registerContext((Context) container); } } if(log.isDebugEnabled()) { log.debug(sm.getString("mapperListener.registerHost", host.getName(), domain, service)); } }
public long getCreationTimestamp( String sessionId ) { Session s = sessions.get(sessionId); if (s == null) { if (log.isInfoEnabled()) { log.info(sm.getString("managerBase.sessionNotFound", sessionId)); } return -1; } return s.getCreationTime(); }
protected void processContainerRemoveChild(Container parent, Container child) { if (log.isDebugEnabled()) log.debug("Process removeChild[parent=" + parent + ",child=" + child + "]"); if (child instanceof Context) { Context context = (Context) child; context.removeLifecycleListener(this); } else if (child instanceof Host || child instanceof Engine) { child.removeContainerListener(this); } }
/** * Attempt to load a class using the given Container's class loader. If the * class cannot be loaded, a debug level log message will be written to the * Container's log and null will be returned. * @param context The class loader of this context will be used to attempt * to load the class * @param className The class name * @return the loaded class or <code>null</code> if loading failed */ public static Class<?> loadClass(Context context, String className) { ClassLoader cl = context.getLoader().getClassLoader(); Log log = context.getLogger(); Class<?> clazz = null; try { clazz = cl.loadClass(className); } catch (ClassNotFoundException | NoClassDefFoundError | ClassFormatError e) { log.debug(sm.getString("introspection.classLoadFailed", className), e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); log.debug(sm.getString("introspection.classLoadFailed", className), t); } return clazz; }
protected static boolean isPostMethod(final Request request) { final String method = request.getMethod(); if ( method == null && _log.isDebugEnabled() ) { _log.debug("No method set for request " + request.getRequestURI() + (request.getQueryString() != null ? "?" + request.getQueryString() : "")); } return method != null ? method.toLowerCase().equals( "post" ) : false; }
@Override public Principal getPrincipal() { if (this.principal == null && this.serializedPrincipal != null) { SerializablePrincipal sp = null; try { sp = (SerializablePrincipal) BlobHelper.deserializeBlob(this.serializedPrincipal); } catch (Exception e) { StringBuilder builder = new StringBuilder(); builder.append(this).append( ": Serialized principal contains a byte[] that cannot be deserialized due to the following exception"); ((DeltaSessionManager) getManager()).getLogger().warn(builder.toString(), e); return null; } this.principal = sp.getPrincipal(((DeltaSessionManager) this.manager).getTheContext().getRealm()); if (getManager() != null) { DeltaSessionManager mgr = (DeltaSessionManager) getManager(); if (mgr.getLogger().isDebugEnabled()) { mgr.getLogger().debug(this + ": Deserialized principal: " + this.principal); // mgr.logCurrentStack(); } } } return this.principal; }
if(!_enabled.get() || !_msmContext.equals(request.getContext())) { getNext().invoke( request, response ); } else if ( _ignorePattern != null && _ignorePattern.matcher( requestId ).matches() ) { if(_log.isDebugEnabled()) { _log.debug( ">>>>>> Ignoring: " + requestId + " (requestedSessionId "+ request.getRequestedSessionId() +") ==================" ); request.setNote(REQUEST_IGNORED, Boolean.TRUE); getNext().invoke( request, response ); } finally { if(_log.isDebugEnabled()) { _log.debug( "<<<<<< Ignored: " + requestId + " ==================" ); request.setNote(REQUEST_PROCESS, Boolean.TRUE); if ( _log.isDebugEnabled() ) { _log.debug( ">>>>>> Request starting: " + requestId + " (requestedSessionId "+ request.getRequestedSessionId() +") ==================" ); if ( _log.isDebugEnabled() ) { logDebugRequestSessionCookie( request ); logDebugResponseCookie( response ); _log.debug( "<<<<<< Request finished: " + requestId + " ==================" );
private void handleOnOpenOrCloseError(Session session, Throwable t) { // If really fatal - re-throw ExceptionUtils.handleThrowable(t); // Trigger the error handler and close the session onError(session, t); try { session.close(); } catch (IOException ioe) { log.warn(sm.getString("pojoEndpointBase.closeSessionFail"), ioe); } }
/** * 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(); }