use of org.apache.jackrabbit.core.data.AsyncTouchResult in project jackrabbit by apache.
the class S3Backend method touchAsync.
@Override
public void touchAsync(final DataIdentifier identifier, final long minModifiedDate, final AsyncTouchCallback callback) throws DataStoreException {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
if (callback == null) {
throw new IllegalArgumentException("callback parameter cannot be null in touchAsync");
}
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
getAsyncWriteExecutor().execute(new Runnable() {
@Override
public void run() {
try {
touch(identifier, minModifiedDate);
callback.onSuccess(new AsyncTouchResult(identifier));
} catch (DataStoreException e) {
AsyncTouchResult result = new AsyncTouchResult(identifier);
result.setException(e);
callback.onFailure(result);
}
}
});
} catch (Exception e) {
callback.onAbort(new AsyncTouchResult(identifier));
throw new DataStoreException("Cannot touch the record " + identifier.toString(), e);
} finally {
if (contextClassLoader != null) {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
}
use of org.apache.jackrabbit.core.data.AsyncTouchResult in project jackrabbit-oak by apache.
the class S3Backend method touchAsync.
@Override
public void touchAsync(final DataIdentifier identifier, final long minModifiedDate, final AsyncTouchCallback callback) throws DataStoreException {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
if (callback == null) {
throw new IllegalArgumentException("callback parameter cannot be null in touchAsync");
}
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
asyncWriteExecuter.execute(new Runnable() {
@Override
public void run() {
try {
touch(identifier, minModifiedDate);
callback.onSuccess(new AsyncTouchResult(identifier));
} catch (DataStoreException e) {
AsyncTouchResult result = new AsyncTouchResult(identifier);
result.setException(e);
callback.onFailure(result);
}
}
});
} catch (Exception e) {
if (callback != null) {
callback.onAbort(new AsyncTouchResult(identifier));
}
throw new DataStoreException("Cannot touch the record " + identifier.toString(), e);
} finally {
if (contextClassLoader != null) {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
}
Aggregations