Class AbstractMessageEndpointFactory.AbstractMessageEndpoint
java.lang.Object
org.springframework.jca.endpoint.AbstractMessageEndpointFactory.AbstractMessageEndpoint
- All Implemented Interfaces:
jakarta.resource.spi.endpoint.MessageEndpoint
- Enclosing class:
AbstractMessageEndpointFactory
protected abstract class AbstractMessageEndpointFactory.AbstractMessageEndpoint
extends Object
implements jakarta.resource.spi.endpoint.MessageEndpoint
Inner class for actual endpoint implementations, based on template
method to allow for any kind of concrete endpoint implementation.
- Since:
- 2.5
- Author:
- Juergen Hoeller
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThisafterDeliveryimplementation resets the thread context ClassLoader and completes the transaction, if any.voidbeforeDelivery(@Nullable Method method) ThisbeforeDeliveryimplementation starts a transaction, if necessary, and exposes the endpoint ClassLoader as current thread context ClassLoader.protected abstract ClassLoaderTemplate method for exposing the endpoint's ClassLoader (typically the ClassLoader that the message listener class has been loaded with).protected final booleanReturn whether thebeforeDelivery(Method)method of this endpoint has already been called.protected voidCallback method for notifying the endpoint base class that the concrete endpoint invocation led to an exception.voidrelease()
-
Constructor Details
-
AbstractMessageEndpoint
protected AbstractMessageEndpoint()
-
-
Method Details
-
beforeDelivery
ThisbeforeDeliveryimplementation starts a transaction, if necessary, and exposes the endpoint ClassLoader as current thread context ClassLoader.Note that the JCA 1.7 specification does not require a ResourceAdapter to call this method before invoking the concrete endpoint. If this method has not been called (check
hasBeforeDeliveryBeenCalled()), the concrete endpoint method should callbeforeDeliveryand its siblingafterDelivery()explicitly, as part of its own processing.- Specified by:
beforeDeliveryin interfacejakarta.resource.spi.endpoint.MessageEndpoint- Throws:
jakarta.resource.ResourceException
-
getEndpointClassLoader
Template method for exposing the endpoint's ClassLoader (typically the ClassLoader that the message listener class has been loaded with).- Returns:
- the endpoint ClassLoader (never
null)
-
hasBeforeDeliveryBeenCalled
protected final boolean hasBeforeDeliveryBeenCalled()Return whether thebeforeDelivery(Method)method of this endpoint has already been called. -
onEndpointException
Callback method for notifying the endpoint base class that the concrete endpoint invocation led to an exception.To be invoked by subclasses in case of the concrete endpoint throwing an exception.
- Parameters:
ex- the exception thrown from the concrete endpoint
-
afterDelivery
public void afterDelivery() throws jakarta.resource.ResourceExceptionThisafterDeliveryimplementation resets the thread context ClassLoader and completes the transaction, if any.Note that the JCA 1.7 specification does not require a ResourceAdapter to call this method after invoking the concrete endpoint. See the explanation in
beforeDelivery(Method)'s javadoc.- Specified by:
afterDeliveryin interfacejakarta.resource.spi.endpoint.MessageEndpoint- Throws:
jakarta.resource.ResourceException
-
release
public void release()- Specified by:
releasein interfacejakarta.resource.spi.endpoint.MessageEndpoint
-