use WeakHashMap for DataSource-keyed cache (SPR-6887)

This commit is contained in:
Juergen Hoeller 2010-02-23 10:47:51 +00:00
parent 3d2611484a
commit 09f02bc620
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,8 +17,8 @@
package org.springframework.jdbc.support; package org.springframework.jdbc.support;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -85,7 +85,7 @@ public class SQLErrorCodesFactory {
/** /**
* Map to cache the SQLErrorCodes instance per DataSource. * Map to cache the SQLErrorCodes instance per DataSource.
*/ */
private final Map<DataSource, SQLErrorCodes> dataSourceCache = new HashMap<DataSource, SQLErrorCodes>(16); private final Map<DataSource, SQLErrorCodes> dataSourceCache = new WeakHashMap<DataSource, SQLErrorCodes>(16);
/** /**