Author: richard.opalka(a)jboss.com
Date: 2012-12-19 02:39:39 -0500 (Wed, 19 Dec 2012)
New Revision: 17130
Modified:
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
Log:
fixing synchronization issues
Modified:
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java
===================================================================
---
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java 2012-12-18
17:20:00 UTC (rev 17129)
+++
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngine.java 2012-12-19
07:39:39 UTC (rev 17130)
@@ -62,23 +62,23 @@
this.host = host;
this.port = port;
}
-
- public Bus getBus()
+
+ public synchronized Bus getBus()
{
return bus;
}
- public String getProtocol()
+ public synchronized String getProtocol()
{
return protocol;
}
- public int getPort()
+ public synchronized int getPort()
{
return port;
}
- public String getHost()
+ public synchronized String getHost()
{
return host;
}
@@ -112,7 +112,7 @@
/**
* This method is called by the ServerEngine Factory to destroy the server
*/
- protected void stop() throws Exception
+ protected synchronized void stop() throws Exception
{
if (server != null)
{
@@ -124,7 +124,7 @@
* This method will shut down the server engine and
* remove it from the factory's cache.
*/
- public void shutdown()
+ public synchronized void shutdown()
{
if (factory != null && handlerCount == 0)
{
Modified:
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java
===================================================================
---
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java 2012-12-18
17:20:00 UTC (rev 17129)
+++
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineFactory.java 2012-12-19
07:39:39 UTC (rev 17130)
@@ -44,7 +44,7 @@
*/
public class HttpServerEngineFactory implements BusLifeCycleListener
{
- private static final Logger LOG =
LogUtils.getL7dLogger(HttpServerEngineFactory.class);
+ private static final Logger LOG =
LogUtils.getL7dLogger(HttpServerEngineFactory.class);
private static Map<Integer, HttpServerEngine> portMap = new HashMap<Integer,
HttpServerEngine>();
private BusLifeCycleManager lifeCycleManager;
@@ -148,9 +148,12 @@
public void postShutdown()
{
// shut down the httpserver in the portMap
- // To avoid the CurrentModificationException,
- // do not use portMap.vaules directly
- HttpServerEngine[] engines = portMap.values().toArray(new HttpServerEngine[0]);
+ // To avoid the CurrentModificationException,
+ // do not use portMap.vaules directly
+ HttpServerEngine[] engines = null;
+ synchronized (portMap) {
+ engines = portMap.values().toArray(new HttpServerEngine[0]);
+ }
for (HttpServerEngine engine : engines)
{
if (engine.getBus() == getBus())
Show replies by date