List of usage examples for java.util WeakHashMap WeakHashMap
public WeakHashMap()
From source file:org.genemania.plugin.cytoscape.AbstractCytoscapeUtils.java
public AbstractCytoscapeUtils(NetworkUtils networkUtils) { this.networkUtils = networkUtils; edgeProxies = new WeakHashMap<EDGE, EdgeProxy<EDGE, NODE>>(); nodeProxies = new WeakHashMap<NODE, NodeProxy<NODE>>(); networkProxies = new WeakHashMap<NETWORK, NetworkProxy<NETWORK, NODE, EDGE>>(); }
From source file:org.openmrs.scheduler.timer.TimerSchedulerServiceImpl.java
public static void setScheduledTasks(Map<Integer, TimerSchedulerTask> scheduledTasks) { if (scheduledTasks != null) { TimerSchedulerServiceImpl.scheduledTasks = scheduledTasks; } else {//from w w w . j a v a2 s.c o m TimerSchedulerServiceImpl.scheduledTasks = new WeakHashMap<Integer, TimerSchedulerTask>(); } }
From source file:edu.uci.ics.jung.utils.UnifiedUserData.java
protected Map getKeyMap(Object key) { Map key_map = (Map) key_meta_map.get(key); if (key_map == null) { key_map = new WeakHashMap(); // key_map = new HashMap(); key_meta_map.put(key, key_map);/*from www .j a v a2 s . co m*/ } return key_map; }
From source file:com.bsb.cms.commons.web.MossActionUtils.java
/** * ?? ???<s:debug></s:debug> * //from www .j ava 2 s . c om * @param req */ @SuppressWarnings("all") @Deprecated public static void print(HttpServletRequest req) { // Application Map<String, Object> parameters = new WeakHashMap<String, Object>(); // attributes in scope RequestParameter for (Enumeration e = req.getParameterNames(); e.hasMoreElements();) { String name = (String) e.nextElement(); String[] v = req.getParameterValues(name); if (v.length == 1) { if (v[0].equals("")) continue; parameters.put(name, v[0]); } else parameters.put(name, v); } // attributes in scope Request for (Enumeration e = req.getAttributeNames(); e.hasMoreElements();) { String name = (String) e.nextElement(); Object v = req.getAttribute(name); parameters.put(name, v); } // attributes in scope Session HttpSession session = req.getSession(); for (Enumeration e = session.getAttributeNames(); e.hasMoreElements();) { String name = (String) e.nextElement(); Object v = session.getAttribute(name); parameters.put(name, v); } Set keys = parameters.keySet(); Iterator it = keys.iterator(); String key; Object value; while (it.hasNext()) { key = (String) it.next(); value = parameters.get(key); System.out.println("key:" + key + ", value:" + value); } }
From source file:com.github.larsq.spring.embeddedamqp.SimpleAmqpMessageContainer.java
public SimpleAmqpMessageContainer() { consumers = new ConcurrentHashMap<>(); nextSequenceNumber = new ConcurrentHashMap<>(); exchanges = new TreeSet<>(); bindings = new WeakHashMap<>(); routers = ImmutableSet.copyOf(SimpleAmqpMessageContainer.this.findRouters()); }
From source file:me.xiaopan.android.spear.download.HttpClientImageDownloader.java
public HttpClientImageDownloader() { this.urlLocks = Collections.synchronizedMap(new WeakHashMap<String, ReentrantLock>()); BasicHttpParams httpParams = new BasicHttpParams(); ConnManagerParams.setTimeout(httpParams, DEFAULT_WAIT_TIMEOUT); ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(DEFAULT_MAX_ROUTE_CONNECTIONS)); ConnManagerParams.setMaxTotalConnections(httpParams, DEFAULT_MAX_CONNECTIONS); HttpConnectionParams.setTcpNoDelay(httpParams, true); HttpConnectionParams.setSoTimeout(httpParams, DEFAULT_READ_TIMEOUT); HttpConnectionParams.setConnectionTimeout(httpParams, DEFAULT_CONNECT_TIMEOUT); HttpConnectionParams.setSocketBufferSize(httpParams, DEFAULT_SOCKET_BUFFER_SIZE); HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); HttpProtocolParams.setUserAgent(httpParams, DEFAULT_USER_AGENT); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); httpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, schemeRegistry), httpParams); httpClient.addRequestInterceptor(new GzipProcessRequestInterceptor()); httpClient.addResponseInterceptor(new GzipProcessResponseInterceptor()); }
From source file:com.squareup.picasso3.Dispatcher.java
Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler, PlatformLruCache cache, Stats stats) {/*from ww w . j av a 2s.c o m*/ this.dispatcherThread = new DispatcherThread(); this.dispatcherThread.start(); Utils.flushStackLocalLeaks(dispatcherThread.getLooper()); this.context = context; this.service = service; this.hunterMap = new LinkedHashMap<>(); this.failedActions = new WeakHashMap<>(); this.pausedActions = new WeakHashMap<>(); this.pausedTags = new LinkedHashSet<>(); this.handler = new DispatcherHandler(dispatcherThread.getLooper(), this); this.mainThreadHandler = mainThreadHandler; this.cache = cache; this.stats = stats; this.airplaneMode = Utils.isAirplaneModeOn(this.context); this.scansNetworkChanges = hasPermission(context, Manifest.permission.ACCESS_NETWORK_STATE); this.receiver = new NetworkBroadcastReceiver(this); receiver.register(); }
From source file:org.protempa.KnowledgeSourceImpl.java
public KnowledgeSourceImpl(KnowledgeSourceBackend... backends) { super(backends); this.inverseIsACache = new ReferenceMap<>(); this.abstractedFromCache = new ReferenceMap<>(); this.subContextsCache = new ReferenceMap<>(); this.inducedByCache = new ReferenceMap<>(); this.notFoundAbstractionDefinitionRequests = new WeakHashMap<>(); this.notFoundValueSetRequests = new WeakHashMap<>(); this.notFoundPropositionDefinitionRequests = new WeakHashMap<>(); this.notFoundContextDefinitionRequests = new WeakHashMap<>(); this.notFoundTemporalPropositionDefinitionRequests = new HashMap<>(); this.propDefReader = new PropositionDefinitionReader(); this.abstractionDefReader = new AbstractionDefinitionReader(); this.contextDefReader = new ContextDefinitionReader(); this.tempPropDefReader = new TemporalPropositionDefinitionReader(); }
From source file:org.apache.axis.handlers.soap.SOAPService.java
/** * Add this passed in Session to this Service's list of sessions *//*from ww w . j a va2s . com*/ public void addSession(Session session) { WeakHashMap map = (WeakHashMap) sessions.get(this.getName()); if (map == null) { map = new WeakHashMap(); sessions.put(this.getName(), map); } if (!map.containsKey(session)) map.put(session, null); }
From source file:org.kuali.rice.krad.uif.util.MultiColumnComparator.java
/** * Constructs a MultiColumnComparator instance * //ww w . j a v a2 s . co m * @param modelCollection the model collection that the CollectionGroup is associated with * @param collectionGroup the CollectionGroup whose columns are being sorted * @param columnSorts A list from highest to lowest precedence of the column sorts to apply * @param form object containing the view's data * @param view The view */ public MultiColumnComparator(List<Object> modelCollection, CollectionGroup collectionGroup, List<ColumnSort> columnSorts, ViewModel form, View view) { this.modelCollection = modelCollection; this.collectionGroup = collectionGroup; this.columnSorts = columnSorts; this.view = view; this.form = form; // // initialize convenience members and calculated members. Caches first! // calculatedValueCache = new WeakHashMap<String, String>(); propertyClassCache = new HashMap<String, Class>(); tableLayoutManager = (TableLayoutManager) collectionGroup.getLayoutManager(); prototypeRow = buildPrototypeRow(); }