/** * 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 ()); }
private static void _timedSearch (@Nonnull final IThrowingRunnable <IOException> aRunnable, @Nonnull final Query aQuery) throws IOException { _timedSearch ( () -> { aRunnable.run (); return null; }, aQuery); }
public static final void onExecutionTimeExceeded (@Nonnull final String sMsg, @Nonnegative final long nExecutionMillis) { s_aExecutionTimeExceededHandlers.forEach (x -> x.onExecutionTimeExceeded (sMsg, nExecutionMillis)); }
@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)); }
@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; }
/** * Default constructor */ public SAXReaderSettings () { // Set default values setEntityResolver (SAXReaderDefaultSettings.getEntityResolver ()); setDTDHandler (SAXReaderDefaultSettings.getDTDHandler ()); setContentHandler (SAXReaderDefaultSettings.getContentHandler ()); setErrorHandler (SAXReaderDefaultSettings.getErrorHandler ()); setPropertyValues (SAXReaderDefaultSettings.getAllPropertyValues ()); setFeatureValues (SAXReaderDefaultSettings.getAllFeatureValues ()); exceptionCallbacks ().set (SAXReaderDefaultSettings.exceptionCallbacks ()); setRequiresNewXMLParserExplicitly (SAXReaderDefaultSettings.isRequiresNewXMLParserExplicitly ()); }
@Nonnull @ReturnsMutableCopy public CallbackList <IMicroEventTarget> getAllEventTargets (@Nullable final EMicroEvent eEvent) { return new CallbackList <> (m_aEventTargets == null ? null : m_aEventTargets.get (eEvent)); }
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); } }
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); }
@Nonnull public CompletableFuture <Void> run (@Nonnull final IThrowingRunnable <? extends Throwable> aRunnable) { return CompletableFuture.runAsync ( () -> { try { aRunnable.run (); } catch (final Throwable t) { LOGGER.error ("Error running AS4 runner " + aRunnable, t); } }, m_aES); }
/** * Constructor using the default settings from * {@link DOMReaderDefaultSettings}. */ public DOMReaderSettings () { // DocumentBuilderFactory setNamespaceAware (DOMReaderDefaultSettings.isNamespaceAware ()); setValidating (DOMReaderDefaultSettings.isValidating ()); setIgnoringElementContentWhitespace (DOMReaderDefaultSettings.isIgnoringElementContentWhitespace ()); setExpandEntityReferences (DOMReaderDefaultSettings.isExpandEntityReferences ()); setIgnoringComments (DOMReaderDefaultSettings.isIgnoringComments ()); setCoalescing (DOMReaderDefaultSettings.isCoalescing ()); setSchema (DOMReaderDefaultSettings.getSchema ()); setXIncludeAware (DOMReaderDefaultSettings.isXIncludeAware ()); setPropertyValues (DOMReaderDefaultSettings.getAllPropertyValues ()); setFeatureValues (DOMReaderDefaultSettings.getAllFeatureValues ()); // DocumentBuilder setEntityResolver (DOMReaderDefaultSettings.getEntityResolver ()); setErrorHandler (DOMReaderDefaultSettings.getErrorHandler ()); // Custom exceptionCallbacks ().set (DOMReaderDefaultSettings.exceptionCallbacks ()); setRequiresNewXMLParserExplicitly (DOMReaderDefaultSettings.isRequiresNewXMLParserExplicitly ()); }
public AbstractWritingJAXBBuilder (@Nonnull final IJAXBDocumentType aDocType) { super (aDocType); exceptionCallbacks ().add (new LoggingJAXBWriteExceptionHandler ()); }
@Nonnull public static final JPAExecutionResult <?> doInTransaction (@Nonnull @WillNotClose final EntityManager aEntityMgr, final boolean bAllowNestedTransactions, @Nonnull final IThrowingRunnable <Exception> aRunnable) { return doInTransaction (aEntityMgr, bAllowNestedTransactions, () -> { aRunnable.run (); return null; }); }
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); } }); } }
/** * Execute a callback with autosave being disabled. Must be called outside a * writeLock, as this method locks itself! * * @param aRunnable * The callback to be executed * @throws EXTYPE * In case of an error * @param <EXTYPE> * Exception type that may be thrown */ default <EXTYPE extends Exception> void performWithoutAutoSaveThrowing (@Nonnull final IThrowingRunnable <EXTYPE> aRunnable) throws EXTYPE { ValueEnforcer.notNull (aRunnable, "Runnable"); beginWithoutAutoSave (); try { aRunnable.run (); } finally { endWithoutAutoSave (); } }
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); } }); } }
@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 (); }
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 JAXBReaderBuilder (@Nonnull final IJAXBDocumentType aDocType, @Nonnull final Class <JAXBTYPE> aImplClass) { super (aDocType); m_aImplClass = ValueEnforcer.notNull (aImplClass, "ImplClass"); exceptionCallbacks ().add (new LoggingJAXBReadExceptionHandler ()); }