Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaofei-it committed Aug 30, 2016
1 parent dec22fc commit 9a6b260
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@ public void unregister(Object subscriber) {
mEventBus.unregister(subscriber);
}

private void actionInternal(final Action<IMainService> action) {
if (mMainProcess) {
action.call(mMainApis);
} else {
if (mState == STATE_DISCONNECTED) {
Log.w(TAG, HERMES_SERVICE_DISCONNECTED);
} else if (mState == STATE_CONNECTING) {
mRemoteApis.actionNonNullNonBlocking(new Action<IMainService>() {
@Override
public void call(IMainService o) {
action.call(o);
}
});
} else if (mState == STATE_CONNECTED) {
action.call(mRemoteApis.get());
} else {
throw new IllegalStateException(UNKNOWN_ERROR);
}
}
}

private <T> T calculateInternal(final Function<IMainService, ? extends T> function) {
if (mMainProcess) {
return function.call(mMainApis);
Expand All @@ -185,16 +206,6 @@ public T call(IMainService o) {
}
}

private void actionInternal(final Action<IMainService> action) {
calculateInternal(new Function<IMainService, Void>() {
@Override
public Void call(IMainService o) {
action.call(o);
return null;
}
});
}

public void post(final Object event) {
actionInternal(new Action<IMainService>() {
@Override
Expand Down

0 comments on commit 9a6b260

Please sign in to comment.