}
-// public synchronized void stopRead(int thread) {
-//
-// try {
-// transactionState.stopReadTransaction();
-// } catch (DatabaseException e) {
-// e.printStackTrace();
-// }
-//
-// }
-
public synchronized void startWrite(int thread, final SessionTask task) {
- session.queryProvider2.scheduleAlways(thread, new SessionTask((WriteTraits)task.object, task.thread) {
+ session.queryProvider2.schedule(new SessionTask(true) {
@Override
public void run(int thread) {
public <T, C> T adapt(ReadGraph g, Resource r, C context, Class<C> contextClass, Class<T> targetClass, boolean possible) throws DatabaseException {
Adapter<T,C> adapter = getAdapter(g, r, context, contextClass, targetClass, possible);
+ if(adapter == null) return null;
- SyncReadProcedure<T> procedure = new SyncReadProcedure<T>();
- adapter.adapt(g, r, context, procedure);
- procedure.checkAndThrow();
- return procedure.result;
+ BlockingAsyncProcedure<T> ap = new BlockingAsyncProcedure<T>(g, null, adapter);
-
-// SyncReadProcedure<T> procedure = new SyncReadProcedure<T>();
+ adapter.adapt(g, r, context, ap);
-
+ return ap.get();
-// procedure.checkAndThrow();
-// return procedure.result;
}
QueryDebug debug = session.getService(QueryDebug.class);
class Request implements AsyncMultiRead<Object> {
- @Override
- public int threadHash() {
- return hashCode();
- }
+
++// @Override
++// public int threadHash() {
++// return hashCode();
++// }
@Override
public void perform(AsyncReadGraph graph, AsyncMultiProcedure<Object> callback) {