public static void startUp () { // Ensure this is done only once if (!s_aRegisteredRequestTracker.getAndSet (true)) { RequestTracker.longRunningRequestCallbacks ().add (AuditingLongRunningRequestCallback.INSTANCE); RequestTracker.parallelRunningRequestCallbacks ().add (AuditingParallelRunningRequestCallback.INSTANCE); } }
/** * Constructor. */ public AbstractXFilter () { m_aExceptionHandler.add (new XServletLoggingExceptionHandler ()); }
public SessionWebScope (@Nonnull final HttpSession aHttpSession) { super (aHttpSession.getId ()); m_aHttpSession = aHttpSession; attrs ().beforeSetValueCallbacks ().add ( (aName, aNewValueValue) -> { if (aNewValueValue != null && !(aNewValueValue instanceof Serializable)) LOGGER.warn ("Value of class " + aNewValueValue.getClass ().getName () + " should implement Serializable!"); return EContinue.CONTINUE; }); }
public AbstractWritingJAXBBuilder (@Nonnull final IJAXBDocumentType aDocType) { super (aDocType); exceptionCallbacks ().add (new LoggingJAXBWriteExceptionHandler ()); }
/** * Install the provided error callback for the following things: * <ul> * <li>ApplicationAjaxManager - exception handler</li> * <li>ApplicationAPIManager - exception handler</li> * <li>AbstractDAO - read and write exception handler</li> * <li>AbstractJob - exception callback</li> * <li>RequestTracker - long running requests and parallel running * requests</li> * </ul> * * @param aCallback * The callback to be installed. May not be <code>null</code>. */ public static void installToPhoton (@Nonnull final AbstractErrorCallback aCallback) { AjaxSettings.exceptionCallbacks ().add (aCallback); APISettings.exceptionCallbacks ().add (aCallback); AbstractDAO.exceptionHandlersRead ().add (aCallback); AbstractDAO.exceptionHandlersWrite ().add (aCallback); AbstractJob.exceptionCallbacks ().add (aCallback); RequestTracker.longRunningRequestCallbacks ().add (aCallback); RequestTracker.parallelRunningRequestCallbacks ().add (aCallback); } }
@Override protected void onExecute (@Nonnull final JobDataMap aJobDataMap, @Nonnull final IJobExecutionContext aContext) throws JobExecutionException { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Checking for dead locks"); final ThreadDeadlockDetector aTDD = new ThreadDeadlockDetector (); aTDD.callbacks ().add (new MailingThreadDeadlockCallback ()); aTDD.findDeadlockedThreads (); }
private void _initCallbacks () { // Always log m_aServiceGroupMgr.serviceGroupCallbacks ().add (new LoggingSMPServiceGroupCallback ()); if (m_aBusinessCardMgr != null) { // If service group is deleted, also delete respective business card m_aServiceGroupMgr.serviceGroupCallbacks ().add (new ISMPServiceGroupCallback () { @Override public void onSMPServiceGroupDeleted (@Nonnull final IParticipantIdentifier aParticipantID) { final String sServiceGroupID = SMPServiceGroup.createSMPServiceGroupID (aParticipantID); final ISMPBusinessCard aBusinessCard = m_aBusinessCardMgr.getSMPBusinessCardOfID (sServiceGroupID); if (aBusinessCard != null) m_aBusinessCardMgr.deleteSMPBusinessCard (aBusinessCard); } }); } }
public JAXBReaderBuilder (@Nonnull final IJAXBDocumentType aDocType, @Nonnull final Class <JAXBTYPE> aImplClass) { super (aDocType); m_aImplClass = ValueEnforcer.notNull (aImplClass, "ImplClass"); exceptionCallbacks ().add (new LoggingJAXBReadExceptionHandler ()); }
private void _initCallbacks () { // Always log m_aServiceGroupMgr.serviceGroupCallbacks ().add (new LoggingSMPServiceGroupCallback ()); if (m_aBusinessCardMgr != null) { // If service group is deleted, also delete respective business card m_aServiceGroupMgr.serviceGroupCallbacks ().add (new ISMPServiceGroupCallback () { @Override public void onSMPServiceGroupDeleted (@Nonnull final String sServiceGroupID) { final ISMPBusinessCard aBusinessCard = m_aBusinessCardMgr.getSMPBusinessCardOfID (sServiceGroupID); if (aBusinessCard != null) m_aBusinessCardMgr.deleteSMPBusinessCard (aBusinessCard); } }); } }
@Nonnull public EChange registerEventTarget (@Nonnull final EMicroEvent eEventType, @Nonnull final IMicroEventTarget aTarget) { ValueEnforcer.notNull (eEventType, "EventType"); ValueEnforcer.notNull (aTarget, "EventTarget"); if (m_aEventTargets == null) m_aEventTargets = new CommonsEnumMap <> (EMicroEvent.class); final CallbackList <IMicroEventTarget> aSet = m_aEventTargets.computeIfAbsent (eEventType, k -> new CallbackList <> ()); return EChange.valueOf (aSet.add (aTarget)); }
/** * Constructor. */ public AbstractXServlet () { // This handler is always the same, so it is registered here for convenience m_aHandlerRegistry.registerHandler (EHttpMethod.TRACE, new XServletHandlerTRACE (), false); // Default HEAD handler -> invoke with GET m_aHandlerRegistry.registerHandler (EHttpMethod.HEAD, (aHttpRequest, aHttpResponse, eHttpVersion, eHttpMethod, aRequestScope) -> { final CountingOnlyHttpServletResponse aResponseWrapper = new CountingOnlyHttpServletResponse (aHttpResponse); // Change method from HEAD to GET! _invokeHandler (aHttpRequest, aResponseWrapper, eHttpVersion, EHttpMethod.GET, aRequestScope); aResponseWrapper.setContentLengthAutomatically (); }, false); // Default OPTIONS handler m_aHandlerRegistry.registerHandler (EHttpMethod.OPTIONS, new XServletHandlerOPTIONS (m_aHandlerRegistry::getAllowedHttpMethodsString), false); m_aExceptionHandler.add (new XServletLoggingExceptionHandler ()); // Remember once m_aStatusMgr = ServletStatusManager.getInstance (); m_aStatusMgr.onServletCtor (getClass ()); }