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 theRemoteIterator
API, that isRemoteIterator.drop()
being replaced byRemoteIterator.close()
. Both methods throwingIOException
instead 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 void
close(RemoteIterator<?> ri, Throwable thrown)
Tries to close the designatedRemoteIterator
by trying the legacy methodRemoteIterator.drop()
if appropriate since the designatedThrowable
indicates thatRemoteIterator.close()
does not exist.static Throwable
unwrap(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 ofCommunicationStackException
s. The returned exception will be the first throwable that is not one of the unwrapped ones. Ifnull
is wrapped,- Parameters:
ute
- TheUndeclaredThrowableException
thrown from the invocation.- Returns:
- The throwable wrapped within
UndeclaredThrowableException
and/orCommunicationStackException
or the innermostUndeclaredThrowableException
orCommunicationStackException
that wrapsnull
.
-
close
public static void close(RemoteIterator<?> ri, Throwable thrown) throws DataSourceException, IOException
Tries to close the designatedRemoteIterator
by trying the legacy methodRemoteIterator.drop()
if appropriate since the designatedThrowable
indicates 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 designatedthrown
is a (wrapped)DataSourceException
, this will be forwarded directly without callingRemoteIterator.drop()
. If not, this may be theDataSourceException
thrown byRemoteIterator.drop()
.IOException
- If the designatedthrown
is a (wrapped)IOException
, this will be forwarded directly without callingRemoteIterator.drop()
. If not, this may be theIOException
thrown byRemoteIterator.drop()
.de.aristaflow.adept2.model.communication.ServiceConnectionException
- If an exception is unwrapped from anUndeclaredThrowableException
that is aDataSourceException
nor anIOException
this exception will be wrapped in aServiceConnectionException
.
-
-