Skip to content
Browse files

AS7-3470 ChannelService and dependent services should start asynchron…

…ously

Cleanup logging mess.
  • Loading branch information...
1 parent bd16bfa commit f4bfb891a9da0f052235299ad33d43bdf9ec7493 @pferraro pferraro committed
Showing with 435 additions and 475 deletions.
  1. +1 −1 build/src/main/resources/modules/org/jboss/as/clustering/common/main/module.xml
  2. +1 −0 build/src/main/resources/modules/org/jboss/as/clustering/registry/main/module.xml
  3. +1 −0 build/src/main/resources/modules/org/jboss/as/clustering/singleton/main/module.xml
  4. +1 −0 build/src/main/resources/modules/org/jboss/as/clustering/web/infinispan/main/module.xml
  5. +86 −2 clustering/api/src/main/java/org/jboss/as/clustering/ClusteringApiLogger.java
  6. +39 −17 clustering/api/src/main/java/org/jboss/as/clustering/ClusteringApiMessages.java
  7. +4 −13 clustering/common/pom.xml
  8. +77 −0 clustering/common/src/main/java/org/jboss/as/clustering/AsynchronousService.java
  9. +0 −125 clustering/common/src/main/java/org/jboss/as/clustering/ClusteringLogger.java
  10. +0 −135 clustering/common/src/main/java/org/jboss/as/clustering/ClusteringMessages.java
  11. +2 −2 clustering/impl/src/main/java/org/jboss/as/clustering/AsynchEventHandler.java
  12. +22 −22 clustering/impl/src/main/java/org/jboss/as/clustering/ClusteringImplLogger.java
  13. +3 −3 clustering/impl/src/main/java/org/jboss/as/clustering/ClusteringImplMessages.java
  14. +11 −9 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/InfinispanLogger.java
  15. +59 −4 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/InfinispanMessages.java
  16. +12 −24 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheService.java
  17. +10 −21 ...ispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/EmbeddedCacheManagerService.java
  18. +1 −1 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_0.java
  19. +0 −6 .../src/main/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_1.java
  20. +6 −5 clustering/jgroups/src/main/java/org/jboss/as/clustering/jgroups/JGroupsLogger.java
  21. +14 −5 clustering/jgroups/src/main/java/org/jboss/as/clustering/jgroups/JGroupsMessages.java
  22. +14 −19 clustering/jgroups/src/main/java/org/jboss/as/clustering/jgroups/subsystem/ChannelService.java
  23. +22 −3 ...ring/jgroups/src/main/java/org/jboss/as/clustering/jgroups/subsystem/ProtocolDefaultsService.java
  24. +16 −26 clustering/registry/src/main/java/org/jboss/as/clustering/registry/RegistryService.java
  25. +2 −2 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonLogger.java
  26. +1 −1 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonMessages.java
  27. +12 −6 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonService.java
  28. +7 −7 ...ring/web-infinispan/src/main/java/org/jboss/as/clustering/web/infinispan/InfinispanWebLogger.java
  29. +1 −2 ...ng/web-infinispan/src/main/java/org/jboss/as/clustering/web/infinispan/InfinispanWebMessages.java
  30. +6 −5 clustering/web-spi/src/main/java/org/jboss/as/clustering/web/impl/ClusteringWebLogger.java
  31. +4 −5 clustering/web-spi/src/main/java/org/jboss/as/clustering/web/impl/ClusteringWebMessages.java
  32. +0 −4 .../web-spi/src/main/java/org/jboss/as/clustering/web/impl/IncomingDistributableSessionDataImpl.java
View
2 build/src/main/resources/modules/org/jboss/as/clustering/common/main/module.xml
@@ -33,6 +33,6 @@
<dependencies>
<module name="org.jboss.threads"/>
- <module name="org.jboss.logging"/>
+ <module name="org.jboss.msc"/>
</dependencies>
</module>
View
1 build/src/main/resources/modules/org/jboss/as/clustering/registry/main/module.xml
@@ -30,6 +30,7 @@
<dependencies>
<module name="org.infinispan"/>
+ <module name="org.jboss.as.clustering.common"/>
<module name="org.jboss.as.clustering.infinispan"/>
<module name="org.jboss.msc"/>
</dependencies>
View
1 build/src/main/resources/modules/org/jboss/as/clustering/singleton/main/module.xml
@@ -33,6 +33,7 @@
<dependencies>
<module name="org.jboss.as.clustering.api"/>
+ <module name="org.jboss.as.clustering.common"/>
<module name="org.jboss.as.clustering.impl"/>
<module name="org.jboss.as.clustering.service"/>
<module name="org.jboss.logging"/>
View
1 build/src/main/resources/modules/org/jboss/as/clustering/web/infinispan/main/module.xml
@@ -33,6 +33,7 @@
<dependencies>
<module name="org.jboss.as.clustering.api"/>
+ <module name="org.jboss.as.clustering.common"/>
<module name="org.jboss.as.clustering.impl"/>
<module name="org.jboss.as.clustering.infinispan"/>
<module name="org.jboss.as.clustering.registry"/>
View
88 clustering/api/src/main/java/org/jboss/as/clustering/ClusteringApiLogger.java
@@ -23,6 +23,7 @@
package org.jboss.as.clustering;
import org.jboss.logging.BasicLogger;
+import org.jboss.logging.Cause;
import org.jboss.logging.LogMessage;
import org.jboss.logging.Logger;
import org.jboss.logging.Message;
@@ -31,6 +32,7 @@
import java.io.Serializable;
import static org.jboss.logging.Logger.Level.ERROR;
+import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;
/**
@@ -49,13 +51,95 @@
ClusteringApiLogger ROOT_LOGGER = Logger.getMessageLogger(ClusteringApiLogger.class, ROOT_LOGGER_CATEGORY);
/**
+ * Logs a warning message indicating an exception was thrown invoking a method, represented by the
+ * {@code methodName} parameter, on the service, represented by the {@code serviceName} parameter, asynchronously.
+ *
+ * @param cause the cause of the error.
+ * @param methodName the method name.
+ * @param serviceName the service name.
+ */
+ @LogMessage(level = WARN)
+ @Message(id = 10200, value = "Caught exception asynchronously invoking method %s on service %s")
+ void caughtErrorInvokingAsyncMethod(@Cause Throwable cause, String methodName, String serviceName);
+
+ /**
+ * Logs an error message indicating a failure to disconnect the channel.
+ *
+ * @param cause the cause of the error.
+ */
+ @LogMessage(level = ERROR)
+ @Message(id = 10201, value = "Channel disconnection failed")
+ void channelDisconnectError(@Cause Throwable cause);
+
+ /**
+ * Logs a warning message indicating the attribute on the element is deprecated.
+ *
+ * @param attributeName the attribute name.
+ * @param elementName the element name.
+ * @param reference a reference description.
+ */
+ @LogMessage(level = WARN)
+ @Message(id = 10202, value = "The %s attribute of the %s element is deprecated. See %s")
+ void deprecatedAttribute(String attributeName, String elementName, String reference);
+
+ /**
+ * Logs an error message indicating a throwable was caught during an asynchronous event.
+ *
+ * @param cause the cause of the error.
+ */
+ @LogMessage(level = ERROR)
+ @Message(id = 10203, value = "Caught Throwable handling asynch events")
+ void errorHandlingAsyncEvent(@Cause Throwable cause);
+
+ /**
+ * Logs an error message indicating the property represented by the {@code propertyName} parameter failed to be set
+ * from the service represented by the {@code serviceName} parameter.
+ *
+ * @param cause the cause of the error.
+ * @param propertyName the property name.
+ * @param serviceName the service name.
+ */
+ @LogMessage(level = ERROR)
+ @Message(id = 10204, value = "failed setting %s for service %s")
+ void failedSettingServiceProperty(@Cause Throwable cause, String propertyName, String serviceName);
+
+ /**
+ * Logs a warning message indicating the service represented by the {@code serviceName} parameter failed to stop.
+ *
+ * @param cause the cause of the error.
+ * @param serviceName the service name.
+ */
+ @LogMessage(level = WARN)
+ @Message(id = 10205, value = "Failed to stop %s")
+ void failedToStop(@Cause Throwable cause, String serviceName);
+
+ /**
+ * Logs an informational message indicating the number of cluster members.
+ *
+ * @param size the number of cluster members.
+ */
+ @LogMessage(level = INFO)
+ @Message(id = 10206, value = "Number of cluster members: %d")
+ void numberOfClusterMembers(int size);
+
+ /**
+ * Logs an error message indicating the thread was interrupted.
+ *
+ * @param cause the cause of the error.
+ * @param name the name of the thread.
+ */
+ @LogMessage(level = ERROR)
+ @Message(id = 10207, value = "%s Thread interrupted")
+ void threadInterrupted(@Cause Throwable cause, String name);
+
+ /**
* Logs an error message indicating an {@link InterruptedException} was issued by the caller.
*
* @param caller the object that caused the exception.
* @param categoryName the category name.
*/
@LogMessage(level = ERROR)
- @Message(id = 10240, value = "Caught InterruptedException; Failing request by %s to lock %s")
+ @Message(id = 10208, value = "Caught InterruptedException; Failing request by %s to lock %s")
void caughtInterruptedException(Object caller, Serializable categoryName);
@@ -63,6 +147,6 @@
* Logs a warning message indicating a call to {@code remoteLock} was called from itself.
*/
@LogMessage(level = WARN)
- @Message(id = 10241, value = "Received remoteLock call from self")
+ @Message(id = 10209, value = "Received remoteLock call from self")
void receivedRemoteLockFromSelf();
}
View
56 clustering/api/src/main/java/org/jboss/as/clustering/ClusteringApiMessages.java
@@ -42,13 +42,45 @@
ClusteringApiMessages MESSAGES = Messages.getBundle(ClusteringApiMessages.class);
/**
+ * Creates an exception indicating a raw throwable was caught on a remote invocation.
+ *
+ * @param cause the cause of the error.
+ *
+ * @return a {@link RuntimeException} for the error.
+ */
+ @Message(id = 10220, value = "Caught raw Throwable on remote invocation")
+ RuntimeException caughtRemoteInvocationThrowable(@Cause Throwable cause);
+
+ /**
+ * Creates an exception indicating a variable is {@code null}.
+ *
+ * @param name the name of the variable.
+ *
+ * @return an {@link IllegalArgumentException} for the error.
+ */
+ @Message(id = 10221, value = "%s is null")
+ IllegalArgumentException nullVar(String name);
+
+ /**
+ * Creates an exception indicating the variable represented the {@code name} parameter must be set before invoking
+ * the method represented by the {@code methodName}.
+ *
+ * @param name the variable name.
+ * @param methodName the method name.
+ *
+ * @return an {@link IllegalStateException} for the error.
+ */
+ @Message(id = 10222, value = "Must set %s before calling %s")
+ IllegalStateException varNotSet(String name, String methodName);
+
+ /**
* A message indicating a lock could not be acquired from a cluster.
*
* @param lockName the lock name.
*
* @return the message.
*/
- @Message(id = 10245, value = "Cannot acquire lock %s from cluster")
+ @Message(id = 10223, value = "Cannot acquire lock %s from cluster")
String cannotAcquireLock(Serializable lockName);
/**
@@ -56,7 +88,7 @@
*
* @return the message.
*/
- @Message(id = 10246, value = "Unable to acquire lock as it is held by unknown")
+ @Message(id = 10224, value = "Unable to acquire lock as it is held by unknown")
String cannotAcquireHeldLock();
/**
@@ -66,7 +98,7 @@
*
* @return the message.
*/
- @Message(id = 10247, value = "Unable to acquire lock as it is held by %s")
+ @Message(id = 10225, value = "Unable to acquire lock as it is held by %s")
String cannotAcquireHeldLock(ClusterNode node);
/**
@@ -79,7 +111,7 @@
*
* @return an {@link IllegalArgumentException} for the error.
*/
- @Message(id = 10248, value = "%s %s is not compatible with %s %s")
+ @Message(id = 10226, value = "%s %s is not compatible with %s %s")
IllegalArgumentException incompatibleDispatcher(String dispatcherName, GroupRpcDispatcher dispatcher, String notifierName, GroupMembershipNotifier notifier);
/**
@@ -90,27 +122,17 @@
*
* @return an {@link IllegalStateException} for the error.
*/
- @Message(id = 10249, value = "Must call %s before first call to %s")
+ @Message(id = 10227, value = "Must call %s before first call to %s")
IllegalStateException invalidMethodCall(String firstMethod, String secondMethod);
/**
- * Creates an exception indicating a variable is {@code null}.
- *
- * @param name the name of the variable.
- *
- * @return an {@link IllegalArgumentException} for the error.
- */
- @Message(id = 10250, value = "%s is null")
- IllegalArgumentException nullVar(String name);
-
- /**
* Creates an exception indicating an unlock should not be invoked for remote nodes.
*
* @param caller the caller.
*
* @return an {@link IllegalStateException} for the error.
*/
- @Message(id = 10251, value = "Should not receive unlock calls for remote node %s")
+ @Message(id = 10228, value = "Should not receive unlock calls for remote node %s")
IllegalStateException receivedUnlockForRemoteNode(ClusterNode caller);
/**
@@ -120,6 +142,6 @@
*
* @return a {@link RuntimeException} for the error.
*/
- @Message(id = 10252, value = "Failed releasing remote lock")
+ @Message(id = 10229, value = "Failed releasing remote lock")
RuntimeException remoteLockReleaseFailure(@Cause Throwable cause);
}
View
17 clustering/common/pom.xml
@@ -39,23 +39,14 @@
<dependencies>
<dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-processor</artifactId>
- <!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
- projects that depend on this project.-->
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
- <dependency>
<groupId>org.jboss.threads</groupId>
<artifactId>jboss-threads</artifactId>
</dependency>
<dependency>
+ <groupId>org.jboss.msc</groupId>
+ <artifactId>jboss-msc</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-controller</artifactId>
<scope>test</scope>
View
77 clustering/common/src/main/java/org/jboss/as/clustering/AsynchronousService.java
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.as.clustering;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+
+/**
+ * Base service class that executes service start/stop asynchronously.
+ * @author Paul Ferraro
+ */
+public abstract class AsynchronousService<T> implements Service<T> {
+
+ private final Executor executor = Executors.newCachedThreadPool();
+
+ @Override
+ public void start(final StartContext context) throws StartException {
+ Runnable task = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ AsynchronousService.this.start();
+ context.complete();
+ } catch (Exception e) {
+ context.failed(new StartException(e));
+ }
+ }
+ };
+ context.asynchronous();
+ this.executor.execute(task);
+ }
+
+ @Override
+ public void stop(final StopContext context) {
+ Runnable task = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ AsynchronousService.this.stop();
+ } finally {
+ context.complete();
+ }
+ }
+ };
+ context.asynchronous();
+ this.executor.execute(task);
+ }
+
+ protected abstract void start() throws Exception;
+
+ protected abstract void stop();
+}
View
125 clustering/common/src/main/java/org/jboss/as/clustering/ClusteringLogger.java
@@ -1,125 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.as.clustering;
-
-import org.jboss.logging.BasicLogger;
-import org.jboss.logging.Cause;
-import org.jboss.logging.LogMessage;
-import org.jboss.logging.Message;
-import org.jboss.logging.MessageLogger;
-
-import static org.jboss.logging.Logger.Level.ERROR;
-import static org.jboss.logging.Logger.Level.INFO;
-import static org.jboss.logging.Logger.Level.WARN;
-
-/**
- * Date: 16.05.2011
- *
- * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
- */
-@MessageLogger(projectCode = "JBAS")
-public interface ClusteringLogger extends BasicLogger {
- String ROOT_LOGGER_CATEGORY = ClusteringLogger.class.getPackage().getName();
-
- /**
- * Logs a warning message indicating an exception was thrown invoking a method, represented by the
- * {@code methodName} parameter, on the service, represented by the {@code serviceName} parameter, asynchronously.
- *
- * @param cause the cause of the error.
- * @param methodName the method name.
- * @param serviceName the service name.
- */
- @LogMessage(level = WARN)
- @Message(id = 10200, value = "Caught exception asynchronously invoking method %s on service %s")
- void caughtErrorInvokingAsyncMethod(@Cause Throwable cause, String methodName, String serviceName);
-
- /**
- * Logs an error message indicating a failure to disconnect the channel.
- *
- * @param cause the cause of the error.
- */
- @LogMessage(level = ERROR)
- @Message(id = 10202, value = "Channel disconnection failed")
- void channelDisconnectError(@Cause Throwable cause);
-
- /**
- * Logs a warning message indicating the attribute on the element is deprecated.
- *
- * @param attributeName the attribute name.
- * @param elementName the element name.
- * @param reference a reference description.
- */
- @LogMessage(level = WARN)
- @Message(id = 10203, value = "The %s attribute of the %s element is deprecated. See %s")
- void deprecatedAttribute(String attributeName, String elementName, String reference);
-
- /**
- * Logs an error message indicating a throwable was caught during an asynchronous event.
- *
- * @param cause the cause of the error.
- */
- @LogMessage(level = ERROR)
- @Message(id = 10204, value = "Caught Throwable handling asynch events")
- void errorHandlingAsyncEvent(@Cause Throwable cause);
-
- /**
- * Logs an error message indicating the property represented by the {@code propertyName} parameter failed to be set
- * from the service represented by the {@code serviceName} parameter.
- *
- * @param cause the cause of the error.
- * @param propertyName the property name.
- * @param serviceName the service name.
- */
- @LogMessage(level = ERROR)
- @Message(id = 10205, value = "failed setting %s for service %s")
- void failedSettingServiceProperty(@Cause Throwable cause, String propertyName, String serviceName);
-
- /**
- * Logs a warning message indicating the service represented by the {@code serviceName} parameter failed to stop.
- *
- * @param cause the cause of the error.
- * @param serviceName the service name.
- */
- @LogMessage(level = WARN)
- @Message(id = 10206, value = "Failed to stop %s")
- void failedToStop(@Cause Throwable cause, String serviceName);
-
- /**
- * Logs an informational message indicating the number of cluster members.
- *
- * @param size the number of cluster members.
- */
- @LogMessage(level = INFO)
- @Message(id = 10207, value = "Number of cluster members: %d")
- void numberOfClusterMembers(int size);
-
- /**
- * Logs an error message indicating the thread was interrupted.
- *
- * @param cause the cause of the error.
- * @param name the name of the thread.
- */
- @LogMessage(level = ERROR)
- @Message(id = 10208, value = "%s Thread interrupted")
- void threadInterrupted(@Cause Throwable cause, String name);
-}
View
135 clustering/common/src/main/java/org/jboss/as/clustering/ClusteringMessages.java
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.as.clustering;
-
-import org.jboss.logging.Cause;
-import org.jboss.logging.Message;
-import org.jboss.logging.MessageBundle;
-
-import java.util.Properties;
-
-/**
- * Date: 18.05.2011
- *
- * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
- */
-@MessageBundle(projectCode = "JBAS")
-public interface ClusteringMessages {
-
- /**
- * Creates an exception indicating that the cache is aborting after the specified number of retries.
- *
- * @param cause the cause of the error.
- * @param numberOfRetries the number of retries.
- *
- * @return a {@link RuntimeException}
- */
- @Message(id = 10220, value = "Aborting cache operation after %d retries.")
- RuntimeException abortingCacheOperation(@Cause Throwable cause, int numberOfRetries);
-
- /**
- * Creates an exception indicating a raw throwable was caught on a remote invocation.
- *
- * @param cause the cause of the error.
- *
- * @return a {@link RuntimeException} for the error.
- */
- @Message(id = 10221, value = "Caught raw Throwable on remote invocation")
- RuntimeException caughtRemoteInvocationThrowable(@Cause Throwable cause);
-
- /**
- * Creates an exception indicating an invalid cache store.
- *
- * @param cause the cause of the error.
- * @param cacheStoreName the name of the cache store.
- *
- * @return an {@link IllegalArgumentException} for the error.
- */
- @Message(id = 10222, value = "%s is not a valid cache store")
- IllegalArgumentException invalidCacheStore(@Cause Throwable cause, String cacheStoreName);
-
- /**
- * Creates an exception indicating an invalid cache store.
- *
- * @param cacheStoreName the name of the cache store.
- * @param cacheContainerName the container name.
- *
- * @return an {@link IllegalArgumentException} for the error.
- */
- @Message(id = 10223, value = "%s is not a valid default cache. The %s cache container does not contain a cache with that name")
- IllegalArgumentException invalidCacheStore(String cacheStoreName, String cacheContainerName);
-
- /**
- * Creates an exception indicating the an executor property is invalid.
- *
- * @param id the id of the property.
- * @param properties the properties that were searched.
- *
- * @return an {@link IllegalStateException} for the error.
- */
- @Message(id = 10224, value = "No %s property was specified within the executor properties: %s")
- IllegalStateException invalidExecutorProperty(String id, Properties properties);
-
- /**
- * Creates an exception indicating the an transport property is invalid.
- *
- * @param id the id of the property.
- * @param properties the properties that were searched.
- *
- * @return an {@link IllegalStateException} for the error.
- */
- @Message(id = 10225, value = "No %s property was specified within the transport properties: %s")
- IllegalStateException invalidTransportProperty(String id, Properties properties);
-
- /**
- * A message indicating a resource could not be located.
- *
- * @param resource the resource that could not be located.
- *
- * @return the message.
- */
- @Message(id = 10226, value = "Failed to locate %s")
- String notFound(String resource);
-
- /**
- * Creates an exception indicating a variable is {@code null}.
- *
- * @param name the name of the variable.
- *
- * @return an {@link IllegalArgumentException} for the error.
- */
- @Message(id = 10227, value = "%s is null")
- IllegalArgumentException nullVar(String name);
-
- /**
- * Creates an exception indicating the variable represented the {@code name} parameter must be set before invoking
- * the method represented by the {@code methodName}.
- *
- * @param name the variable name.
- * @param methodName the method name.
- *
- * @return an {@link IllegalStateException} for the error.
- */
- @Message(id = 10228, value = "Must set %s before calling %s")
- IllegalStateException varNotSet(String name, String methodName);
-}
View
4 clustering/impl/src/main/java/org/jboss/as/clustering/AsynchEventHandler.java
@@ -50,7 +50,7 @@
private AsynchEventProcessor processor;
private boolean stopped = true;
private Thread handlerThread;
- private final ClusteringLogger log;
+ private final ClusteringImplLogger log;
/**
* Create a new AsynchEventHandler.
@@ -65,7 +65,7 @@ public AsynchEventHandler(AsynchEventProcessor processor, String name) {
if (name == null)
name = "AsynchEventHandler";
this.name = name;
- this.log = Logger.getMessageLogger(ClusteringLogger.class, processor.getClass().getName() + "." + name);
+ this.log = Logger.getMessageLogger(ClusteringImplLogger.class, processor.getClass().getName() + "." + name);
}
/**
View
44 clustering/impl/src/main/java/org/jboss/as/clustering/ClusteringImplLogger.java
@@ -22,6 +22,12 @@
package org.jboss.as.clustering;
+import static org.jboss.logging.Logger.Level.ERROR;
+import static org.jboss.logging.Logger.Level.INFO;
+import static org.jboss.logging.Logger.Level.WARN;
+
+import java.util.Collection;
+
import org.jboss.as.clustering.CoreGroupCommunicationService.GroupView;
import org.jboss.logging.Cause;
import org.jboss.logging.LogMessage;
@@ -29,19 +35,13 @@
import org.jboss.logging.MessageLogger;
import org.jgroups.Address;
-import java.util.Collection;
-
-import static org.jboss.logging.Logger.Level.ERROR;
-import static org.jboss.logging.Logger.Level.INFO;
-import static org.jboss.logging.Logger.Level.WARN;
-
/**
* Date: 26.08.2011
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageLogger(projectCode = "JBAS")
-interface ClusteringImplLogger extends ClusteringLogger {
+interface ClusteringImplLogger extends ClusteringApiLogger {
/**
* Logs an error message indicating an error occurred while destroying the service.
@@ -49,7 +49,7 @@
* @param cause the cause of the error.
*/
@LogMessage(level = ERROR)
- @Message(id = 10260, value = "Error destroying service")
+ @Message(id = 10240, value = "Error destroying service")
void errorDestroyingService(@Cause Throwable cause);
/**
@@ -58,7 +58,7 @@
* @param cause the cause of the error.
*/
@LogMessage(level = WARN)
- @Message(id = 10261, value = "Exception in stop")
+ @Message(id = 10241, value = "Exception in stop")
void exceptionInStop(@Cause Throwable cause);
/**
@@ -68,7 +68,7 @@
* @param groupName the partition group name.
*/
@LogMessage(level = WARN)
- @Message(id = 10262, value = "Partition %s message wrapper does not contain Object[] object!")
+ @Message(id = 10242, value = "Partition %s message wrapper does not contain Object[] object!")
void invalidPartitionMessageWrapper(String groupName);
/**
@@ -78,7 +78,7 @@
* @param groupName the partition group name.
*/
@LogMessage(level = WARN)
- @Message(id = 10263, value = "Partition %s message does not contain a MethodCall object!")
+ @Message(id = 10243, value = "Partition %s message does not contain a MethodCall object!")
void invalidPartitionMessage(String groupName);
/**
@@ -88,7 +88,7 @@
* @param listener the listener in error.
*/
@LogMessage(level = WARN)
- @Message(id = 10264, value = "Membership listener callback failure: %s")
+ @Message(id = 10244, value = "Membership listener callback failure: %s")
void memberShipListenerCallbackFailure(@Cause Throwable cause, GroupMembershipListener listener);
/**
@@ -98,7 +98,7 @@
* @param methodName the name of the method that failed.
*/
@LogMessage(level = ERROR)
- @Message(id = 10265, value = "%s failed")
+ @Message(id = 10245, value = "%s failed")
void methodFailure(@Cause Throwable cause, String methodName);
/**
@@ -109,7 +109,7 @@
* @param serviceName the service name.
*/
@LogMessage(level = ERROR)
- @Message(id = 10266, value = "%s failed for service %s")
+ @Message(id = 10246, value = "%s failed for service %s")
void methodFailure(@Cause Throwable cause, String methodName, String serviceName);
/**
@@ -122,7 +122,7 @@
* @param allMembers a collection of all the new members.
*/
@LogMessage(level = INFO)
- @Message(id = 10267, value = "New cluster view for partition %s (id: %d, delta: %d, merge: %b) : %s")
+ @Message(id = 10247, value = "New cluster view for partition %s (id: %d, delta: %d, merge: %b) : %s")
void newClusterCurrentView(String groupName, long viewId, int difference, boolean isMerge, Collection<ClusterNode> allMembers);
/**
@@ -135,7 +135,7 @@
* @param isMerge {@code true} if this was a merge view, otherwise {@code false}.
*/
@LogMessage(level = INFO)
- @Message(id = 10268, value = "New cluster view for partition %s: %d (%s delta: %d, merge: %b)")
+ @Message(id = 10248, value = "New cluster view for partition %s: %d (%s delta: %d, merge: %b)")
void newClusterView(String groupName, long viewId, GroupView groupView, int difference, boolean isMerge);
/**
@@ -146,7 +146,7 @@
* @param serviceName the service name.
*/
@LogMessage(level = WARN)
- @Message(id = 10269, value = "No %s registered to receive state for service %s")
+ @Message(id = 10249, value = "No %s registered to receive state for service %s")
void notRegisteredToReceiveState(String className, String serviceName);
/**
@@ -156,7 +156,7 @@
* @param groupName the partition group name.
*/
@LogMessage(level = WARN)
- @Message(id = 10270, value = "Partition %s message or message buffer is null!")
+ @Message(id = 10250, value = "Partition %s message or message buffer is null!")
void nullPartitionMessage(String groupName);
/**
@@ -167,7 +167,7 @@
* @param groupName the partition group name.
*/
@LogMessage(level = WARN)
- @Message(id = 10271, value = "Partition %s failed extracting message body from request bytes")
+ @Message(id = 10251, value = "Partition %s failed extracting message body from request bytes")
void partitionFailedExtractingMessageBody(@Cause Throwable cause, String groupName);
/**
@@ -179,7 +179,7 @@
* @param request the message.
*/
@LogMessage(level = WARN)
- @Message(id = 10272, value = "Partition %s failed unserializing message buffer (msg=%s)")
+ @Message(id = 10252, value = "Partition %s failed unserializing message buffer (msg=%s)")
void partitionFailedUnserialing(@Cause Throwable cause, String groupName, org.jgroups.Message request);
/**
@@ -188,7 +188,7 @@
* @param serviceName the service name the request was sent for.
*/
@LogMessage(level = WARN)
- @Message(id = 10273, value = "Received concurrent requests to get service state for %s")
+ @Message(id = 10253, value = "Received concurrent requests to get service state for %s")
void receivedConcurrentStateRequests(String serviceName);
/**
@@ -197,6 +197,6 @@
* @param suspectedMember the suspected member.
*/
@LogMessage(level = INFO)
- @Message(id = 10274, value = "Suspected member: %s")
+ @Message(id = 10254, value = "Suspected member: %s")
void suspectedMember(Address suspectedMember);
}
View
6 clustering/impl/src/main/java/org/jboss/as/clustering/ClusteringImplMessages.java
@@ -22,21 +22,21 @@
package org.jboss.as.clustering;
+import java.util.Collection;
+
import org.jboss.logging.Cause;
import org.jboss.logging.Message;
import org.jboss.logging.MessageBundle;
import org.jboss.logging.Messages;
import org.jgroups.Address;
-import java.util.Collection;
-
/**
* Date: 26.08.2011
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageBundle(projectCode = "JBAS")
-public interface ClusteringImplMessages extends ClusteringMessages {
+public interface ClusteringImplMessages extends ClusteringApiMessages {
/**
* The messages.
View
20 clustering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/InfinispanLogger.java
@@ -22,15 +22,15 @@
package org.jboss.as.clustering.infinispan;
-import org.jboss.as.clustering.ClusteringLogger;
+import static org.jboss.logging.Logger.Level.INFO;
+import static org.jboss.logging.Logger.Level.WARN;
+
+import org.jboss.logging.BasicLogger;
import org.jboss.logging.LogMessage;
import org.jboss.logging.Logger;
import org.jboss.logging.Message;
import org.jboss.logging.MessageLogger;
-import static org.jboss.logging.Logger.Level.INFO;
-import static org.jboss.logging.Logger.Level.WARN;
-
/**
* Date: 29.08.2011
*
@@ -38,7 +38,9 @@
* @author Tristan Tarrant
*/
@MessageLogger(projectCode = "JBAS")
-public interface InfinispanLogger extends ClusteringLogger {
+public interface InfinispanLogger extends BasicLogger {
+ String ROOT_LOGGER_CATEGORY = InfinispanLogger.class.getPackage().getName();
+
/**
* The root logger.
*/
@@ -48,7 +50,7 @@
* Logs an informational message indicating the Infinispan subsystem is being activated.
*/
@LogMessage(level = INFO)
- @Message(id = 10300, value = "Activating Infinispan subsystem.")
+ @Message(id = 10280, value = "Activating Infinispan subsystem.")
void activatingSubsystem();
/**
@@ -58,7 +60,7 @@
* @param containerName the name of the cache container.
*/
@LogMessage(level = INFO)
- @Message(id = 10301, value = "Started %s cache from %s container")
+ @Message(id = 10281, value = "Started %s cache from %s container")
void cacheStarted(String cacheName, String containerName);
@@ -69,7 +71,7 @@
* @param containerName the name of the cache container.
*/
@LogMessage(level = INFO)
- @Message(id = 10302, value = "Stopped %s cache from %s container")
+ @Message(id = 10282, value = "Stopped %s cache from %s container")
void cacheStopped(String cacheName, String containerName);
@@ -79,6 +81,6 @@
*
*/
@LogMessage(level = WARN)
- @Message(id = 10303, value = "The 'eager' attribute specified on the 'transaction' element of a cache is no longer valid")
+ @Message(id = 10283, value = "The 'eager' attribute specified on the 'transaction' element of a cache is no longer valid")
void eagerAttributeDeprecated();
}
View
63 ...ering/infinispan/src/main/java/org/jboss/as/clustering/infinispan/InfinispanMessages.java
@@ -23,9 +23,9 @@
package org.jboss.as.clustering.infinispan;
import java.net.UnknownHostException;
+import java.util.Properties;
import org.infinispan.configuration.cache.CacheMode;
-import org.jboss.as.clustering.ClusteringMessages;
import org.jboss.as.controller.persistence.ConfigurationPersistenceException;
import org.jboss.as.network.OutboundSocketBinding;
import org.jboss.logging.Cause;
@@ -41,7 +41,7 @@
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageBundle(projectCode = "JBAS")
-public interface InfinispanMessages extends ClusteringMessages {
+public interface InfinispanMessages {
/**
* A logger with the category of the default clustering package.
@@ -57,9 +57,64 @@
*
* @return a {@link ConfigurationPersistenceException} for the error.
*/
- @Message(id = 10310, value = "Could not resolve destination address for outbound socket binding named '%s'")
+ @Message(id = 10290, value = "Could not resolve destination address for outbound socket binding named '%s'")
InjectionException failedToInjectSocketBinding(@Cause UnknownHostException cause, OutboundSocketBinding binding);
- @Message(id = 10311, value = "Failed to add %s %s cache to non-clustered %s cache container.")
+ @Message(id = 10291, value = "Failed to add %s %s cache to non-clustered %s cache container.")
StartException transportRequired(CacheMode mode, String cache, String cacheContainer);
+
+ /**
+ * Creates an exception indicating an invalid cache store.
+ *
+ * @param cause the cause of the error.
+ * @param cacheStoreName the name of the cache store.
+ *
+ * @return an {@link IllegalArgumentException} for the error.
+ */
+ @Message(id = 10292, value = "%s is not a valid cache store")
+ IllegalArgumentException invalidCacheStore(@Cause Throwable cause, String cacheStoreName);
+
+ /**
+ * Creates an exception indicating an invalid cache store.
+ *
+ * @param cacheStoreName the name of the cache store.
+ * @param cacheContainerName the container name.
+ *
+ * @return an {@link IllegalArgumentException} for the error.
+ */
+ @Message(id = 10293, value = "%s is not a valid default cache. The %s cache container does not contain a cache with that name")
+ IllegalArgumentException invalidCacheStore(String cacheStoreName, String cacheContainerName);
+
+ /**
+ * Creates an exception indicating the an executor property is invalid.
+ *
+ * @param id the id of the property.
+ * @param properties the properties that were searched.
+ *
+ * @return an {@link IllegalStateException} for the error.
+ */
+ @Message(id = 10294, value = "No %s property was specified within the executor properties: %s")
+ IllegalStateException invalidExecutorProperty(String id, Properties properties);
+
+ /**
+ * Creates an exception indicating the an transport property is invalid.
+ *
+ * @param id the id of the property.
+ * @param properties the properties that were searched.
+ *
+ * @return an {@link IllegalStateException} for the error.
+ */
+ @Message(id = 10295, value = "No %s property was specified within the transport properties: %s")
+ IllegalStateException invalidTransportProperty(String id, Properties properties);
+
+ /**
+ * Creates an exception indicating that the cache is aborting after the specified number of retries.
+ *
+ * @param cause the cause of the error.
+ * @param numberOfRetries the number of retries.
+ *
+ * @return a {@link RuntimeException}
+ */
+ @Message(id = 10296, value = "Aborting cache operation after %d retries.")
+ RuntimeException abortingCacheOperation(@Cause Throwable cause, int numberOfRetries);
}
View
36 ...g/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheService.java
@@ -27,11 +27,8 @@
import org.infinispan.Cache;
import org.infinispan.manager.CacheContainer;
import org.infinispan.manager.EmbeddedCacheManager;
-import org.jboss.msc.service.Service;
+import org.jboss.as.clustering.AsynchronousService;
import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
import org.jboss.tm.XAResourceRecovery;
import org.jboss.tm.XAResourceRecoveryRegistry;
@@ -39,7 +36,7 @@
* @author Paul Ferraro
* @author Richard Achmatowicz (c) 2011 Red Hat Inc.
*/
-public class CacheService<K, V> implements Service<Cache<K, V>> {
+public class CacheService<K, V> extends AsynchronousService<Cache<K, V>> {
private final Dependencies dependencies;
private final String name;
@@ -69,16 +66,10 @@ public CacheService(String name, Dependencies dependencies) {
return this.cache;
}
- /**
- * {@inheritDoc}
- * @see org.jboss.msc.service.Service#start(org.jboss.msc.service.StartContext)
- */
@Override
- public void start(StartContext context) throws StartException {
-
+ protected void start() {
EmbeddedCacheManager container = this.dependencies.getCacheContainer();
- // get an instance of the defined cache
this.cache = container.getCache(this.name);
this.cache.start();
@@ -88,21 +79,18 @@ public void start(StartContext context) throws StartException {
}
}
- /**
- * {@inheritDoc}
- * @see org.jboss.msc.service.Service#stop(org.jboss.msc.service.StopContext)
- */
@Override
- public void stop(StopContext context) {
- EmbeddedCacheManager container = this.dependencies.getCacheContainer();
- XAResourceRecoveryRegistry recoveryRegistry = this.dependencies.getRecoveryRegistry();
- if (recoveryRegistry != null) {
- recoveryRegistry.addXAResourceRecovery(new InfinispanXAResourceRecovery(this.name, container));
- }
+ protected void stop() {
+ if ((this.cache != null) && this.cache.getStatus().allowInvocations()) {
+ EmbeddedCacheManager container = this.dependencies.getCacheContainer();
- this.cache.stop();
+ XAResourceRecoveryRegistry recoveryRegistry = this.dependencies.getRecoveryRegistry();
+ if (recoveryRegistry != null) {
+ recoveryRegistry.addXAResourceRecovery(new InfinispanXAResourceRecovery(this.name, container));
+ }
- this.cache = null;
+ this.cache.stop();
+ }
}
static class InfinispanXAResourceRecovery implements XAResourceRecovery {
View
31 ...c/main/java/org/jboss/as/clustering/infinispan/subsystem/EmbeddedCacheManagerService.java
@@ -36,17 +36,14 @@
import org.infinispan.notifications.cachemanagerlistener.annotation.CacheStopped;
import org.infinispan.notifications.cachemanagerlistener.event.CacheStartedEvent;
import org.infinispan.notifications.cachemanagerlistener.event.CacheStoppedEvent;
+import org.jboss.as.clustering.AsynchronousService;
import org.jboss.as.clustering.infinispan.ChannelProvider;
import org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager;
import org.jboss.as.clustering.infinispan.ExecutorProvider;
import org.jboss.as.clustering.infinispan.InfinispanLogger;
import org.jboss.as.clustering.infinispan.MBeanServerProvider;
import org.jboss.logging.Logger;
-import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
import org.jgroups.Channel;
import org.jgroups.util.TopologyUUID;
@@ -54,7 +51,7 @@
* @author Paul Ferraro
*/
@Listener
-public class EmbeddedCacheManagerService implements Service<EmbeddedCacheManager> {
+public class EmbeddedCacheManagerService extends AsynchronousService<EmbeddedCacheManager> {
private static final Logger log = Logger.getLogger(EmbeddedCacheManagerService.class.getPackage().getName());
private static final ServiceName SERVICE_NAME = ServiceName.JBOSS.append(InfinispanExtension.SUBSYSTEM_NAME);
@@ -80,7 +77,6 @@ public static ServiceName getServiceName(String name) {
private final String name;
private final String defaultCache;
private final Dependencies dependencies;
-
private volatile EmbeddedCacheManager container;
public EmbeddedCacheManagerService(String name, String defaultCache, Dependencies dependencies) {
@@ -98,12 +94,8 @@ public EmbeddedCacheManager getValue() throws IllegalStateException, IllegalArgu
return this.container;
}
- /**
- * {@inheritDoc}
- * @see org.jboss.msc.service.Service#start(org.jboss.msc.service.StartContext)
- */
@Override
- public void start(StartContext context) throws StartException {
+ protected void start() {
GlobalConfigurationBuilder globalBuilder = new GlobalConfigurationBuilder();
globalBuilder
@@ -125,7 +117,7 @@ public void start(StartContext context) throws StartException {
// Topology is retrieved from the channel
Channel channel = transport.getChannel();
if(channel.getAddress() instanceof TopologyUUID) {
- TopologyUUID topologyAddress = (TopologyUUID)channel.getAddress();
+ TopologyUUID topologyAddress = (TopologyUUID) channel.getAddress();
String site = topologyAddress.getSiteId();
if (site != null) {
transportBuilder.siteId(site);
@@ -188,16 +180,13 @@ public void start(StartContext context) throws StartException {
log.debugf("%s cache container started", this.name);
}
- /**
- * {@inheritDoc}
- * @see org.jboss.msc.service.Service#stop(org.jboss.msc.service.StopContext)
- */
@Override
- public void stop(StopContext context) {
- this.container.stop();
- this.container.removeListener(this);
- log.debugf("%s cache container stopped", this.name);
- this.container = null;
+ protected void stop() {
+ if ((this.container != null) && this.container.getStatus().allowInvocations()) {
+ this.container.stop();
+ this.container.removeListener(this);
+ log.debugf("%s cache container stopped", this.name);
+ }
}
@CacheStarted
View
2 ...n/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_0.java
@@ -672,7 +672,7 @@ private void parseEviction(XMLExtendedStreamReader reader, ModelNode cache, List
break;
}
case INTERVAL: {
- ROOT_LOGGER.deprecatedAttribute(attribute.getLocalName(), Element.EVICTION.getLocalName(), "ISPN-1268");
+ // Ignore
break;
}
default: {
View
6 ...n/java/org/jboss/as/clustering/infinispan/subsystem/InfinispanSubsystemXMLReader_1_1.java
@@ -1,7 +1,5 @@
package org.jboss.as.clustering.infinispan.subsystem;
-import static org.jboss.as.clustering.infinispan.InfinispanLogger.ROOT_LOGGER;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
@@ -635,10 +633,6 @@ private void parseEviction(XMLExtendedStreamReader reader, ModelNode cache, List
eviction.get(ModelKeys.MAX_ENTRIES).set(Integer.parseInt(value));
break;
}
- case INTERVAL: {
- ROOT_LOGGER.deprecatedAttribute(attribute.getLocalName(), Element.EVICTION.getLocalName(), "ISPN-1268");
- break;
- }
default: {
throw ParseUtils.unexpectedAttribute(reader, i);
}
View
11 clustering/jgroups/src/main/java/org/jboss/as/clustering/jgroups/JGroupsLogger.java
@@ -22,21 +22,22 @@
package org.jboss.as.clustering.jgroups;
-import org.jboss.as.clustering.ClusteringLogger;
+import static org.jboss.logging.Logger.Level.INFO;
+
+import org.jboss.logging.BasicLogger;
import org.jboss.logging.LogMessage;
import org.jboss.logging.Logger;
import org.jboss.logging.Message;
import org.jboss.logging.MessageLogger;
-import static org.jboss.logging.Logger.Level.INFO;
-
/**
* Date: 29.08.2011
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageLogger(projectCode = "JBAS")
-public interface JGroupsLogger extends ClusteringLogger {
+public interface JGroupsLogger extends BasicLogger {
+ String ROOT_LOGGER_CATEGORY = JGroupsLogger.class.getPackage().getName();
/**
* The root logger.
@@ -47,6 +48,6 @@
* Logs an informational message indicating the JGroups subsystem is being activated.
*/
@LogMessage(level = INFO)
- @Message(id = 10360, value = "Activating JGroups subsystem.")
+ @Message(id = 10260, value = "Activating JGroups subsystem.")
void activatingSubsystem();
}
View
19 clustering/jgroups/src/main/java/org/jboss/as/clustering/jgroups/JGroupsMessages.java
@@ -22,20 +22,19 @@
package org.jboss.as.clustering.jgroups;
-import org.jboss.as.clustering.ClusteringMessages;
+import java.net.URL;
+
import org.jboss.logging.Message;
import org.jboss.logging.MessageBundle;
import org.jboss.logging.Messages;
-import java.net.URL;
-
/**
* Date: 29.08.2011
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageBundle(projectCode = "JBAS")
-public interface JGroupsMessages extends ClusteringMessages {
+public interface JGroupsMessages {
/**
* The messages.
*/
@@ -48,6 +47,16 @@
*
* @return the message.
*/
- @Message(id = 10370, value = "Failed to parse %s")
+ @Message(id = 10270, value = "Failed to parse %s")
String parserFailure(URL url);
+
+ /**
+ * A message indicating a resource could not be located.
+ *
+ * @param resource the resource that could not be located.
+ *
+ * @return the message.
+ */
+ @Message(id = 10271, value = "Failed to locate %s")
+ String notFound(String resource);
}
View
33 ...ering/jgroups/src/main/java/org/jboss/as/clustering/jgroups/subsystem/ChannelService.java
@@ -1,20 +1,18 @@
package org.jboss.as.clustering.jgroups.subsystem;
+import org.jboss.as.clustering.AsynchronousService;
import org.jboss.as.clustering.jgroups.ChannelFactory;
-import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.Value;
import org.jgroups.Channel;
import org.jgroups.protocols.pbcast.STATE;
import org.jgroups.protocols.pbcast.STATE_SOCK;
import org.jgroups.protocols.pbcast.STATE_TRANSFER;
-public class ChannelService implements Service<Channel> {
+public class ChannelService extends AsynchronousService<Channel> {
private static final ServiceName SERVICE_NAME = ServiceName.JBOSS.append(JGroupsExtension.SUBSYSTEM_NAME).append("channel");
+ private static final long STATE_TRANSFER_TIMEOUT = 60000;
public static ServiceName getServiceName(String id) {
return SERVICE_NAME.append(id);
@@ -30,27 +28,24 @@ public ChannelService(String id, Value<ChannelFactory> factory) {
}
@Override
- public Channel getValue() throws IllegalStateException, IllegalArgumentException {
+ public Channel getValue() {
return this.channel;
}
@Override
- public void start(StartContext arg0) throws StartException {
- try {
- this.channel = this.factory.getValue().createChannel(this.id);
- if (this.channel.getProtocolStack().findProtocol(STATE_TRANSFER.class, STATE.class, STATE_SOCK.class) != null) {
- this.channel.connect(this.id, null, 0);
- } else {
- this.channel.connect(this.id);
- }
- } catch (Exception e) {
- throw new StartException(e);
+ protected void start() throws Exception {
+ this.channel = this.factory.getValue().createChannel(this.id);
+ if (this.channel.getProtocolStack().findProtocol(STATE_TRANSFER.class, STATE.class, STATE_SOCK.class) != null) {
+ this.channel.connect(this.id, null, STATE_TRANSFER_TIMEOUT);
+ } else {
+ this.channel.connect(this.id);
}
}
@Override
- public void stop(StopContext arg0) {
- this.channel.close();
- this.channel = null;
+ protected void stop() {
+ if ((this.channel != null) && this.channel.isOpen()) {
+ this.channel.close();
+ }
}
}
View
25 ...oups/src/main/java/org/jboss/as/clustering/jgroups/subsystem/ProtocolDefaultsService.java
@@ -27,6 +27,8 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
import org.jboss.as.clustering.jgroups.ProtocolDefaults;
import org.jboss.msc.service.Service;
@@ -50,6 +52,7 @@
private static final String DEFAULTS = "jgroups-defaults.xml";
+ private final Executor executor = Executors.newCachedThreadPool();
private final String resource;
private volatile ProtocolDefaults defaults;
@@ -75,13 +78,29 @@ public ProtocolDefaults getValue() {
* @see org.jboss.msc.service.Service#start(org.jboss.msc.service.StartContext)
*/
@Override
- public void start(StartContext context) throws StartException {
- ProtocolStackConfigurator configurator = load(this.resource);
+ public void start(final StartContext context) throws StartException {
+ Runnable task = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ ProtocolDefaultsService.this.start();
+ context.complete();
+ } catch (StartException e) {
+ context.failed(e);
+ }
+ }
+ };
+ context.asynchronous();
+ this.executor.execute(task);
+ }
+
+ void start() throws StartException {
+ ProtocolStackConfigurator configurator = load(ProtocolDefaultsService.this.resource);
Defaults defaults = new Defaults();
for (org.jgroups.conf.ProtocolConfiguration config: configurator.getProtocolStack()) {
defaults.add(config.getProtocolName(), config.getProperties());
}
- this.defaults = defaults;
+ ProtocolDefaultsService.this.defaults = defaults;
}
private static ProtocolStackConfigurator load(String resource) throws StartException {
View
42 clustering/registry/src/main/java/org/jboss/as/clustering/registry/RegistryService.java
@@ -42,23 +42,20 @@
import org.infinispan.notifications.cachemanagerlistener.annotation.ViewChanged;
import org.infinispan.notifications.cachemanagerlistener.event.ViewChangedEvent;
import org.infinispan.remoting.transport.Address;
+import org.jboss.as.clustering.AsynchronousService;
import org.jboss.as.clustering.infinispan.invoker.BatchOperation;
import org.jboss.as.clustering.infinispan.invoker.CacheInvoker;
import org.jboss.msc.inject.Injector;
-import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceTarget;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
/**
* @author Paul Ferraro
*/
@org.infinispan.notifications.Listener(sync = false)
-public class RegistryService<K, V> implements Service<Registry<K, V>>, Registry<K, V> {
+public class RegistryService<K, V> extends AsynchronousService<Registry<K, V>> implements Registry<K, V> {
static final Address LOCAL_ADDRESS = new Address() {};
@@ -128,13 +125,9 @@ public void removeListener(Listener<K, V> listener) {
return this.cache.get(address);
}
- /**
- * {@inheritDoc}
- * @see org.jboss.msc.service.Service#start(org.jboss.msc.service.StartContext)
- */
@SuppressWarnings("unchecked")
@Override
- public void start(StartContext context) throws StartException {
+ protected void start() {
this.cache = this.cacheRef.getValue();
this.refreshLocalEntry();
this.cache.getCacheManager().addListener(this);
@@ -160,23 +153,20 @@ void addCacheEntry(Cache<Address, Map.Entry<K, V>> cache) {
}
}
- /**
- * {@inheritDoc}
- * @see org.jboss.msc.service.Service#stop(org.jboss.msc.service.StopContext)
- */
@Override
- public void stop(StopContext context) {
- this.cache.removeListener(this);
- this.cache.getCacheManager().removeListener(this);
- Operation<Void> operation = new Operation<Void>() {
- @Override
- public Void invoke(Cache<Address, Map.Entry<K, V>> cache) {
- cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP).remove(getLocalAddress(cache));
- return null;
- }
- };
- this.invoke(operation);
- this.cache = null;
+ protected void stop() {
+ if (this.cache != null) {
+ this.cache.removeListener(this);
+ this.cache.getCacheManager().removeListener(this);
+ Operation<Void> operation = new Operation<Void>() {
+ @Override
+ public Void invoke(Cache<Address, Map.Entry<K, V>> cache) {
+ cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP).remove(getLocalAddress(cache));
+ return null;
+ }
+ };
+ this.invoke(operation);
+ }
}
static Address getLocalAddress(Cache<?, ?> cache) {
View
4 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonLogger.java
@@ -38,10 +38,10 @@
SingletonLogger ROOT_LOGGER = Logger.getMessageLogger(SingletonLogger.class, ROOT_LOGGER_CATEGORY);
@LogMessage(level = INFO)
- @Message(id = 10390, value = "This node will now operate as the singleton provider of the %s service")
+ @Message(id = 10340, value = "This node will now operate as the singleton provider of the %s service")
void electedMaster(String service);
@LogMessage(level = INFO)
- @Message(id = 10391, value = "This node will no longer operate as the singleton provider of the %s service")
+ @Message(id = 10341, value = "This node will no longer operate as the singleton provider of the %s service")
void electedSlave(String service);
}
View
2 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonMessages.java
@@ -39,6 +39,6 @@
*
* @return a {@link ConfigurationPersistenceException} for the error.
*/
- @Message(id = 10395, value = "Expected result from singleton provider only, but instead received %d results.")
+ @Message(id = 10350, value = "Expected result from singleton provider only, but instead received %d results.")
IllegalStateException unexpectedResponseCount(int results);
}
View
18 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonService.java
@@ -29,6 +29,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
+import org.jboss.as.clustering.AsynchronousService;
import org.jboss.as.clustering.ClusterNode;
import org.jboss.as.clustering.GroupRpcDispatcher;
import org.jboss.as.clustering.service.ServiceProviderRegistry;
@@ -47,7 +48,7 @@
* Decorates an MSC service ensuring that it is only started on one node in the cluster at any given time.
* @author Paul Ferraro
*/
-public class SingletonService<T extends Serializable> implements Service<T>, ServiceProviderRegistry.Listener, StopContext, SingletonRpcHandler<T> {
+public class SingletonService<T extends Serializable> extends AsynchronousService<T> implements ServiceProviderRegistry.Listener, StopContext, SingletonRpcHandler<T> {
public static final String DEFAULT_CONTAINER = "cluster";
@@ -57,8 +58,8 @@
private final ServiceName serviceName;
private final AtomicBoolean master = new AtomicBoolean(false);
- private volatile ServiceProviderRegistry registry;
- private volatile GroupRpcDispatcher dispatcher;
+ volatile ServiceProviderRegistry registry;
+ volatile GroupRpcDispatcher dispatcher;
private volatile SingletonElectionPolicy electionPolicy;
private volatile SingletonRpcHandler<T> handler;
private volatile StartContext context;
@@ -87,18 +88,23 @@ public SingletonService(Service<T> service, ServiceName serviceName) {
}
@Override
- public void start(StartContext context) throws StartException {
+ public void start(final StartContext context) throws StartException {
this.context = context;
+ super.start(context);
+ }
+
+ @Override
+ protected void start() {
this.dispatcher = this.dispatcherRef.getValue();
this.registry = this.registryRef.getValue();
- String name = this.serviceName.getCanonicalName();
+ final String name = this.serviceName.getCanonicalName();
this.handler = new RpcHandler(this.dispatcher, name);
this.dispatcher.registerRPCHandler(name, this, SingletonService.class.getClassLoader());
this.registry.register(name, this);
}
@Override
- public void stop(StopContext context) {
+ protected void stop() {
String name = this.serviceName.getCanonicalName();
this.registry.unregister(name);
this.dispatcher.unregisterRPCHandler(name, this);
View
14 ...-infinispan/src/main/java/org/jboss/as/clustering/web/infinispan/InfinispanWebLogger.java
@@ -22,25 +22,26 @@
package org.jboss.as.clustering.web.infinispan;
+import static org.jboss.logging.Logger.Level.DEBUG;
+import static org.jboss.logging.Logger.Level.INFO;
+import static org.jboss.logging.Logger.Level.WARN;
+
import org.infinispan.remoting.transport.Address;
-import org.jboss.as.clustering.ClusteringLogger;
+import org.jboss.logging.BasicLogger;
import org.jboss.logging.Cause;
import org.jboss.logging.LogMessage;
import org.jboss.logging.Logger;
import org.jboss.logging.Message;
import org.jboss.logging.MessageLogger;
-import static org.jboss.logging.Logger.Level.DEBUG;
-import static org.jboss.logging.Logger.Level.INFO;
-import static org.jboss.logging.Logger.Level.WARN;
-
/**
* Date: 29.08.2011
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageLogger(projectCode = "JBAS")
-interface InfinispanWebLogger extends ClusteringLogger {
+interface InfinispanWebLogger extends BasicLogger {
+ String ROOT_LOGGER_CATEGORY = InfinispanWebLogger.class.getPackage().getName();
/**
* A root logger with the clustering default category.
@@ -115,5 +116,4 @@
@LogMessage(level = WARN)
@Message(id = 10325, value = "Possible concurrency problem: Replicated version id %d is less than or equal to in-memory version for session %s")
void versionIdMismatch(int versionId, String sessionId);
-
}
View
3 ...nfinispan/src/main/java/org/jboss/as/clustering/web/infinispan/InfinispanWebMessages.java
@@ -22,7 +22,6 @@
package org.jboss.as.clustering.web.infinispan;
-import org.jboss.as.clustering.ClusteringMessages;
import org.jboss.logging.Cause;
import org.jboss.logging.Message;
import org.jboss.logging.MessageBundle;
@@ -35,7 +34,7 @@
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageBundle(projectCode = "JBAS")
-interface InfinispanWebMessages extends ClusteringMessages {
+interface InfinispanWebMessages {
/**
* The messages
*/
View
11 clustering/web-spi/src/main/java/org/jboss/as/clustering/web/impl/ClusteringWebLogger.java
@@ -22,22 +22,23 @@
package org.jboss.as.clustering.web.impl;
-import org.jboss.as.clustering.ClusteringApiLogger;
+import static org.jboss.logging.Logger.Level.WARN;
+
+import org.jboss.logging.BasicLogger;
import org.jboss.logging.Cause;
import org.jboss.logging.LogMessage;
import org.jboss.logging.Logger;
import org.jboss.logging.Message;
import org.jboss.logging.MessageLogger;
-import static org.jboss.logging.Logger.Level.WARN;
-
/**
* Date: 30.08.2011
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageLogger(projectCode = "JBAS")
-interface ClusteringWebLogger extends ClusteringApiLogger {
+interface ClusteringWebLogger extends BasicLogger {
+ String ROOT_LOGGER_CATEGORY = ClusteringWebLogger.class.getPackage().getName();
/**
* A logger with a category for the root clustering.
@@ -52,6 +53,6 @@
* @param methodName the name of the method the error occurred in.
*/
@LogMessage(level = WARN)
- @Message(id = 10380, value = "%s: rolling back transaction with exception")
+ @Message(id = 10300, value = "%s: rolling back transaction with exception")
void rollingBackTransaction(@Cause Throwable cause, String methodName);
}
View
9 clustering/web-spi/src/main/java/org/jboss/as/clustering/web/impl/ClusteringWebMessages.java
@@ -22,7 +22,6 @@
package org.jboss.as.clustering.web.impl;
-import org.jboss.as.clustering.ClusteringApiMessages;
import org.jboss.logging.Cause;
import org.jboss.logging.Message;
import org.jboss.logging.MessageBundle;
@@ -34,7 +33,7 @@
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageBundle(projectCode = "JBAS")
-interface ClusteringWebMessages extends ClusteringApiMessages {
+interface ClusteringWebMessages {
/**
* The messages.
@@ -50,7 +49,7 @@
*
* @return a {@link RuntimeException} for the error.
*/
- @Message(id = 10385, value = "%s: Caught Exception ending batch: ")
+ @Message(id = 10310, value = "%s: Caught Exception ending batch: ")
RuntimeException caughtExceptionEndingBatch(@Cause Throwable cause, String methodName);
/**
@@ -62,7 +61,7 @@
*
* @return an {@link IllegalArgumentException} for the error.
*/
- @Message(id = 10386, value = "%s does not implement %s")
+ @Message(id = 10311, value = "%s does not implement %s")
IllegalArgumentException interfaceNotImplemented(Object value, String interfaceName);
/**
@@ -70,6 +69,6 @@
*
* @return an {@link IllegalStateException} for the error.
*/
- @Message(id = 10387, value = "Not configured to provide session attributes")
+ @Message(id = 10312, value = "Not configured to provide session attributes")
IllegalStateException sessionAttributesNotConfigured();
}
View
4 .../src/main/java/org/jboss/as/clustering/web/impl/IncomingDistributableSessionDataImpl.java
@@ -41,10 +41,6 @@
private volatile Map<String, Object> attributes;
public IncomingDistributableSessionDataImpl(Integer version, Long timestamp, DistributableSessionMetadata metadata) {
- assert version != null : MESSAGES.nullVar("version");
- assert timestamp != null : MESSAGES.nullVar("timestamp");
- assert metadata != null : MESSAGES.nullVar("metadata");
-
this.version = version.intValue();
this.timestamp = timestamp.longValue();
this.metadata = metadata;

0 comments on commit f4bfb89

Please sign in to comment.
Something went wrong with that request. Please try again.