Skip to content

Commit

Permalink
Adding documentation for async-log
Browse files Browse the repository at this point in the history
Autocommit Wed Jan 14 15:09:05 EST 2015
  • Loading branch information
mxro committed Jan 14, 2015
1 parent 971ef28 commit ce5f34f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/de/mxro/async/properties/PropertyNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface PropertyNode {
*
* @param op
*/
public void record(PropertyOperation op);
public <R> Promise<R> record(PropertyOperation<R> op);

/**
* Retrieves a property with a specified type and id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SynchronizedPropertyNode implements PropertyNode {
private final PromiseFactory promiseFactory;

@Override
public void record(final PropertyOperation op) {
public <R> Promise<R> record(final PropertyOperation<R> op) {
accessThread.offer(new Step() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,23 @@ public class UnsafePropertyNode implements PropertyNode {
private final PropertyData data;

@Override
public void record(final PropertyOperation op) {
op.perform(data);
public <R> Promise<R> record(final PropertyOperation<R> op) {

return PromisesCommon.createUnsafe(new Operation<R>() {

@Override
public void apply(final ValueCallback<R> callback) {
final R res;
try {
res = op.perform(data);
} catch (final Throwable t) {
callback.onFailure(t);
return;
}
callback.onSuccess(res);
}
});

}

public UnsafePropertyNode(final PropertyFactory factory) {
Expand Down

0 comments on commit ce5f34f

Please sign in to comment.