Petals CDK

Add a method to get timeout value if set or its default value

Details

  • Type: Improvement Request Improvement Request
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 5.6.1
  • Fix Version/s: 5.6.2
  • Component/s: configuration
  • Security Level: Public
  • Description:
    Hide

    At an external listener implementation level, to get the consumer timeout value set, it is needed to get it from the class Consumes, and NPE can occurs when converting from Long to long.
    The method getDefaultTimeoutFrom of AbstractListener contains a private method to get the timeout value set on a consumer or a provider, and if not set, a default timeout value is used.
    So, it should be interesting to change the visibility of AbstractListener.getDefaultTimeoutFrom(...) to public, so instead of:

    long timeout = this.restExternalListener.getConsumes().getTimeout(); --> NPE if no timeout set

    we can use something as:

    long timeout = this.restExternalListener.getTimeout(this.restExternalListener.getConsumes());  --> No NPE if no timeout set, a default value is returned
    Show
    At an external listener implementation level, to get the consumer timeout value set, it is needed to get it from the class Consumes, and NPE can occurs when converting from Long to long. The method getDefaultTimeoutFrom of AbstractListener contains a private method to get the timeout value set on a consumer or a provider, and if not set, a default timeout value is used. So, it should be interesting to change the visibility of AbstractListener.getDefaultTimeoutFrom(...) to public, so instead of:
    long timeout = this.restExternalListener.getConsumes().getTimeout(); --> NPE if no timeout set
    we can use something as:
    long timeout = this.restExternalListener.getTimeout(this.restExternalListener.getConsumes());  --> No NPE if no timeout set, a default value is returned
  • Environment:
    -

Issue Links

Activity

Hide
Christophe DENEUX added a comment - Fri, 24 Feb 2017 - 12:30:59 +0100

Visibility of method changed, and method renamed into getTimeout(...)

Show
Christophe DENEUX added a comment - Fri, 24 Feb 2017 - 12:30:59 +0100 Visibility of method changed, and method renamed into getTimeout(...)

People

Dates

  • Created:
    Fri, 24 Feb 2017 - 12:28:59 +0100
    Updated:
    Fri, 24 Feb 2017 - 12:36:11 +0100
    Resolved:
    Fri, 24 Feb 2017 - 12:30:59 +0100