JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-3062

org.mule.providers.AbstractConnector allows connector to be disposed of multiple times.

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Patch submission Patch submission
  • Status: Closed Closed
  • Priority: Major 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()

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    MulePatch.zip
    03/Mar/08 07:20 PM
    29 kB
    Stirling Chow
    1. Java Source File
      MulePatch/src/.../AbstractConnectorTest.java 5 kB
    2. Java Source File
      MulePatch/src/.../AbstractConnector.java 61 kB
    3. XML File
      MulePatch/.../TEST-org.mule.providers.AbstractConnectorTest.xml 9 kB
    4. Java Source File
      MulePatch/src/.../TestConnector.java 1 kB
    5. File
      MulePatch/bin/.../AbstractConnector.class 26 kB
    6. XML File
      MulePatch/build.xml 2 kB
    7. File
      MulePatch/bin/.../TestConnector.class 1 kB
    8. File
      MulePatch/.../AbstractConnectorTest.class 2 kB
    Download Zip
    Show
    Zip Archive
    MulePatch.zip
    03/Mar/08 07:20 PM
    29 kB
    Stirling Chow

Issue Links

relates to

Improvement - An improvement or enhancement to an existing feature or task. MULE-2980 Connector lifecycle needs clarification

  • Minor - Minor loss of function, or other problem where easy workaround is present.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Task - A task that needs to be done. MULE-3679 Review connector lifecyle

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
Stirling Chow added a comment - 03/Mar/08 07:47 PM

Junit test and patch attached.

1) Unzip MulePatch.zip
2) Edit build.xml to set mule.home to your Mule installation
3) Run "ant test-broken" to run the Junit test with the unpatched code. Observe that one of the tests fails and consult test-report for details.
4) Run "ant test-fixed" to run Junit test with patched code and observer that all tests pass.

Show
Stirling Chow added a comment - 03/Mar/08 07:47 PM Junit test and patch attached. 1) Unzip MulePatch.zip 2) Edit build.xml to set mule.home to your Mule installation 3) Run "ant test-broken" to run the Junit test with the unpatched code. Observe that one of the tests fails and consult test-report for details. 4) Run "ant test-fixed" to run Junit test with patched code and observer that all tests pass.
Hide
Permalink
Travis Carlson added a comment - 20/Nov/08 07:01 AM

I believe the LifecycleManager automatically checks for this in Mule 2.x, please re-open if this is not the case.

Show
Travis Carlson added a comment - 20/Nov/08 07:01 AM I believe the LifecycleManager automatically checks for this in Mule 2.x, please re-open if this is not the case.
Hide
Permalink
Travis Carlson added a comment - 20/Nov/08 07:42 AM

Ran the test case and it still fails as of 2.1.1

Show
Travis Carlson added a comment - 20/Nov/08 07:42 AM Ran the test case and it still fails as of 2.1.1
Hide
Permalink
Travis Carlson added a comment - 20/Nov/08 10:13 AM

http://fisheye.codehaus.org/changelog/mule/?cs=13397

Incorporated test case and expanded fix to cover all lifecycle methods of the connector.

Thanks for the test case + patch Stirling, sorry it took so long to get them incorporated!

Show
Travis Carlson added a comment - 20/Nov/08 10:13 AM http://fisheye.codehaus.org/changelog/mule/?cs=13397 Incorporated test case and expanded fix to cover all lifecycle methods of the connector. Thanks for the test case + patch Stirling, sorry it took so long to get them incorporated!

People

  • Assignee:
    Travis Carlson
    Reporter:
    Stirling Chow
Vote (0)
Watch (0)

Dates

  • Created:
    03/Mar/08 07:19 PM
    Updated:
    20/Nov/08 10:13 AM
    Resolved:
    20/Nov/08 10:13 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.