[forge/core] 7c3c9b: Using WeakHashMap instead of a ConcurrentHashMap.
by George Gastaldi
Branch: refs/heads/master
Home: https://github.com/forge/core
Commit: 7c3c9bab0e4d3c9ac9b15698728a3703dd0cc662
https://github.com/forge/core/commit/7c3c9bab0e4d3c9ac9b15698728a3703dd0c...
Author: George Gastaldi <gegastaldi(a)gmail.com>
Date: 2014-03-05 (Wed, 05 Mar 2014)
Changed paths:
M projects/impl/src/main/java/org/jboss/forge/addon/projects/impl/InMemoryProjectCache.java
Log Message:
-----------
Using WeakHashMap instead of a ConcurrentHashMap.
The following test proves that elements are garbage collected correctly
with WeakHashMap:
public void testWeakHashMap() throws Exception
{
final Map<String, WeakReference<String>> projects = new
ConcurrentHashMap<>();
final Map<String, String> projectsWeak = new WeakHashMap<>();
ExecutorService pool = Executors.newCachedThreadPool();
for (int i = 0; i < 100; i++)
{
final String idx = String.valueOf(i);
pool.execute(new Runnable()
{
@Override
public void run()
{
projects.put(String.valueOf(idx), new
WeakReference<String>(new String(idx)));
projectsWeak.put(String.valueOf(idx), new String(idx));
}
});
}
System.gc();
Thread.sleep(5000);
Assert.assertTrue(projectsWeak.size() < projects.size());
}
10 years, 9 months
[forge/core] 756c0b: Using WeakHashMap instead of a ConcurrentHashMap.
by George Gastaldi
Branch: refs/heads/master
Home: https://github.com/forge/core
Commit: 756c0b9c4af3bb8cf3d401bd4afac5ccb8f8cd93
https://github.com/forge/core/commit/756c0b9c4af3bb8cf3d401bd4afac5ccb8f8...
Author: George Gastaldi <gegastaldi(a)gmail.com>
Date: 2014-03-05 (Wed, 05 Mar 2014)
Changed paths:
M projects/impl/src/main/java/org/jboss/forge/addon/projects/impl/InMemoryProjectCache.java
Log Message:
-----------
Using WeakHashMap instead of a ConcurrentHashMap.
The following test proves that elements are garbage collected correctly
with WeakHashMap:
public void testWeakHashMap() throws Exception
{
final Map<String, WeakReference<String>> projects = new
ConcurrentHashMap<>();
final Map<String, String> projectsWeak = new WeakHashMap<>();
ExecutorService pool = Executors.newCachedThreadPool();
for (int i = 0; i < 100; i++)
{
final String idx = String.valueOf(i);
pool.execute(new Runnable()
{
@Override
public void run()
{
projects.put(String.valueOf(idx), new
WeakReference<String>(new String(idx)));
projectsWeak.put(String.valueOf(idx), new String(idx));
}
});
}
System.gc();
Thread.sleep(5000);
Assert.assertTrue(projectsWeak.size() < projects.size());
}
10 years, 9 months
[forge/core] bf45b4: Implemented FORGE-1635
by George Gastaldi
Branch: refs/heads/master
Home: https://github.com/forge/core
Commit: bf45b45af74a216dd414dadc5edc02f92755738b
https://github.com/forge/core/commit/bf45b45af74a216dd414dadc5edc02f92755...
Author: Antonio Goncalves <antonio.goncalves(a)gmail.com>
Date: 2014-03-05 (Wed, 05 Mar 2014)
Changed paths:
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/ejb/ui/EJBSetClassTransactionAttributeCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/ejb/ui/EJBSetMethodTransactionAttributeCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/ejb/ui/NewEJBCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/ui/FacesNewConverterCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/ui/FacesNewValidatorCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/ui/FacesNewValidatorMethodCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/jpa/ui/NewEntityCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/jpa/ui/NewFieldWizard.java
Log Message:
-----------
Implemented FORGE-1635
Commit: c59d97fbd7b759bb4debf94e13e72d7085c5a98d
https://github.com/forge/core/commit/c59d97fbd7b759bb4debf94e13e72d7085c5...
Author: George Gastaldi <gegastaldi(a)gmail.com>
Date: 2014-03-05 (Wed, 05 Mar 2014)
Changed paths:
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/ejb/ui/EJBSetClassTransactionAttributeCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/ejb/ui/EJBSetMethodTransactionAttributeCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/ejb/ui/NewEJBCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/ui/FacesNewConverterCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/ui/FacesNewValidatorCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/faces/ui/FacesNewValidatorMethodCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/jpa/ui/NewEntityCommand.java
M javaee/impl/src/main/java/org/jboss/forge/addon/javaee/jpa/ui/NewFieldWizard.java
Log Message:
-----------
Merge pull request #398 from agoncal/FORGE-1635
Implemented FORGE-1635
Compare: https://github.com/forge/core/compare/543d1ba6618b...c59d97fbd7b7
10 years, 9 months