Author: olamy
Date: Fri Sep 7 08:16:29 2012
New Revision: 1381929
URL: http://svn.apache.org/viewvc?rev=1381929&view=rev
Log:
improve a bit logging pattern with .debug
Modified:
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java
archiva/redback/redback-components/trunk/spring-jdo2/src/main/java/org/apache/archiva/redback/components/jdo/AbstractConfigurableJdoFactory.java
archiva/redback/redback-components/trunk/spring-utils/src/main/java/org/apache/archiva/redback/components/springutils/CachingByTypeBeanFactory.java
Modified:
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java
URL:
http://svn.apache.org/viewvc/archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java?rev=1381929&r1=1381928&r2=1381929&view=diff
==============================================================================
---
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java
(original)
+++
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/redback/components/cache/ehcache/EhcacheCache.java
Fri Sep 7 08:16:29 2012
@@ -218,7 +218,7 @@ public class EhcacheCache
{
if ( cacheManager.getStatus().equals( Status.STATUS_ALIVE ) )
{
- log.info( "Disposing cache: " + ehcache );
+ log.info( "Disposing cache: {}", ehcache );
if ( this.ehcache != null )
{
cacheManager.removeCache( this.ehcache.getName() );
@@ -227,7 +227,7 @@ public class EhcacheCache
}
else
{
- log.debug( "Not disposing cache, because cacheManager is not
alive: " + ehcache );
+ log.debug( "Not disposing cache, because cacheManager is not
alive: {}", ehcache );
}
}
Modified:
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java
URL:
http://svn.apache.org/viewvc/archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java?rev=1381929&r1=1381928&r2=1381929&view=diff
==============================================================================
---
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java
(original)
+++
archiva/redback/redback-components/trunk/spring-cache/spring-cache-providers/spring-cache-hashmap/src/main/java/org/apache/archiva/redback/components/cache/hashmap/HashMapCache.java
Fri Sep 7 08:16:29 2012
@@ -20,9 +20,9 @@ package org.apache.archiva.redback.compo
*/
import org.apache.archiva.redback.components.cache.AbstractCacheStatistics;
-import org.apache.archiva.redback.components.cache.CacheableWrapper;
import org.apache.archiva.redback.components.cache.Cache;
import org.apache.archiva.redback.components.cache.CacheStatistics;
+import org.apache.archiva.redback.components.cache.CacheableWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -36,33 +36,32 @@ import java.util.Map;
* <p>
* HashMapCache - this is a Cache implementation taken from the Archiva
project.
* </p>
- *
+ * <p/>
* <p>
- * Original class written by Edwin Punzalan for purposes of addressing the
+ * Original class written by Edwin Punzalan for purposes of addressing the
* jira ticket <a href="http://jira.codehaus.org/browse/MRM-39">MRM-39</a>
- * </p>
+ * </p>
* <p>
* Configure the refreshTime in seconds value configure a ttl of object life
in cache.
* Object get( Object key ) :
* <ul>
- * <li> < 0 : method will always return null (no cache)</li>
- * <li> = 0 : first stored object will be return (infinite life in the
cache)</li>
- * <li> > 0 : after a live (stored time) of refreshTime the object will be
remove from the cache
- * and a no object will be returned by the method</li>
+ * <li> < 0 : method will always return null (no cache)</li>
+ * <li> = 0 : first stored object will be return (infinite life in the
cache)</li>
+ * <li> > 0 : after a live (stored time) of refreshTime the object will be
remove from the cache
+ * and a no object will be returned by the method</li>
* </ul>
* </p>
+ *
* @author Edwin Punzalan
* @author <a href="mailto:[email protected]">Joakim Erdfelt</a>
- *
- *
*/
-@Service("cache#hashmap")
+@Service ( "cache#hashmap" )
public class HashMapCache
implements Cache
{
-
+
private Logger log = LoggerFactory.getLogger( getClass() );
-
+
class Stats
extends AbstractCacheStatistics
implements CacheStatistics
@@ -96,7 +95,7 @@ public class HashMapCache
private int cacheMaxSize = 0;
/**
- *
+ *
*
*/
private int refreshTime;
@@ -171,11 +170,11 @@ public class HashMapCache
{
return false;
}
- boolean result = ( System.currentTimeMillis() -
cacheableWrapper.getStoredTime() ) > ( this.getRefreshTime() * 1000 );
- if ( log.isDebugEnabled() )
- {
- log.debug( cacheableWrapper + " is uptodate" + result );
- }
+ boolean result =
+ ( System.currentTimeMillis() - cacheableWrapper.getStoredTime() )
> ( this.getRefreshTime() * 1000 );
+
+ log.debug( "{} is uptodate {}", cacheableWrapper, result );
+
return result;
}
@@ -327,7 +326,7 @@ public class HashMapCache
}
}
- /**
+ /**
* @see org.apache.archiva.redback.components.cache.Cache#getRefreshTime()
*/
public int getRefreshTime()
@@ -335,7 +334,7 @@ public class HashMapCache
return refreshTime;
}
- /**
+ /**
*
*/
public void setRefreshTime( int refreshTime )
Modified:
archiva/redback/redback-components/trunk/spring-jdo2/src/main/java/org/apache/archiva/redback/components/jdo/AbstractConfigurableJdoFactory.java
URL:
http://svn.apache.org/viewvc/archiva/redback/redback-components/trunk/spring-jdo2/src/main/java/org/apache/archiva/redback/components/jdo/AbstractConfigurableJdoFactory.java?rev=1381929&r1=1381928&r2=1381929&view=diff
==============================================================================
---
archiva/redback/redback-components/trunk/spring-jdo2/src/main/java/org/apache/archiva/redback/components/jdo/AbstractConfigurableJdoFactory.java
(original)
+++
archiva/redback/redback-components/trunk/spring-jdo2/src/main/java/org/apache/archiva/redback/components/jdo/AbstractConfigurableJdoFactory.java
Fri Sep 7 08:16:29 2012
@@ -30,9 +30,7 @@ import java.util.Map;
import java.util.Properties;
/**
- * AbstractConfigurableJdoFactory
- *
- *
+ * AbstractConfigurableJdoFactory
*/
public abstract class AbstractConfigurableJdoFactory
implements ConfigurableJdoFactory
@@ -88,7 +86,7 @@ public abstract class AbstractConfigurab
{
otherProperties = new Properties();
}
-
+
setPropertyInner( otherProperties, key, value );
}
@@ -96,7 +94,7 @@ public abstract class AbstractConfigurab
private void configure()
{
- synchronized( configured )
+ synchronized ( configured )
{
if ( configured == Boolean.TRUE )
{
@@ -119,7 +117,7 @@ public abstract class AbstractConfigurab
{
Map.Entry entry = (Map.Entry) it.next();
- logger.debug( entry.getKey() + "=" + entry.getValue() );
+ logger.debug( "{}={}", entry.getKey(), entry.getValue() );
}
}
Modified:
archiva/redback/redback-components/trunk/spring-utils/src/main/java/org/apache/archiva/redback/components/springutils/CachingByTypeBeanFactory.java
URL:
http://svn.apache.org/viewvc/archiva/redback/redback-components/trunk/spring-utils/src/main/java/org/apache/archiva/redback/components/springutils/CachingByTypeBeanFactory.java?rev=1381929&r1=1381928&r2=1381929&view=diff
==============================================================================
---
archiva/redback/redback-components/trunk/spring-utils/src/main/java/org/apache/archiva/redback/components/springutils/CachingByTypeBeanFactory.java
(original)
+++
archiva/redback/redback-components/trunk/spring-utils/src/main/java/org/apache/archiva/redback/components/springutils/CachingByTypeBeanFactory.java
Fri Sep 7 08:16:29 2012
@@ -59,6 +59,7 @@ public class CachingByTypeBeanFactory
return cachedBeanNamesForType.get( typeKey );
}
String[] value = super.getBeanNamesForType( type,
includeNonSingletons, allowEagerInit );
+ // using this pattern as we prevent building a List
if ( log.isDebugEnabled() )
{
log.debug( "will add to cache: {} : {}", typeKey, Arrays.asList(
value ) );