Skip to content

Commit

Permalink
Merge pull request #29 from sbxcloud/annotationlib
Browse files Browse the repository at this point in the history
findAllInBackground bug fixed
  • Loading branch information
lgguzman committed Jun 26, 2017
2 parents 542fff1 + 530aa86 commit c712ea3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Agregamos la librería como dependencia

dependencies {
//...otras dependencias de tu proyeco aquí.....
compile 'com.github.sbxcloud:androidlib:v2.3.6'
compile 'com.github.sbxcloud:androidlib:v2.3.7'
}
Esta librería se basa en annotaciones. Para crear tu propia Clase usuario puedes hacerla así:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public SbxQuery addGeoSort(double lat, double lon, String latName, String lonNam
return this;
}

private static final class Lock { }
private final Object lock = new Lock();

public <T> void findInBackground(final SbxArrayResponse <T> sbxArrayResponse) throws Exception{
SbxUrlComposer sbxUrlComposer=SbxModelHelper.getUrlQuery(sbxQueryBuilder);
Request request = ApiManager.getInstance().sbxUrlComposer2Request(sbxUrlComposer);
Expand Down Expand Up @@ -161,7 +164,7 @@ public void onResponse(Call call, Response response) throws IOException {



public <T> void findAllInBackground(final SbxArrayResponse <T> sbxArrayResponse) throws Exception{
public <T> void findAllInBackground(final SbxArrayResponse <T> sbxArrayResponse) throws Exception{
final List<T> list=new ArrayList<>();
final Point error=new Point(0,0);
new Thread(new Runnable() {
Expand All @@ -186,11 +189,15 @@ public void onSuccess(List<T> response) {
error.set(1,1);
sbxArrayResponse.onError(ex);
} finally {
notifyAll();
synchronized (lock) {
lock.notifyAll();
}
}
}
});
wait();
synchronized (lock) {
lock.wait();
}
i++;
}
if(error.x==0)
Expand Down

0 comments on commit c712ea3

Please sign in to comment.