|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.server.ReconnectRuleEngine
public class ReconnectRuleEngine
This class decides what to do when a connector raises an error. Possible actions are to attempt a reconnect or leave the error unhandled and let further mechanisms process it.
The class makes decisions based on configured rules. Each rule describes what should be done when an error occurs. Each rule applies to certain connectors and certain errors. In a rule the connectors are described by their base Java class and their name in the current configuration. (there are match-all options for both the class and the name of the connector). A rule describes applicable errors by their base Java class and a regular expression that matches their messages (the regular expression is optional).
The reconnect engine holds two collections of rules: in-built rules and user-defined rules.
The in-built rules are defined in an '.inf' file in the jar file of the corresponding connector. They are specific to that connector class. In order to preserver the reconnect behaviour, which existed before the introduction of ReconnectRuleEngine, when the engine is created, it implicitly adds to the in-built rules rules, which prescribe to attempt reconnect on all IOException-s and all CommunicationException-s.
The user defined rules reside in an external text file.
Field Summary | |
---|---|
static int |
ERROR
the situation is a fatal error which no reconnect could fix |
static java.lang.String |
ERROR_STRING
error action - no reconnect will be attempted |
static int |
INVALID_RECONNECT_ACTION
invalid reconnect action |
static int |
RECONNECT
reconnect should be attempted to fix the error situation |
static char |
RECONNECT_RULE_PARTS_DELIMETER
the delimiter of the parts of a rule in the config file |
static java.lang.String |
RECONNECT_STRING
reconnect action - if an error occurs reconnect will be attempted |
Constructor Summary | |
---|---|
ReconnectRuleEngine(Log log)
Constructor, which loads the in-built rules and the user-defined rules. |
Method Summary | |
---|---|
int |
getReconnectChoice(ConnectorInterface connector,
java.lang.Throwable error)
This method prescribes a response action for a given error situation. |
void |
loadRules(java.lang.String userDefinedRulesFilePath,
MetamergeConfig sysConfig)
Loads the in-built and the user-defined rules. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int INVALID_RECONNECT_ACTION
public static final int ERROR
public static final int RECONNECT
public static final char RECONNECT_RULE_PARTS_DELIMETER
public static final java.lang.String ERROR_STRING
public static final java.lang.String RECONNECT_STRING
Constructor Detail |
---|
public ReconnectRuleEngine(Log log)
log
- a log object to be used during the lifetime of the engineMethod Detail |
---|
public void loadRules(java.lang.String userDefinedRulesFilePath, MetamergeConfig sysConfig) throws java.lang.Exception
userDefinedRulesFilePath
- the file with user-defined rulessysConfig
- system configuration object, which has the in-built rules of
all connectors
java.lang.Exception
- problem while parsing the configured rules
ClassNotFoundException problem while loading an
exception/connector class, specified in a rulepublic int getReconnectChoice(ConnectorInterface connector, java.lang.Throwable error)
This method prescribes a response action for a given error situation.
First searches the user-defined rules and if no matching rule is found,
the method searches the Connector own rules. If a rule cannot be found in
either collection, the default action (ERROR
) is
prescribed.
When a collection (in-built or user-defined) is searched for a matching
rule, first is sought a match for the error itself. If no match is found
for the error and the error has a specified cause (getCause()
returns non-null) then a match for the cause is searched. Only when both
searched fail, another collection of rules is considered.
connector
- the connector, which raised the errorerror
- the error object
ERROR
or RECONNECT
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |