mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 01:36:55 +00:00
Use executor instead of thread
This commit is contained in:
parent
0dc45a8d1b
commit
f9fe3621a6
1 changed files with 68 additions and 67 deletions
|
@ -10,6 +10,8 @@ import com.sun.mail.imap.IMAPStore;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
import javax.mail.Folder;
|
import javax.mail.Folder;
|
||||||
import javax.mail.Message;
|
import javax.mail.Message;
|
||||||
|
@ -33,6 +35,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
private String search;
|
private String search;
|
||||||
private Handler mainHandler;
|
private Handler mainHandler;
|
||||||
private IBoundaryCallbackMessages intf;
|
private IBoundaryCallbackMessages intf;
|
||||||
|
private ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
private IMAPStore istore = null;
|
private IMAPStore istore = null;
|
||||||
|
@ -91,10 +94,9 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
}
|
}
|
||||||
|
|
||||||
void load(final long before) {
|
void load(final long before) {
|
||||||
new Thread(new Runnable() {
|
executor.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (context.getApplicationContext()) {
|
|
||||||
try {
|
try {
|
||||||
mainHandler.post(new Runnable() {
|
mainHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -166,7 +168,6 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue