public static final int ERROR_NOT_FOUND = 1;
public static final int ERROR_SYSTEM = 9;
- private static int RETRY_COUNT = 3;
-
private Context context = null;
private String guid;
private String noteName;
@Override
public void doExecute() {
- Note note = null;
try {
- int i = 0;
synchronized (context) {
- for (i = 0; i < RETRY_COUNT; i++) {
- note = util.updateNoteContext(guid, title, text);
- if (note != null) {
- NoteDao dao = NoteDao.getInstance();
- com.yuji.em.data.Note n = new com.yuji.em.data.Note(
- note.getGuid(), note.getTitle());
- dao.update(context, n);
-
- break;
- }
- Debug.d(this, "retry updateNoteContext()"); // TODO
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- ;
- }
+ Note note = util.updateNoteContext(guid, title, text);
+ if (note != null) {
+ NoteDao dao = NoteDao.getInstance();
+ com.yuji.em.data.Note n = new com.yuji.em.data.Note(
+ note.getGuid(), note.getTitle());
+ dao.update(context, n);
+ status = ERROR_NONE;
+ } else {
+ Toast.makeText(context, "\8f\91\82«\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½" + text,
+ Toast.LENGTH_LONG); // TODO
+ Debug.d(this, "doExecute"); // TODO
+ status = ERROR_SYSTEM;
}
}
- if (i < RETRY_COUNT) {
- status = ERROR_NONE;
- } else {
- Toast.makeText(context, "\8f\91\82«\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½" + text, Toast.LENGTH_LONG); // TODO
- Debug.d(this, "doExecute"); // TODO
- status = ERROR_SYSTEM;
- }
} catch (EDAMNotFoundException e) {
status = ERROR_NOT_FOUND;
}