import java.util.Calendar;\r
import java.util.HashMap;\r
import java.util.List;\r
-import java.util.concurrent.ArrayBlockingQueue;\r
\r
import com.evernote.edam.type.Accounting;\r
import com.evernote.edam.type.PrivilegeLevel;\r
public static String username = ""; \r
public static String password = ""; \r
\r
- public static int mainThreadId=0;\r
- private static ArrayBlockingQueue<Boolean> mainThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+\r
+ public static final int mainThreadId=0;\r
\r
- public static int syncThreadId=1;\r
- private static ArrayBlockingQueue<Boolean> syncThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int syncThreadId=1;\r
\r
- public static int tagCounterThreadId=2;\r
- private static ArrayBlockingQueue<Boolean> tagCounterThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int tagCounterThreadId=2;\r
\r
- public static int trashCounterThreadId=3; // This should always be the highest thread ID\r
- private static ArrayBlockingQueue<Boolean> trashCounterThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int trashCounterThreadId=3; // This should always be the highest thread ID\r
\r
- public static int indexThreadId=4; // Thread for indexing words\r
- private static ArrayBlockingQueue<Boolean> indexThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int indexThreadId=4; // Thread for indexing words\r
\r
- public static int saveThreadId=5; // Thread used for processing data to saving content\r
- private static ArrayBlockingQueue<Boolean> saveThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int saveThreadId=5; // Thread used for processing data to saving content\r
\r
- public static int notebookCounterThreadId=6; // Notebook Thread\r
- private static ArrayBlockingQueue<Boolean> notebookCounterThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int notebookCounterThreadId=6; // Notebook Thread\r
\r
- public static int indexThread03Id=7; // unused\r
- private static ArrayBlockingQueue<Boolean> indexThread03ThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int indexThread03Id=7; // unused\r
\r
- public static int indexThread04Id=8; // unused\r
- private static ArrayBlockingQueue<Boolean> indexThread04ThreadWaiter = new ArrayBlockingQueue<Boolean>(1);\r
+ public static final int indexThread04Id=8; // unused\r
+ \r
+ public static final int dbThreadId=9; // This should always be the highest thread ID\r
\r
- public static int dbThreadId=9; // This should always be the highest thread ID\r
-\r
\r
public static HashMap<String,String> passwordSafe = new HashMap<String, String>();\r
public static List<String> passwordRemember = new ArrayList<String>();\r
settings.endGroup();\r
}\r
\r
- public static void dbWait() {\r
- // Global.dbThreadWait.wait(Global.dbThreadWaitMutex);\r
- }\r
- public static void dbContinue() {\r
-// Global.dbThreadWait.wakeAll();\r
- }\r
- \r
- public static synchronized void dbClientWait(int id) {\r
- if (id == mainThreadId) {\r
- try {mainThreadWaiter.take(); } catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == syncThreadId) {\r
- try {syncThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == tagCounterThreadId) {\r
- try {tagCounterThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == trashCounterThreadId) {\r
- try {trashCounterThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == indexThreadId) {\r
- try {indexThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == saveThreadId) {\r
- try {saveThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == notebookCounterThreadId) {\r
- try {notebookCounterThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == indexThread03Id) {\r
- try {indexThread03ThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- if (id == indexThread04Id) {\r
- try {indexThread04ThreadWaiter.take();} catch (InterruptedException e) {e.printStackTrace();}\r
- }\r
- }\r
- public static void dbClientContinue(int id) {\r
- if (id == mainThreadId) {\r
- try { mainThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == syncThreadId) {\r
- try { syncThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == tagCounterThreadId) { \r
- try { tagCounterThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == trashCounterThreadId) { \r
- try { trashCounterThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == indexThreadId) { \r
- try { indexThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == saveThreadId) { \r
- try { saveThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == notebookCounterThreadId) { \r
- try { notebookCounterThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == indexThread03Id) { \r
- try { indexThread03ThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- if (id == indexThread04Id) { \r
- try { indexThread04ThreadWaiter.put(true); } catch (InterruptedException e) { e.printStackTrace();}\r
- }\r
- }\r
- \r
public static void saveState(String name, QByteArray state) {\r
settings.beginGroup("SaveState");\r
settings.setValue(name, state);\r