[infinispan-commits] Infinispan SVN: r1952 - in branches/4.1.x: server/core/src/main/scala/org/infinispan/server/core and 1 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Thu Jul 1 11:34:14 EDT 2010
Author: galder.zamarreno at jboss.com
Date: 2010-07-01 11:34:13 -0400 (Thu, 01 Jul 2010)
New Revision: 1952
Modified:
branches/4.1.x/pom.xml
branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala
branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala
Log:
[ISPN-496] (TimeoutException sometimes thrown when clustered Hot Rod server is stopped) Fixed by making sure Infinispan does not use its shutdown hook when Infinispan servers are in use. Added a minimal distribution profile as well to speed up testing.
Modified: branches/4.1.x/pom.xml
===================================================================
--- branches/4.1.x/pom.xml 2010-07-01 15:00:41 UTC (rev 1951)
+++ branches/4.1.x/pom.xml 2010-07-01 15:34:13 UTC (rev 1952)
@@ -34,7 +34,7 @@
<module>server/core</module>
<module>server/memcached</module>
<module>server/hotrod</module>
-<!-- <module>server/websocket</module> -->
+ <module>server/websocket</module>
<module>server/rest</module>
<module>client/hotrod-client</module>
<module>jopr-plugin</module>
@@ -185,6 +185,52 @@
</build>
</profile>
+ <profile>
+ <id>minimal-distribution</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <properties>
+ <maven.test.skip.exec>true</maven.test.skip.exec>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jar</id>
+ <phase>none</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-3</version>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/resources/assemblies/all.xml</descriptor>
+ </descriptors>
+ <finalName>${artifactId}-${project.version}</finalName>
+ <outputDirectory>target/distribution</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
<!-- TODO somehow combine this with the 'distribution' profile so all docs are built together -->
<profile>
<id>jmxdoc</id>
Modified: branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala
===================================================================
--- branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala 2010-07-01 15:00:41 UTC (rev 1951)
+++ branches/4.1.x/server/core/src/main/scala/org/infinispan/server/core/Main.scala 2010-07-01 15:34:13 UTC (rev 1952)
@@ -11,6 +11,7 @@
import org.infinispan.Version
import org.infinispan.manager.{CacheContainer, DefaultCacheManager}
import java.util.Properties
+import org.infinispan.config.GlobalConfiguration.ShutdownHookBehavior
/**
* Main class for server startup.
@@ -160,6 +161,10 @@
val configFile = props.getProperty(PROP_KEY_CACHE_CONFIG)
val cacheManager = if (configFile == null) new DefaultCacheManager else new DefaultCacheManager(configFile)
+ // Servers need a shutdown hook to close down network layer, so there's no need for an extra shutdown hook.
+ // Removing Infinispan's hook also makes shutdown procedures for server and cache manager sequential, avoiding
+ // issues with having the JGroups channel disconnected before it's removed itself from the topology view.
+ cacheManager.getGlobalConfiguration.setShutdownHookBehavior(ShutdownHookBehavior.DONT_REGISTER)
addShutdownHook(new ShutdownHook(server, cacheManager))
server.start(props, cacheManager)
}
@@ -277,11 +282,19 @@
}
}
-private class ShutdownHook(server: ProtocolServer, cacheManager: CacheContainer) extends Thread {
+private class ShutdownHook(server: ProtocolServer, cacheManager: CacheContainer) extends Thread with Logging {
+
+ // Constructor code inline
+ setName("ShutdownHookThread")
+
override def run {
if (server != null) {
- System.out.println("Posting Shutdown Request to the server...")
- var f = Executors.newSingleThreadExecutor.submit(new Callable[Void] {
+ info("Posting Shutdown Request to the server...")
+ val tf = new ThreadFactory {
+ override def newThread(r: Runnable): Thread = new Thread(r, "StopThread")
+ }
+
+ var f = Executors.newSingleThreadExecutor(tf).submit(new Callable[Void] {
override def call = {
server.stop
cacheManager.stop
Modified: branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala
===================================================================
--- branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala 2010-07-01 15:00:41 UTC (rev 1951)
+++ branches/4.1.x/server/hotrod/src/main/scala/org/infinispan/server/hotrod/HotRodServer.scala 2010-07-01 15:34:13 UTC (rev 1952)
@@ -112,6 +112,7 @@
if (isDebug) debug("Cluster member {0} was not filtered out of the current view {1}", address, currentView)
} else {
val newView = TopologyView(currentView.topologyId + 1, newMembers)
+ // TODO: Consider replace with 0 lock timeout and fail silently to avoid hold ups. Crash member detector can deal with any failures.
val replaced = topologyCache.replace("view", currentView, newView)
if (isDebug && !replaced) {
debug("Attempt to update topology view failed due to a concurrent modification. " +
More information about the infinispan-commits
mailing list