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 theRemoteIteratorAPI, that isRemoteIterator.drop()being replaced byRemoteIterator.close(). Both methods throwingIOExceptioninstead ofDataSourceException, which also applies toRemoteIterator.keepAlive(long).
-
-
Constructor Summary
Constructors Constructor Description LegacyHandling()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Throwableunwrap(UndeclaredThrowableException ute)Unwraps the throwable of the designatedUndeclaredThrowableException.
-
-
-
Method Detail
-
unwrap
public static Throwable unwrap(UndeclaredThrowableException ute)
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.
-
-