You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by dj...@apache.org on 2012/09/05 23:49:38 UTC

svn commit: r1381409 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java

Author: djencks
Date: Wed Sep  5 21:49:38 2012
New Revision: 1381409

URL: http://svn.apache.org/viewvc?rev=1381409&view=rev
Log:
FELIX-3645 Only record locking history with debug logging enabled

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java?rev=1381409&r1=1381408&r2=1381409&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java Wed Sep  5 21:49:38 2012
@@ -169,7 +169,10 @@ public abstract class AbstractComponentM
     //ImmediateComponentHolder should be in this manager package and this should be default access.
     public final boolean obtainReadLock( String source )
     {
-        lockingActivity.add( "obtainReadLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        if ( isLogEnabled( LogService.LOG_DEBUG ) )
+        {
+            lockingActivity.add( "obtainReadLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        }
         if (m_stateLock.getReadHoldCount() >0)
         {
             return false;
@@ -200,7 +203,10 @@ public abstract class AbstractComponentM
 
     public final void releaseReadLock( String source )
     {
-        lockingActivity.add( "releaseReadLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        if ( isLogEnabled( LogService.LOG_DEBUG ) )
+        {
+            lockingActivity.add( "releaseReadLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        }
         try
         {
             m_stateLock.unlockReadLock();
@@ -220,7 +226,10 @@ public abstract class AbstractComponentM
 
     final void obtainWriteLock( String source )
     {
-        lockingActivity.add( "obtainWriteLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        if ( isLogEnabled( LogService.LOG_DEBUG ) )
+        {
+            lockingActivity.add( "obtainWriteLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        }
         try
         {
             if (!m_stateLock.tryWriteLock( m_timeout ) )
@@ -240,7 +249,10 @@ public abstract class AbstractComponentM
 
     final void deescalateLock( String source )
     {
-        lockingActivity.add( "deescalateLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        if ( isLogEnabled( LogService.LOG_DEBUG ) )
+        {
+            lockingActivity.add( "deescalateLock from: " +  source + " readLocks: " + m_stateLock.getReadHoldCount() + " writeLocks: " + m_stateLock.getWriteHoldCount() + " thread: " + Thread.currentThread() + " time: " + System.currentTimeMillis());
+        }
         m_stateLock.deescalate();
         lockingThread = null;
         lockingStackTrace = null;