Browse files

change native source from jar to classes

  • Loading branch information...
1 parent 5dc3f21 commit aa23ddc597609b58863824d1fe58909ad02087da Maysam Yabandeh committed May 24, 2012
Showing with 6 additions and 27 deletions.
  1. +5 −26 src/main/java/com/yahoo/omid/client/TSOClient.java
  2. +1 −1 src/main/native/Makefile
View
31 src/main/java/com/yahoo/omid/client/TSOClient.java
@@ -506,7 +506,9 @@ public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e)
}
}
- //In the new implementation, I need direct access to commit timestamp and the logic for deciding the committed version is more complex. Therefero, this function replaces validRead.
+ //In the new implementation, I need direct access to commit timestamp and the logic for deciding
+ // the committed version is more complex. Therefero, this function replaces validRead.
+ // validRead could still be used if only validity of the version matters, like in tests
public long commitTimestamp(long transaction, long startTimestamp) throws IOException {
if (aborted.contains(transaction))
return -2;//invalid read
@@ -538,31 +540,8 @@ public long commitTimestamp(long transaction, long startTimestamp) throws IOExce
}
public boolean validRead(long transaction, long startTimestamp) throws IOException {
- if (transaction == startTimestamp)
- return true;
- if (aborted.contains(transaction))
- return false;
- long commitTimestamp = committed.getCommit(transaction);
- if (commitTimestamp != -1)
- return commitTimestamp <= startTimestamp;
- if (hasConnectionTimestamp && transaction > connectionTimestamp)
- return transaction <= largestDeletedTimestamp;
- if (transaction <= largestDeletedTimestamp)
- return true;
- // System.out.format("Asking TSO... hasConnectionTimestamp: %s connectionTimestamp: %d transaction: %d startTimestamp: %d\n",
- // Boolean.valueOf(hasConnectionTimestamp).toString(), connectionTimestamp, transaction, startTimestamp);
- askedTSO++;
- SyncCommitQueryCallback cb = new SyncCommitQueryCallback();
- isCommitted(startTimestamp, transaction, cb);
- try {
- cb.await();
- } catch (InterruptedException e) {
- throw new IOException("Commit query didn't complete", e);
- }
- if (!cb.isAClearAnswer())
- //TODO: throw a proper exception
- throw new IOException("Either abort or retry the transaction");
- return cb.isCommitted();
+ long Tc = commitTimestamp(transaction, startTimestamp);
+ return (Tc != -2);
}
/**
View
2 src/main/native/Makefile
@@ -48,7 +48,7 @@ $(TSO_COMMITHASHMAP_SO): nativelib.o $(DEP_LIBS)
$(LDSHARED) -o $@ $(LDFLAGS) nativelib.o $(LIBS)
com_yahoo_omid_tso_CommitHashMap.h: nativelib.cc
- javah -classpath ../../../target/omid-1.0-SNAPSHOT.jar -jni com.yahoo.omid.tso.CommitHashMap
+ javah -classpath ../../../target/classes -jni com.yahoo.omid.tso.CommitHashMap
clean:
rm -f nativelib.o $(TSO_COMMITHASHMAP_SO)

0 comments on commit aa23ddc

Please sign in to comment.