Refine search
private Hashtable getInvalidNames() { Hashtable ht = invalidNames; if (ht == null) { synchronized (MemberResolver.class) { WeakReference ref = (WeakReference)invalidNamesMap.get(classPool); if (ref != null) ht = (Hashtable)ref.get(); if (ht == null) { ht = new Hashtable(); invalidNamesMap.put(classPool, new WeakReference(ht)); } } invalidNames = ht; } return ht; }
private static Hashtable<String, ResourceBundle> getLoaderCache(Object cacheKey) { synchronized (cache) { Hashtable<String, ResourceBundle> loaderCache = cache.get(cacheKey); if (loaderCache == null) { loaderCache = new Hashtable<String, ResourceBundle>(); cache.put(cacheKey, loaderCache); } return loaderCache; } }
/** * Called by native libraries to put {@code offsetof()} and {@code sizeof()} values in {@link #memberOffsets}. * * @param type the peer Class acting as interface to the native type * @param member the name of the native member variable * @param offset the value of {@code offsetof()} (or {@code sizeof()} when {@code member.equals("sizeof")}) */ static synchronized void putMemberOffset(Class<? extends Pointer> type, String member, int offset) { HashMap<String,Integer> offsets = memberOffsets.get(type); if (offsets == null) { memberOffsets.put(type, offsets = new HashMap<String,Integer>()); } offsets.put(member, offset); }
private static ConcurrentMap<String, Class> getRelatedClassMap(final Class relatedClass) { ConcurrentMap<String, Class> map; synchronized (derivedClasses) { map = derivedClasses.get(relatedClass); if (map == null) { map = new ConcurrentHashMap<>(); derivedClasses.put(relatedClass, map); } } return map; }
/** * Returns a map with the user data objects attached to the specified node. * This map is readable and writable. */ Map<String, UserData> getUserDataMap(NodeImpl node) { if (nodeToUserData == null) { nodeToUserData = new WeakHashMap<NodeImpl, Map<String, UserData>>(); } Map<String, UserData> userDataMap = nodeToUserData.get(node); if (userDataMap == null) { userDataMap = new HashMap<String, UserData>(); nodeToUserData.put(node, userDataMap); } return userDataMap; }
/** * Returns the {@link Level} to log an uncaught exception from a {@link DescriptorVisibilityFilter}. We * need to suppress repeated exceptions as there can be many invocations of the {@link DescriptorVisibilityFilter} * triggered by the UI and spamming the logs would be bad. * * @param f the {@link DescriptorVisibilityFilter}. * @return the level to report uncaught exceptions at. */ private static Level logLevelFor(DescriptorVisibilityFilter f) { Long interval = SystemProperties.getLong( DescriptorVisibilityFilter.class.getName() + ".badFilterLogWarningIntervalMinutes", 60L); // the healthy path will never see this synchronized block synchronized (ResourceHolder.BAD_FILTERS) { Long lastTime = ResourceHolder.BAD_FILTERS.get(f); if (lastTime == null || lastTime + TimeUnit.MINUTES.toMillis(interval) < System.currentTimeMillis()) { ResourceHolder.BAD_FILTERS.put(f, System.currentTimeMillis()); return Level.WARNING; } else { return Level.FINE; } } }
PrefixPluginLogger(ExtendedLogger logger, String name, String prefix) { super(logger, name, (MessageFactory) null); String actualPrefix = prefix == null ? "" : prefix; WeakHashMap var6 = markers; MarkerManager.Log4jMarker actualMarker; synchronized (markers) { MarkerManager.Log4jMarker maybeMarker = (MarkerManager.Log4jMarker) markers.get(actualPrefix); if (maybeMarker == null) { actualMarker = new MarkerManager.Log4jMarker(actualPrefix); markers.put(new String(actualPrefix), actualMarker); } else { actualMarker = maybeMarker; } } this.marker = (Marker) actualMarker; }
private Hashtable getInvalidNames() { Hashtable ht = invalidNames; if (ht == null) { synchronized (MemberResolver.class) { WeakReference ref = (WeakReference)invalidNamesMap.get(classPool); if (ref != null) ht = (Hashtable)ref.get(); if (ht == null) { ht = new Hashtable(); invalidNamesMap.put(classPool, new WeakReference(ht)); } } invalidNames = ht; } return ht; }
/** * Get an instance of the HashManager for the given connection. * @param connection * @return the manager for the given connection. */ public static synchronized HashManager getInstanceFor(XMPPConnection connection) { HashManager hashManager = INSTANCES.get(connection); if (hashManager == null) { hashManager = new HashManager(connection); INSTANCES.put(connection, hashManager); } return hashManager; }
/** * Create a proxy to allow for modifying post-3.0 view properties on all * pre-3.0 platforms. <strong>DO NOT</strong> wrap your views if you are * using {@code ObjectAnimator} as it will handle that itself. * * @param view View to wrap. * @return Proxy to post-3.0 properties. */ public static AnimatorProxy wrap(View view) { AnimatorProxy proxy = PROXIES.get(view); // This checks if the proxy already exists and whether it still is the animation of the given view if (proxy == null || proxy != view.getAnimation()) { proxy = new AnimatorProxy(view); PROXIES.put(view, proxy); } return proxy; }
/** * Return an OmemoManager instance for the given connection and deviceId. * If there was an OmemoManager for the connection and id before, return it. Otherwise create a new OmemoManager * instance and return it. * * @param connection XmppConnection. * @param deviceId MUST NOT be null and MUST be greater than 0. * * @return manager */ public static synchronized OmemoManager getInstanceFor(XMPPConnection connection, Integer deviceId) { if (deviceId == null || deviceId < 1) { throw new IllegalArgumentException("DeviceId MUST NOT be null and MUST be greater than 0."); } TreeMap<Integer,OmemoManager> managersOfConnection = INSTANCES.get(connection); if (managersOfConnection == null) { managersOfConnection = new TreeMap<>(); INSTANCES.put(connection, managersOfConnection); } OmemoManager manager = managersOfConnection.get(deviceId); if (manager == null) { manager = new OmemoManager(connection, deviceId); managersOfConnection.put(deviceId, manager); } return manager; }