List of utility methods to do Thread Lock
boolean | canCreateNewThread() can Create New Thread if (Thread.activeCount() < 20000) { try { return true; } catch (Exception e) { e.printStackTrace(); return false; ... |
Queue | createConcurrentStack() create Concurrent Stack return (Queue<E>) Collections.asLifoQueue(newConcurrentNonBlockingDeque());
|
void | downgradeWriteLock(final ReadWriteLock lock) downgrade Write Lock acquireReadLock(lock); releaseWriteLock(lock); |
void | fillReadWriteLocks(List fill Read Write Locks if (curSize < size) { for (int i = curSize; i < size; i++) { ReentrantReadWriteLock nrwl = new ReentrantReadWriteLock(); readLocks.add(nrwl.readLock()); writeLocks.add(nrwl.writeLock()); |
Map | getAllMessages() get All Messages return getLocaleProperties(getLocale());
|
Lock | getGradingReadLock() get Grading Read Lock return READ_WRITE_LOCK.readLock();
|
Gson | getInstance() get Instance return SERIALIZER;
|
Map | getLocaleProperties(Locale locale) Get the messages for a locale. Set<String> loadedBundles = null; Map<String, String> props = null; int loadedBundleCount = 0; try { readLock.lock(); loadedBundles = loadedResourceBundles.get(locale); props = cachedMessages.get(locale); loadedBundleCount = resouceBundleBaseNames.size(); ... |
ReentrantReadWriteLock | getPropLock(String s) get Prop Lock assert Thread.holdsLock(LOCK_MONITOR); if (locks.containsKey(s)) { return locks.get(s); ReentrantReadWriteLock l = new ReentrantReadWriteLock(); locks.put(s, l); return l; |
Class> | loadClass(String className) Loads a class. ClassLoader ccl = Thread.currentThread().getContextClassLoader(); if (ccl == null) { try { return loadClass(className, null); } catch (ClassNotFoundException cnf) { return loadClassWithRegisteredClassLoaders(className); try { return loadClass(className, ccl); } catch (ClassNotFoundException cnf) { try { return loadClass(className, null); } catch (ClassNotFoundException cnf2) { return loadClassWithRegisteredClassLoaders(className); |