Skip to content

Commit 4109a27

Browse files
committed
[WFLY-7139] Handle "Component is stopped" exception on undeploy for EJB client.
1 parent 078c905 commit 4109a27

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* JBoss, Home of Professional Open Source.
3+
* Copyright 2016, Red Hat, Inc., and individual contributors
4+
* as indicated by the @author tags. See the copyright.txt file in the
5+
* distribution for a full listing of individual contributors.
6+
*
7+
* This is free software; you can redistribute it and/or modify it
8+
* under the terms of the GNU Lesser General Public License as
9+
* published by the Free Software Foundation; either version 2.1 of
10+
* the License, or (at your option) any later version.
11+
*
12+
* This software is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this software; if not, write to the Free
19+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21+
*/
22+
23+
package org.jboss.as.ee.component;
24+
25+
/**
26+
* Exception indicating that a component receiving a method call has stopped.
27+
*
28+
* @author Richard Achmatowicz
29+
*/
30+
public class ComponentIsStoppedException extends IllegalStateException {
31+
32+
private static final long serialVersionUID = 1L;
33+
34+
/**
35+
* Constructs a <code>ComponentIsStoppedException</code> with no detail message.
36+
*/
37+
public ComponentIsStoppedException() {
38+
}
39+
40+
/**
41+
* Constructs a <code>ComponentIsStoppedException</code> with the specified
42+
* detail message.
43+
*
44+
* @param message the detail message
45+
*/
46+
public ComponentIsStoppedException(String message) {
47+
super(message);
48+
}
49+
}

ee/src/main/java/org/jboss/as/ee/logging/EeLogger.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.jboss.as.ee.component.BindingConfiguration;
4040
import org.jboss.as.ee.component.ComponentConfiguration;
4141
import org.jboss.as.ee.component.ComponentInstance;
42+
import org.jboss.as.ee.component.ComponentIsStoppedException;
4243
import org.jboss.as.ee.component.InjectionSource;
4344
import org.jboss.as.ee.concurrent.ConcurrentContext;
4445
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
@@ -500,7 +501,7 @@ public interface EeLogger extends BasicLogger {
500501
* @return an {@link IllegalStateException} for the error.
501502
*/
502503
@Message(id = 43, value = "Component is stopped")
503-
IllegalStateException componentIsStopped();
504+
ComponentIsStoppedException componentIsStopped();
504505

505506
/**
506507
* Creates an exception indicating the component is not available.

ejb3/src/main/java/org/jboss/as/ejb3/remote/protocol/versionone/MethodInvocationMessageHandler.java

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package org.jboss.as.ejb3.remote.protocol.versionone;
2424

2525
import org.jboss.as.ee.component.Component;
26+
import org.jboss.as.ee.component.ComponentIsStoppedException;
2627
import org.jboss.as.ee.component.ComponentView;
2728
import org.jboss.as.ee.component.interceptors.InvocationType;
2829
import org.jboss.as.ejb3.logging.EjbLogger;
@@ -206,6 +207,10 @@ public void run() {
206207
if (throwable instanceof EJBComponentUnavailableException) {
207208
EjbLogger.EJB3_INVOCATION_LOGGER.debugf("Cannot handle method invocation: %s on bean: %s due to EJB component unavailability exception. Returning a no such EJB available message back to client", invokedMethod, beanName);
208209
MethodInvocationMessageHandler.this.writeNoSuchEJBFailureMessage(channelAssociation, invocationId, appName, moduleName, distinctName, beanName, viewClassName);
210+
// WFLY-7139
211+
} else if (throwable instanceof ComponentIsStoppedException) {
212+
EjbLogger.EJB3_INVOCATION_LOGGER.debugf("Cannot handle method invocation: %s on bean: %s due to EJB component stopped exception. Returning a no such EJB available message back to client", invokedMethod, beanName);
213+
MethodInvocationMessageHandler.this.writeNoSuchEJBFailureMessage(channelAssociation, invocationId, appName, moduleName, distinctName, beanName, viewClassName);
209214
} else {
210215
// write out the failure
211216
Throwable throwableToWrite = throwable;

0 commit comments

Comments
 (0)