diff --git a/pom.xml b/pom.xml
index 7059b65..bdc91e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
net.helenus
helenus-core
- 2.0.11-SNAPSHOT
+ 2.0.12-SNAPSHOT
jar
helenus
diff --git a/src/main/java/net/helenus/core/UnitOfWork.java b/src/main/java/net/helenus/core/UnitOfWork.java
index 61c6dd3..b0a675c 100644
--- a/src/main/java/net/helenus/core/UnitOfWork.java
+++ b/src/main/java/net/helenus/core/UnitOfWork.java
@@ -10,56 +10,58 @@ import java.util.function.Function;
*/
public class UnitOfWork {
- private final HelenusSession session;
- private ArrayList nested;
+ private final HelenusSession session;
+ private ArrayList nested;
- UnitOfWork(HelenusSession session) {
- this.session = session;
- // log.record(txn::start)
- }
+ UnitOfWork(HelenusSession session) {
+ this.session = session;
+ // log.record(txn::start)
+ }
- /**
- * Marks the beginning of a transactional section of work. Will write a record
- * to the shared write-ahead log.
- *
- * @return the handle used to commit or abort the work.
- */
- public UnitOfWork begin() {
- if (nested == null) {
- nested = new ArrayList();
- }
- UnitOfWork unitOfWork = new UnitOfWork(session);
- nested.add(unitOfWork);
- return unitOfWork;
- }
+ /**
+ * Marks the beginning of a transactional section of work. Will write a record
+ * to the shared write-ahead log.
+ *
+ * @return the handle used to commit or abort the work.
+ */
+ public UnitOfWork begin() {
+ if (nested == null) {
+ nested = new ArrayList();
+ }
+ UnitOfWork unitOfWork = new UnitOfWork(session);
+ nested.add(unitOfWork);
+ return unitOfWork;
+ }
- /**
- * Checks to see if the work performed between calling begin and now can be
- * committed or not.
- *
+ /**
+ * Checks to see if the work performed between calling begin and now can be
+ * committed or not.
+ *
* @return a function from which to chain work that only happens when commit is successful
- * @throws ConflictingUnitOfWorkException
- * when the work overlaps with other concurrent writers.
- */
- public Function commit() throws ConflictingUnitOfWorkException {
- nested.forEach((uow) -> Errors.rethrow().wrap(uow::commit));
- // log.record(txn::provisionalCommit)
- // examine log for conflicts in read-set and write-set between begin and provisional commit
- // if (conflict) { throw new ConflictingUnitOfWorkException(this) }
+ * @throws ConflictingUnitOfWorkException when the work overlaps with other concurrent writers.
+ */
+ public Function commit() throws ConflictingUnitOfWorkException {
+ if (nested != null) {
+ nested.forEach((uow) -> Errors.rethrow().wrap(uow::commit));
+ }
+ // log.record(txn::provisionalCommit)
+ // examine log for conflicts in read-set and write-set between begin and provisional commit
+ // if (conflict) { throw new ConflictingUnitOfWorkException(this) }
// else return function so as to enable commit.andThen(() -> { do something iff commit was successful; })
- return Function.identity();
- }
+ return Function.identity();
+ }
- /**
- * Explicitly discard the work and mark it as as such in the log.
- */
- public void abort() {
- // log.record(txn::abort)
- // cache.invalidateSince(txn::start time)
- }
+ /**
+ * Explicitly discard the work and mark it as as such in the log.
+ */
+ public void abort() {
+ // log.record(txn::abort)
+ // cache.invalidateSince(txn::start time)
+ }
- public String describeConflicts() {
- return "it's complex...";
- }
+ public String describeConflicts() {
+ return "it's complex...";
+ }
}
+:q
\ No newline at end of file
diff --git a/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java b/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java
index b77ba50..467c857 100644
--- a/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java
+++ b/src/main/java/net/helenus/core/reflect/MapperInvocationHandler.java
@@ -105,12 +105,6 @@ public class MapperInvocationHandler implements InvocationHandler {
throw new HelenusException("missing default type for enum user type " + returnType);
}
- } else if (returnType.isEnum() && (value.getClass() == Integer.class || value.getClass() == int.class)) {
- try {
- value = Class.forName(returnType.getName()).getEnumConstants()[(Integer) value];
- } catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException("invalid ordinal " + value + " for enum type " + returnType.getSimpleName());
- }
}
return value;