Enhancement #5537

Implement Variable.adaptPossible without throwing exceptions

Added by Tuukka Lehtonen over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:2014-12-09
Priority:4Due date:2015-01-16
Assignee:Tuukka Lehtonen% Done:

100%

Category:VariableSpent time:1.50 hour
Target version:1.18.1
Release notes:Developers: Variable.adaptPossible implementations should throw and catch as little exceptions as possible internally.
Tags: perf, variable
Story points-
Velocity based estimate-
ReleaseSimantics 1.18.1Release relationshipAuto

Description

Currently the only real implementation of Variable.adaptPossible is in AbstractVariable, which simply does

    @Override
    public <T> T adaptPossible(ReadGraph graph, Class<T> clazz) throws DatabaseException {
        try {
            return adapt(graph, clazz);
        } catch (AdaptionException e) {
            return null;
        }
    }

which causes the system to throw lots of exceptions in perfectly normal circumstances. This is suboptimal both from a performance and debugging standpoint.

From now on Variable implementations that provide special implementation for adapt must also provide the same implementation for adaptPossible. adaptPossible implementations must not invoke AbstractVariable.adaptPossible since that will only reroute the call back to adapt and cause unnecessary exceptions to be thrown.

Associated revisions

Revision 30664
Added by Tuukka Lehtonen over 2 years ago

Implemented adaptPossible without throwing exceptions in platform Variable implementations that provided some kind of implementation for Variable.adapt already.

From now on all Variable implementations providing adapt implementation must also implement adaptPossible without throwing exceptions.

refs #5537

History

#1 Updated by Tuukka Lehtonen over 2 years ago

  • Description updated (diff)

#2 Updated by Tuukka Lehtonen over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

#3 Updated by Tuukka Lehtonen over 2 years ago

  • Status changed from Resolved to Closed

#4 Updated by Tuukka Lehtonen over 2 years ago

  • Tags changed from variable to variable, perf
  • Release notes set to Developers: Variable.adaptPossible implementations should throw and catch as little exceptions as possible internally.

Also available in: Atom PDF