Class LegacyHandling

java.lang.Object
de.aristaflow.adept2.model.common.collection.LegacyHandling

public class LegacyHandling extends Object
This class handles problems with API changes of the RemoteIterator API, that is RemoteIterator.drop() being replaced by RemoteIterator.close(). Both methods throwing IOException instead of DataSourceException, which also applies to RemoteIterator.keepAlive(long).
  • Constructor Details

    • LegacyHandling

      public LegacyHandling()
  • Method Details

    • unwrap

      public static Throwable unwrap(UndeclaredThrowableException ute)
      Unwraps the throwable of the designated UndeclaredThrowableException. This will also unwrap causes of CommunicationStackExceptions. The returned exception will be the first throwable that is not one of the unwrapped ones. If null is wrapped,
      Parameters:
      ute - The UndeclaredThrowableException thrown from the invocation.
      Returns:
      The throwable wrapped within UndeclaredThrowableException and/or CommunicationStackException or the innermost UndeclaredThrowableException or CommunicationStackException that wraps null.
    • close

      public static void close(RemoteIterator<?> ri, Throwable thrown) throws DataSourceException, IOException
      Tries to close the designated RemoteIterator by trying the legacy method RemoteIterator.drop() if appropriate since the designated Throwable indicates that RemoteIterator.close() does not exist.
      Parameters:
      ri - The remote iterator to close.
      thrown - The exception that occurred when calling RemoteIterator.close() on the designated remote iterator, usually a UndeclaredThrowableException.
      Throws:
      DataSourceException - If the designated thrown is a (wrapped) DataSourceException, this will be forwarded directly without calling RemoteIterator.drop(). If not, this may be the DataSourceException thrown by RemoteIterator.drop().
      IOException - If the designated thrown is a (wrapped) IOException, this will be forwarded directly without calling RemoteIterator.drop(). If not, this may be the IOException thrown by RemoteIterator.drop().
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If an exception is unwrapped from an UndeclaredThrowableException that is a DataSourceException nor an IOException this exception will be wrapped in a ServiceConnectionException.