You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by kg...@apache.org on 2011/12/14 01:00:25 UTC
svn commit: r1213991 -
/felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/main/java/org/apache/felix/httplite/server/Server.java
Author: kgilmer
Date: Wed Dec 14 00:00:25 2011
New Revision: 1213991
URL: http://svn.apache.org/viewvc?rev=1213991&view=rev
Log:
httplite: clean up benign stacktrae on bundle shutdown.
Modified:
felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/main/java/org/apache/felix/httplite/server/Server.java
Modified: felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/main/java/org/apache/felix/httplite/server/Server.java
URL: http://svn.apache.org/viewvc/felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/main/java/org/apache/felix/httplite/server/Server.java?rev=1213991&r1=1213990&r2=1213991&view=diff
==============================================================================
--- felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/main/java/org/apache/felix/httplite/server/Server.java (original)
+++ felix/sandbox/kgilmer/httplite-test-pojosr/httplite/src/main/java/org/apache/felix/httplite/server/Server.java Wed Dec 14 00:00:25 2011
@@ -106,6 +106,11 @@ public class Server
private final int m_connectionRequestLimit;
private ServiceRegistrationResolver m_resolver;
private final Logger m_logger;
+
+ /**
+ * Set to true when bundle is in a stopping state. Socket errors will be ignored.
+ */
+ private boolean m_stopping = false;
/**
* Construct a web server with the specified configuration. The configuration
@@ -344,8 +349,11 @@ public class Server
}
catch (IOException ex)
{
- m_logger.log(Logger.LOG_ERROR,
- "The call to accept() terminated with an exception.", ex);
+ if (!m_stopping)
+ {
+ m_logger.log(Logger.LOG_ERROR,
+ "The call to accept() terminated with an exception.", ex);
+ }
}
}
@@ -387,4 +395,16 @@ public class Server
}
m_logger.log(Logger.LOG_DEBUG, "Shutdown complete.");
}
+
+ /**
+ * Sets the stopping flag to true. Socket exceptions will not be logged. Method can only be called once.
+ */
+ public void setStopping() {
+ if (m_stopping)
+ {
+ throw new IllegalStateException("setStopping() called multiple times.");
+ }
+
+ m_stopping = true;
+ }
}
\ No newline at end of file