public abstract class ClusterAwareConcurrentListener extends WmNotificationListener implements WmRequiresConnection
WmConnectedListener
, since it relies on managed connection object to
perform event retrieval and notification execution. This class has additional
features to recognize the presence of a cluster and to execute the
notifications in a concurrent way. Adapters developers should extend this
base class instead of WmConnectedListener
to make their listeners
cluster aware and to process notifications concurrently.
This listener may share a connection object or assign a brand new connection
object from the pool to each worker thread which tries to receive the backend
events, depending on the connection type. Also, this listener will coordinate
the runtime state across all nodes of a cluster if present, to support fail
over mechanism and the parallel execution of listener threads on all nodes._lastError, _listenerNodeName, _retryCount, _statistics
Constructor and Description |
---|
ClusterAwareConcurrentListener() |
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
adapterCheckValue(java.lang.String serviceName,
java.lang.String resourceDomainName,
java.lang.String[][] values,
java.lang.String testValue)
Checks a resourceDomain value.
|
ResourceDomainValues[] |
adapterResourceDomainLookup(java.lang.String serviceName,
java.lang.String resourceDomainName,
java.lang.String[][] values)
Looks up values for a resourceDomain.
|
protected void |
beginTransaction()
Sets up a transaction.
|
protected void |
checkTransaction()
Called to ensure no transaction is currently associated with this Thread.
|
protected void |
commit()
Commits the current transaction.
|
void |
discoverParameters(AdapterParameters ap)
Does a double-dispatch to the AdapterParameters object.
|
protected void |
doShutdown()
Method to delegate the shutdown mechanism to the individual adapters.
|
void |
execute()
Execution logic from this class is within the thread created by the
listener node, but it overrides the parent's behavior by implementing
multi threaded execution of notifications.
|
java.lang.String |
getConnDataNodeName() |
void |
listenerShutdown()
Method called to shut down a listener.
|
void |
listenerStartup()
Method called to bring up a listener.
|
void |
notifyEvent(int et)
Called to propogate the listener lifecycle events of startup,
copy, update, delete.
|
void |
registerResourceDomain(WmAdapterAccess access)
Sets a reference to the
WmAdapterAccess object. |
protected void |
resetRetryCount()
resets the retry counter.
|
WmManagedConnection |
retrieveConnection()
Method to retrieve the connection associated with this listener.
|
protected void |
rollback()
Rolls back the current transaction.
|
void |
runListener()
Method which provides the actual implementation of multi threaded
execution of notifications.
|
void |
setConnDataNodeName(java.lang.String val) |
void |
useConnection(WmManagedConnection connection) |
java.lang.Object |
waitForData()
Adapters must override this method to fetch the events from the backend.
|
cleanup, createNotificationEvent, fillWmDescriptor, fillWmUIDescriptor, getLastError, getLastErrorMessage, getListenerNode, getLoggableName, getRegisteredNotifications, getStatistics, handleFatalException, handleRecoverableException, initialize, initListenerNodeProperties, logCallback, logDebugPlus, logDebugPlusNamed, logDebugPlusNamed, makeDetailedException, makeDetailedException, makeDetailedException, makeDetailedException, processNotification, processNotificationResults, registerNotification, resourceDomainLookup, restrictNotificationTypes, run, runNotifications, setRegisteredNotifications, setup, unregisterNotification
public java.lang.Boolean adapterCheckValue(java.lang.String serviceName, java.lang.String resourceDomainName, java.lang.String[][] values, java.lang.String testValue) throws AdapterException
WmNotificationListener
Boolean.TRUE
if
testValue is valid in this context, Boolean.FALSE
if it is
not valid, or null
if the value can't be confirmed by the
adapter.
Implement this method if your adapter supports resourceDomains. Return
null
if you are not able to confirm the value. Otherwise,
return Boolean.TRUE
if the value is valid, or
Boolean.FALSE
if the value is not valid.
When a user types a value into the operation editor that is displaying
an incomplete resourceDomain (ResourceDomainValues
.complete
is false)
and the ResourceDomainValues
.canValidate
flag is true.
adapterCheckValue
in interface ResourceDomainDataProvider
adapterCheckValue
in class WmNotificationListener
serviceName
- the name of the service templateresourceDomainName
- the name of the resourceDomainvalues
- the values for the resourceDomain parameterstestValue
- the value to testBoolean.TRUE
if testValue
is valid
in this context, Boolean.FALSE
if it is not
valid, or null
if the value can't be confirmed
by the adapter.AdapterException
- if something went wrongpublic ResourceDomainValues[] adapterResourceDomainLookup(java.lang.String serviceName, java.lang.String resourceDomainName, java.lang.String[][] values) throws AdapterException
WmNotificationListener
ResourceDomainValues
class with the proper data. Return multiple classes
if you are using tuples.adapterResourceDomainLookup
in interface ResourceDomainDataProvider
adapterResourceDomainLookup
in class WmNotificationListener
serviceName
- the name of the service/notification templateresourceDomainName
- the name of the resourceDomainvalues
- the values for the resourceDomain parametersAdapterException
- if something went wrongprotected void beginTransaction() throws javax.resource.ResourceException
WmNotificationListener
beginTransaction
in class WmNotificationListener
javax.resource.ResourceException
protected void checkTransaction() throws javax.resource.ResourceException
WmNotificationListener
checkTransaction
in class WmNotificationListener
javax.resource.ResourceException
protected void commit() throws javax.resource.ResourceException
WmNotificationListener
commit
in class WmNotificationListener
javax.resource.ResourceException
public void discoverParameters(AdapterParameters ap) throws AdapterException
WmNotificationListener
discoverParameters
in class WmNotificationListener
AdapterException
protected void doShutdown()
doShutdown
in class WmNotificationListener
public void execute()
execute
in class WmNotificationListener
public java.lang.String getConnDataNodeName()
public void listenerShutdown()
listenerShutdown
in class WmNotificationListener
public void listenerStartup() throws javax.resource.ResourceException
listenerStartup
in class WmNotificationListener
javax.resource.ResourceException
- an instance of AdapterException for a non-recoverable error
or AdapterConnectionException for a recoverable connection-based errorpublic void notifyEvent(int et) throws com.wm.pkg.art.error.DetailedException
WmNotificationListener
notifyEvent
in class WmNotificationListener
et
- The type of event that just occured. It must match one of the
constants NOTIFY_UPDATE, NOTIFY_DELETE, NOTIFY_INIT, NOTIFY_STARTUP,
NOTIFY_SHUTDOWN, NOTIFY_ENABLE, NOTIFY_DISABLEcom.wm.pkg.art.error.DetailedException
public void registerResourceDomain(WmAdapterAccess access) throws AdapterException
WmNotificationListener
WmAdapterAccess
object. Will be called
after the constructor has been called, but before any
properties are set. The reference to WmAdapterAccess should be
stored for later use, if needed.
Register resourceDomain, using
addResourceDomainLookup
,
addResourceDomain
, etc.) in this method.
registerResourceDomain
in interface ResourceDomainDataProvider
registerResourceDomain
in class WmNotificationListener
access
- reference to WmAdapterAccess objectAdapterException
- something went wrongprotected void resetRetryCount()
resetRetryCount
in class WmNotificationListener
public WmManagedConnection retrieveConnection()
retrieveConnection
in interface WmRequiresConnection
WmNotification
protected void rollback() throws javax.resource.ResourceException
WmNotificationListener
rollback
in class WmNotificationListener
javax.resource.ResourceException
public void runListener() throws java.lang.Throwable
runListener
in class WmNotificationListener
javax.resource.ResourceException
- if a processing error has occuredjava.lang.Throwable
public void setConnDataNodeName(java.lang.String val)
public void useConnection(WmManagedConnection connection)
useConnection
in interface WmRequiresConnection
public java.lang.Object waitForData() throws javax.resource.ResourceException
waitForData
in class WmNotificationListener
javax.resource.ResourceException
- an instance of AdapterException for a non-recoverable error
or AdapterConnectionException for a recoverable connection-based error
Copyright © 2003 - 2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.