Class LegacyHandling
java.lang.Object
de.aristaflow.adept2.model.common.collection.LegacyHandling
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose(RemoteIterator<?> ri, Throwable thrown) Tries to close the designatedRemoteIteratorby trying the legacy methodRemoteIterator.drop()if appropriate since the designatedThrowableindicates thatRemoteIterator.close()does not exist.static ThrowableUnwraps the throwable of the designatedUndeclaredThrowableException.
-
Constructor Details
-
LegacyHandling
public LegacyHandling()
-
-
Method Details
-
unwrap
Unwraps the throwable of the designatedUndeclaredThrowableException. This will also unwrap causes ofCommunicationStackExceptions. The returned exception will be the first throwable that is not one of the unwrapped ones. Ifnullis wrapped,- Parameters:
ute- TheUndeclaredThrowableExceptionthrown from the invocation.- Returns:
- The throwable wrapped within
UndeclaredThrowableExceptionand/orCommunicationStackExceptionor the innermostUndeclaredThrowableExceptionorCommunicationStackExceptionthat wrapsnull.
-
close
public static void close(RemoteIterator<?> ri, Throwable thrown) throws DataSourceException, IOException Tries to close the designatedRemoteIteratorby trying the legacy methodRemoteIterator.drop()if appropriate since the designatedThrowableindicates thatRemoteIterator.close()does not exist.- Parameters:
ri- The remote iterator to close.thrown- The exception that occurred when callingRemoteIterator.close()on the designated remote iterator, usually aUndeclaredThrowableException.- Throws:
DataSourceException- If the designatedthrownis a (wrapped)DataSourceException, this will be forwarded directly without callingRemoteIterator.drop(). If not, this may be theDataSourceExceptionthrown byRemoteIterator.drop().IOException- If the designatedthrownis a (wrapped)IOException, this will be forwarded directly without callingRemoteIterator.drop(). If not, this may be theIOExceptionthrown byRemoteIterator.drop().de.aristaflow.adept2.model.communication.ServiceConnectionException- If an exception is unwrapped from anUndeclaredThrowableExceptionthat is aDataSourceExceptionnor anIOExceptionthis exception will be wrapped in aServiceConnectionException.
-