Skip to content

Commit

Permalink
Fix time sequence issue brought in with act-gh872
Browse files Browse the repository at this point in the history
  • Loading branch information
greenlaw110 committed Oct 11, 2018
1 parent 2fc00a5 commit 02b23bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/main/java/act/storage/SObjectFieldScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private static class _ByteCodeVisitor extends ByteCodeVisitor {
private String serviceId;
private String contextPath;
private UpdatePolicy updatePolicy = UpdatePolicy.DELETE_OLD_DATA;

_ByteCodeVisitor(App app) {
this.app = $.requireNotNull(app);
}
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/act/storage/db/DbProbe.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import act.storage.StorageServiceManagerInitialized;
import org.osgl.$;

import java.util.EventObject;

/**
* The implementation of this interface probe
* if a specific {@link act.db.DbPlugin database layer}
Expand All @@ -52,21 +50,30 @@ public abstract class DbProbe extends AppServicePlugin {
@Override
protected void applyTo(final App app) {
if (exists()) {

app.jobManager().on(SysEventId.CLASS_LOADER_INITIALIZED, new Runnable() {
@Override
public void run() {
Class<DbHooker> hookerClass = $.classForName(dbHookerClass(), app.classLoader());
final DbHooker hooker = app.getInstance(hookerClass);
StorageServiceManager ssm = StorageServiceManager.instance();
final StorageServiceManager ssm = StorageServiceManager.instance();
if (null != ssm) {
ssm.addDbHooker(hooker);
app.jobManager().on(SysEventId.DB_SVC_LOADED, new Runnable() {
@Override
public void run() {
ssm.addDbHooker(hooker);
}
});
} else {
app.eventBus().bind(StorageServiceManagerInitialized.class, new ActEventListenerBase<StorageServiceManagerInitialized>(getClass().getName() + ":hook-to-ssm") {
@Override
public void on(StorageServiceManagerInitialized event) throws Exception {
StorageServiceManager ssm = event.source();
ssm.addDbHooker(hooker);
final StorageServiceManager ssm = event.source();
app.jobManager().on(SysEventId.DB_SVC_LOADED, new Runnable() {
@Override
public void run() {
ssm.addDbHooker(hooker);
}
});
}
});
}
Expand Down

0 comments on commit 02b23bf

Please sign in to comment.