Added a hook to wait for the DB without waiting for plugins to load.

This commit is contained in:
akwizgran
2013-05-01 16:15:40 +01:00
parent 48396262d7
commit fae67ca32b
23 changed files with 96 additions and 83 deletions

View File

@@ -31,6 +31,7 @@ public class BriarService extends RoboService {
private static final Logger LOG =
Logger.getLogger(BriarService.class.getName());
private final CountDownLatch dbLatch = new CountDownLatch(1);
private final CountDownLatch startupLatch = new CountDownLatch(1);
private final CountDownLatch shutdownLatch = new CountDownLatch(1);
private final Binder binder = new BriarBinder();
@@ -101,6 +102,7 @@ public class BriarService extends RoboService {
if(reopened) LOG.info("Database reopened");
else LOG.info("Database created");
}
dbLatch.countDown();
keyManager.start();
if(LOG.isLoggable(INFO)) LOG.info("Key manager started");
int pluginsStarted = pluginManager.start();
@@ -132,6 +134,10 @@ public class BriarService extends RoboService {
}
}
public void waitForDatabase() throws InterruptedException {
dbLatch.await();
}
public void waitForStartup() throws InterruptedException {
startupLatch.await();
}
@@ -169,6 +175,11 @@ public class BriarService extends RoboService {
return binder;
}
public void waitForDatabase() throws InterruptedException {
waitForBinder();
((BriarBinder) binder).getService().waitForDatabase();
}
public void waitForStartup() throws InterruptedException {
waitForBinder();
((BriarBinder) binder).getService().waitForStartup();

View File

@@ -146,7 +146,7 @@ public class HomeScreenActivity extends RoboActivity {
service.waitForShutdown();
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
}
// Finish the activity and kill the JVM
runOnUiThread(new Runnable() {
@@ -164,7 +164,7 @@ public class HomeScreenActivity extends RoboActivity {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.addLocalAuthor(a);
db.setRating(a.getId(), GOOD);
@@ -181,7 +181,7 @@ public class HomeScreenActivity extends RoboActivity {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -115,7 +115,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<GroupMessageHeader> headers =
db.getGroupMessageHeaders(groupId);
@@ -135,7 +135,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -135,7 +135,7 @@ OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Set<GroupId> local = new HashSet<GroupId>();
for(Group g : db.getLocalGroups()) local.add(g.getId());
@@ -166,7 +166,7 @@ OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -277,7 +277,7 @@ OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<GroupMessageHeader> headers =
db.getGroupMessageHeaders(g.getId());
@@ -294,7 +294,7 @@ OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -318,7 +318,7 @@ OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
int available = 0;
long now = System.currentTimeMillis();
for(GroupStatus s : db.getAvailableGroups()) {
@@ -334,7 +334,7 @@ OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -164,7 +164,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<Contact> contacts = db.getContacts();
long duration = System.currentTimeMillis() - now;
@@ -176,7 +176,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -208,7 +208,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
if(subscribe) {
if(!wasSubscribed) db.subscribe(group);
@@ -225,7 +225,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
runOnUiThread(new Runnable() {

View File

@@ -197,7 +197,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<Contact> contacts = db.getContacts();
long duration = System.currentTimeMillis() - now;
@@ -209,7 +209,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -240,7 +240,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.addLocalGroup(g);
db.subscribe(g);
@@ -254,7 +254,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
runOnUiThread(new Runnable() {

View File

@@ -78,7 +78,7 @@ implements DatabaseListener, OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
List<GroupStatus> available = new ArrayList<GroupStatus>();
for(GroupStatus s : db.getAvailableGroups())
@@ -93,7 +93,7 @@ implements DatabaseListener, OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -206,7 +206,7 @@ implements OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.setReadFlag(messageId, read);
long duration = System.currentTimeMillis() - now;
@@ -218,7 +218,7 @@ implements OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -239,7 +239,7 @@ implements OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
byte[] body = db.getMessageBody(messageId);
long duration = System.currentTimeMillis() - now;
@@ -263,7 +263,7 @@ implements OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
} catch(UnsupportedEncodingException e) {
throw new RuntimeException(e);

View File

@@ -169,7 +169,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<LocalAuthor> localAuthors = db.getLocalAuthors();
long duration = System.currentTimeMillis() - now;
@@ -180,7 +180,7 @@ implements OnItemSelectedListener, OnClickListener {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -216,7 +216,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<LocalGroup> groups = db.getLocalGroups();
long duration = System.currentTimeMillis() - now;
@@ -227,7 +227,7 @@ implements OnItemSelectedListener, OnClickListener {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -350,7 +350,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.addLocalGroupMessage(m);
long duration = System.currentTimeMillis() - now;
@@ -361,7 +361,7 @@ implements OnItemSelectedListener, OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -4,6 +4,7 @@ import static android.content.Intent.ACTION_SEND;
import static android.content.Intent.EXTRA_STREAM;
import static android.view.Gravity.CENTER;
import static android.view.Gravity.CENTER_HORIZONTAL;
import static android.view.View.GONE;
import static android.widget.LinearLayout.HORIZONTAL;
import static android.widget.LinearLayout.VERTICAL;
import static java.util.logging.Level.INFO;
@@ -80,6 +81,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
list.setLayoutParams(MATCH_WRAP_1);
list.setAdapter(adapter);
list.setOnItemClickListener(adapter);
list.setVisibility(GONE);
layout.addView(list);
layout.addView(new HorizontalBorder(this));
@@ -124,7 +126,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<Contact> contacts = db.getContacts();
Map<ContactId, Long> times = db.getLastConnected();
@@ -137,7 +139,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -162,7 +162,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<Contact> contacts = db.getContacts();
long duration = System.currentTimeMillis() - now;
@@ -174,7 +174,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -206,7 +206,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
if(subscribe) {
if(!wasSubscribed) db.subscribe(group);
@@ -223,7 +223,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
runOnUiThread(new Runnable() {

View File

@@ -172,7 +172,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
Group g = groupFactory.createGroup(name);
long now = System.currentTimeMillis();
db.subscribe(g);
@@ -186,7 +186,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
} catch(IOException e) {
throw new RuntimeException(e);
@@ -206,7 +206,7 @@ SelectContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<Contact> contacts = db.getContacts();
long duration = System.currentTimeMillis() - now;
@@ -218,7 +218,7 @@ SelectContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -113,7 +113,7 @@ OnClickListener, OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<GroupMessageHeader> headers =
db.getGroupMessageHeaders(groupId);
@@ -133,7 +133,7 @@ OnClickListener, OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -133,7 +133,7 @@ OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
int available = 0;
long now = System.currentTimeMillis();
for(GroupStatus s : db.getAvailableGroups()) {
@@ -161,7 +161,7 @@ OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -272,7 +272,7 @@ OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<GroupMessageHeader> headers =
db.getGroupMessageHeaders(g.getId());
@@ -288,7 +288,7 @@ OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -312,7 +312,7 @@ OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
int available = 0;
long now = System.currentTimeMillis();
for(GroupStatus s : db.getAvailableGroups()) {
@@ -328,7 +328,7 @@ OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -78,7 +78,7 @@ implements DatabaseListener, OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
List<GroupStatus> available = new ArrayList<GroupStatus>();
for(GroupStatus s : db.getAvailableGroups())
@@ -93,7 +93,7 @@ implements DatabaseListener, OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -230,7 +230,7 @@ implements OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.setReadFlag(messageId, read);
long duration = System.currentTimeMillis() - now;
@@ -242,7 +242,7 @@ implements OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -263,7 +263,7 @@ implements OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
byte[] body = db.getMessageBody(messageId);
long duration = System.currentTimeMillis() - now;
@@ -287,7 +287,7 @@ implements OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
} catch(UnsupportedEncodingException e) {
throw new RuntimeException(e);
@@ -337,7 +337,7 @@ implements OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.setRating(authorId, r);
long duration = System.currentTimeMillis() - now;
@@ -349,7 +349,7 @@ implements OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -172,7 +172,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<LocalAuthor> localAuthors = db.getLocalAuthors();
long duration = System.currentTimeMillis() - now;
@@ -183,7 +183,7 @@ implements OnItemSelectedListener, OnClickListener {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -219,7 +219,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
List<Group> groups = new ArrayList<Group>();
long now = System.currentTimeMillis();
for(Group g : db.getSubscriptions())
@@ -232,7 +232,7 @@ implements OnItemSelectedListener, OnClickListener {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -352,7 +352,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.addLocalGroupMessage(m);
long duration = System.currentTimeMillis() - now;
@@ -363,7 +363,7 @@ implements OnItemSelectedListener, OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -154,7 +154,7 @@ implements OnEditorActionListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.addLocalAuthor(a);
db.setRating(a.getId(), GOOD);
@@ -166,7 +166,7 @@ implements OnEditorActionListener, OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
runOnUiThread(new Runnable() {

View File

@@ -216,7 +216,7 @@ implements InvitationListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<LocalAuthor> localAuthors = db.getLocalAuthors();
long duration = System.currentTimeMillis() - now;
@@ -227,7 +227,7 @@ implements InvitationListener {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -114,7 +114,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<PrivateMessageHeader> headers =
db.getPrivateMessageHeaders(contactId);
@@ -134,7 +134,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -98,7 +98,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
for(Contact c : db.getContacts()) {
try {
@@ -118,7 +118,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -202,7 +202,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Contact contact = db.getContact(c);
Collection<PrivateMessageHeader> headers =
@@ -219,7 +219,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}

View File

@@ -200,7 +200,7 @@ implements OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
db.setReadFlag(messageId, read);
long duration = System.currentTimeMillis() - now;
@@ -212,7 +212,7 @@ implements OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -233,7 +233,7 @@ implements OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
byte[] body = db.getMessageBody(messageId);
long duration = System.currentTimeMillis() - now;
@@ -257,7 +257,7 @@ implements OnClickListener {
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
} catch(UnsupportedEncodingException e) {
throw new RuntimeException(e);

View File

@@ -155,7 +155,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
Collection<Contact> contacts = db.getContacts();
long duration = System.currentTimeMillis() - now;
@@ -166,7 +166,7 @@ implements OnItemSelectedListener, OnClickListener {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -227,7 +227,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
long now = System.currentTimeMillis();
localAuthor = db.getLocalAuthor(a);
long duration = System.currentTimeMillis() - now;
@@ -238,7 +238,7 @@ implements OnItemSelectedListener, OnClickListener {
if(LOG.isLoggable(WARNING))
LOG.log(WARNING, e.toString(), e);
} catch(InterruptedException e) {
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
}
}
@@ -277,7 +277,7 @@ implements OnItemSelectedListener, OnClickListener {
dbUiExecutor.execute(new Runnable() {
public void run() {
try {
serviceConnection.waitForStartup();
serviceConnection.waitForDatabase();
Message m = messageFactory.createPrivateMessage(parentId,
"text/plain", body);
long now = System.currentTimeMillis();
@@ -292,7 +292,7 @@ implements OnItemSelectedListener, OnClickListener {
throw new RuntimeException(e);
} catch(InterruptedException e) {
if(LOG.isLoggable(INFO))
LOG.info("Interrupted while waiting for service");
LOG.info("Interrupted while waiting for database");
Thread.currentThread().interrupt();
} catch(IOException e) {
throw new RuntimeException(e);