public static final void onExecutionTimeExceeded (@Nonnull final String sMsg, @Nonnegative final long nExecutionMillis) { s_aExecutionTimeExceededHandlers.forEach (x -> x.onExecutionTimeExceeded (sMsg, nExecutionMillis)); }
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); } }
m_aExceptionCallbacks.forEach (x -> x.onException (ex)); if (m_aExceptionCallbacks.isNotEmpty ()) m_aExceptionCallbacks.forEach (x -> x.onException (ex)); else LOGGER.error ("Error executing action", ex);
@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)); }
.setInitialSorting (ESortOrder.ASCENDING), new DTCol (EText.MSG_CALLBACK.getDisplayText (aDisplayLocale))).setID (getID () + "-ajax-cb"); for (final IAjaxExceptionCallback aCB : AjaxSettings.exceptionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("Exception", aCB.toString ()); for (final IAjaxBeforeExecutionCallback aCB : AjaxSettings.beforeExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("BeforeExecution", aCB.toString ()); for (final IAjaxAfterExecutionCallback aCB : AjaxSettings.afterExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("AfterExecution", aCB.toString ()); for (final IAjaxLongRunningExecutionCallback aCB : AjaxSettings.longRunningExecutionCallbacks () .getAllCallbacks ()) aTable.addBodyRow ().addCells ("LongRunningExecution", aCB.toString ());
@Nonnull public EChange unregisterEventTarget (@Nonnull final EMicroEvent eEventType, @Nonnull final IMicroEventTarget aTarget) { ValueEnforcer.notNull (eEventType, "EventType"); ValueEnforcer.notNull (aTarget, "EventTarget"); if (m_aEventTargets != null && m_aEventTargets.isNotEmpty ()) { final CallbackList <IMicroEventTarget> aSet = m_aEventTargets.get (eEventType); if (aSet != null) return aSet.removeObject (aTarget); } return EChange.UNCHANGED; }
.setInitialSorting (ESortOrder.ASCENDING), new DTCol (EText.MSG_CALLBACK.getDisplayText (aDisplayLocale))).setID (getID () + "-ajax-cb"); for (final IAjaxExceptionCallback aCB : AjaxSettings.exceptionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("Exception", aCB.toString ()); for (final IAjaxBeforeExecutionCallback aCB : AjaxSettings.beforeExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("BeforeExecution", aCB.toString ()); for (final IAjaxAfterExecutionCallback aCB : AjaxSettings.afterExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("AfterExecution", aCB.toString ()); for (final IAjaxLongRunningExecutionCallback aCB : AjaxSettings.longRunningExecutionCallbacks () .getAllCallbacks ()) aTable.addBodyRow ().addCells ("LongRunningExecution", aCB.toString ());
public static void shutdown () { if (s_aRegisteredRequestTracker.getAndSet (false)) { RequestTracker.longRunningRequestCallbacks ().removeObject (AuditingLongRunningRequestCallback.INSTANCE); RequestTracker.parallelRunningRequestCallbacks ().removeObject (AuditingParallelRunningRequestCallback.INSTANCE); } // Init the base path once WebFileIO.resetPaths (); // Clear commons cache also manually - but at the end because it // is used in equals and hashCode implementations ScopeCleanup.cleanup (); XMLCleanup.cleanup (); CommonsCleanup.cleanup (); } }
/** * Invoke the custom exception handler (if present) * * @param ex * The exception that occurred. */ private static void _invokeCustomExceptionCallback (@Nonnull final Exception ex) { s_aExceptionCallbacks.forEach (x -> x.onException (ex)); }
/** * Constructor. */ public AbstractXFilter () { m_aExceptionHandler.add (new XServletLoggingExceptionHandler ()); }
/** * Trigger the registered custom exception handlers for read errors. * * @param t * Thrown exception. Never <code>null</code>. * @param bIsInitialization * <code>true</code> if this happened during initialization of a new * file, <code>false</code> if it happened during regular reading. * @param aFile * The file that was read. May be <code>null</code> for in-memory DAOs. */ protected static void triggerExceptionHandlersRead (@Nonnull final Throwable t, final boolean bIsInitialization, @Nullable final File aFile) { // Custom exception handler for reading if (exceptionHandlersRead ().isNotEmpty ()) { final IReadableResource aRes = aFile == null ? null : new FileSystemResource (aFile); exceptionHandlersRead ().forEach (aCB -> aCB.onDAOReadException (t, bIsInitialization, aRes)); } }
.setInitialSorting (ESortOrder.ASCENDING), new DTCol (EText.MSG_CALLBACK.getDisplayText (aDisplayLocale))).setID (getID () + "-api-cb"); for (final IAPIExceptionCallback aCB : APISettings.exceptionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("Exception", aCB.toString ()); for (final IAPIBeforeExecutionCallback aCB : APISettings.beforeExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("BeforeExecution", aCB.toString ()); for (final IAPIAfterExecutionCallback aCB : APISettings.afterExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("AfterExecution", aCB.toString ()); for (final IAPILongRunningExecutionCallback aCB : APISettings.longRunningExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("LongRunningExecution", aCB.toString ()); aTab.addChild (aTable);
protected final void internalTriggerEvent (@Nonnull final EMicroEvent eEventType, @Nonnull final IMicroEvent aEvent) { // Any event targets present? if (m_aEventTargets != null && m_aEventTargets.isNotEmpty ()) { // Get all event handler final CallbackList <IMicroEventTarget> aTargets = m_aEventTargets.get (eEventType); if (aTargets != null) aTargets.forEach (x -> x.handleEvent (aEvent)); } // Bubble to parent if (m_aParentNode != null) m_aParentNode.internalTriggerEvent (eEventType, aEvent); }
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; }); }
/** * Trigger the registered custom exception handlers for read errors. * * @param t * Thrown exception. Never <code>null</code>. * @param bIsInitialization * <code>true</code> if this happened during initialization of a new * file, <code>false</code> if it happened during regular reading. * @param aFile * The file that was read. May be <code>null</code> for in-memory DAOs. */ protected static void triggerExceptionHandlersRead (@Nonnull final Throwable t, final boolean bIsInitialization, @Nullable final File aFile) { // Custom exception handler for reading if (exceptionHandlersRead ().isNotEmpty ()) { final IReadableResource aRes = aFile == null ? null : new FileSystemResource (aFile); exceptionHandlersRead ().forEach (aCB -> aCB.onDAOReadException (t, bIsInitialization, aRes)); } }
.setInitialSorting (ESortOrder.ASCENDING), new DTCol (EText.MSG_CALLBACK.getDisplayText (aDisplayLocale))).setID (getID () + "-api-cb"); for (final IAPIExceptionCallback aCB : APISettings.exceptionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("Exception", aCB.toString ()); for (final IAPIBeforeExecutionCallback aCB : APISettings.beforeExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("BeforeExecution", aCB.toString ()); for (final IAPIAfterExecutionCallback aCB : APISettings.afterExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("AfterExecution", aCB.toString ()); for (final IAPILongRunningExecutionCallback aCB : APISettings.longRunningExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("LongRunningExecution", aCB.toString ()); aTab.addChild (aTable);
/** * Mark an item as "no longer deleted" without actually adding it to the map. * This method only triggers the update action but does not alter the item. * Must only be invoked inside a write-lock. * * @param aItem * The item that was marked as "no longer deleted" * @param bInvokeCallbacks * <code>true</code> to invoke callbacks, <code>false</code> to not do * so. * @since 9.2.1 */ @MustBeLocked (ELockType.WRITE) protected final void internalMarkItemUndeleted (@Nonnull final IMPLTYPE aItem, final boolean bInvokeCallbacks) { // Trigger save changes super.markAsChanged (aItem, EDAOActionType.UPDATE); if (bInvokeCallbacks) { // Invoke callbacks m_aCallbacks.forEach (aCB -> aCB.onMarkItemUndeleted (aItem)); } }
public AbstractWritingJAXBBuilder (@Nonnull final IJAXBDocumentType aDocType) { super (aDocType); exceptionCallbacks ().add (new LoggingJAXBWriteExceptionHandler ()); }
/** * Trigger the registered custom exception handlers for read errors. * * @param t * Thrown exception. Never <code>null</code>. * @param sErrorFilename * The filename tried to write to. Never <code>null</code>. * @param aDoc * The XML content that should be written. May be <code>null</code> if * the error occurred in XML creation. */ protected static void triggerExceptionHandlersWrite (@Nonnull final Throwable t, @Nonnull final String sErrorFilename, @Nullable final IMicroDocument aDoc) { // Check if a custom exception handler is present if (exceptionHandlersWrite ().isNotEmpty ()) { final IReadableResource aRes = new FileSystemResource (sErrorFilename); final String sXMLContent = aDoc == null ? "no XML document created" : MicroWriter.getNodeAsString (aDoc); exceptionHandlersWrite ().forEach (aCB -> aCB.onDAOWriteException (t, aRes, sXMLContent)); } }
aTable.addHeaderRow ().addCells (EText.MSG_TYPE.getDisplayText (aDisplayLocale), EText.MSG_CALLBACK.getDisplayText (aDisplayLocale)); for (final IAjaxExceptionCallback aCB : aMgr.getExceptionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("Exception", aCB.toString ()); for (final IAjaxBeforeExecutionCallback aCB : aMgr.getBeforeExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("BeforeExecution", aCB.toString ()); for (final IAjaxAfterExecutionCallback aCB : aMgr.getAfterExecutionCallbacks ().getAllCallbacks ()) aTable.addBodyRow ().addCells ("AfterExecution", aCB.toString ()); for (final IAjaxLongRunningExecutionCallback aCB : aMgr.getLongRunningExecutionCallbacks () .getAllCallbacks ()) aTable.addBodyRow ().addCells ("LongRunningExecution", aCB.toString ()); aTab.addChild (aTable);