Details
-
Type:
Patch submission
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.4.4, 2.1.1
-
Fix Version/s: 2.1.2
-
Component/s: Core: Lifecycle, Core: Transports
-
Labels:None
-
Environment:
1.4.x trunk, Windows XP
-
Includes test case?:yes
-
User impact:Medium
-
Similar Issues:None
Description
org.mule.providers.AbstractConnector implements the basic lifecycle of a connector by defining several abstract methods (e.g., doInitialise, doConnect, doStart, doStop, doDisconnect, doDispose). These abstract methods should only called when the connector's state changes (i.e., calling AbstractConnector.startConnector twice results in the second call being a NOP).
Two issues:
1) AbstractConnector.initialise() throws an AlreadyInitialisedException if it is called when the connector has already been initialised. This behaviour is inconsistent with the way AbstractConnector.startConnector() and AbstractConnector.stopConnector() handle multiple calls (i.e., NOPs instead of exceptions). However, this patch does not address this difference as it's arguable which is the better behaviour.
2) AbstractConnector.dispose() does not throw an AlreadyDisposedException, nor does it perform a NOP if the connector is already disposed. Instead, it calls doDispose() regardless. It's a reasonable expection of a connector writer that doDispose() should only be called once. Because it is difficult to handle exceptions during disposal, it is understandable that no AlreadyDisposedException should be thrown; however, multiple disposal calls should be NOPs.
The attached patch changes AbstractConnector.dispose() so that it logs a message if the connector is already disposed instead of calling doDispose()