+ requestManager.scheduleRead(new SessionRead(null, notify) {
+
+ @Override
+ public void run0(int thread) {
+
+ fireSessionVariableChange(SessionVariables.QUEUED_READS);
+
+ ITask task = ThreadLogger.task(request);
+
+ final ReadGraphImpl newGraph = ReadGraphImpl.create(getQueryProvider2());
+ newGraph.asyncBarrier.inc();
+
+ try {
+
+ if (listener != null) {
+
+ try {
+ QueryCacheBase.resultAsyncReadEntry(newGraph, request, null, listener, procedure);
+ } catch (DatabaseException e) {
+ LOGGER.error("Unhandled query exception", e);
+ }
+
+ } else {
+
+ BlockingAsyncProcedure<T> wrap = new BlockingAsyncProcedure<T>(newGraph, null, procedure, request, true) {
+
+ public void execute(AsyncReadGraph graph_, T result) {
+ task.finish();
+ super.execute(graph_, result);
+ }
+
+ public void exception(AsyncReadGraph graph_, Throwable t) {
+ task.finish();
+ super.exception(graph_, t);
+ }
+
+ };
+
+ try {
+ wrap.performSync(request);
+ } catch (DatabaseException e) {
+ LOGGER.error("Unhandled query exception", e);
+ }
+
+ }
+
+ } finally {
+
+ newGraph.asyncBarrier.dec();
+
+ fireSessionVariableChange(SessionVariables.QUEUED_READS);
+
+ }
+
+ }
+
+ });
+
+ }
+
+ public <T> void scheduleRequest(final MultiRead<T> request, final SyncMultiProcedure<T> procedure, final Semaphore notify) {
+
+ assert (request != null);
+ assert (procedure != null);
+
+ int thread = request.hashCode() & queryProvider2.THREAD_MASK;
+
+ int sync = notify != null ? thread : -1;
+
+ requestManager.scheduleRead(new SessionRead(null, notify) {