Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and cleanup around IMQ startup and shutdown #25227

Merged
merged 6 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2024 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -29,7 +30,6 @@

import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;

Expand Down Expand Up @@ -61,36 +61,31 @@ public class ActiveInboundResourceAdapterImpl extends ActiveOutboundResourceAdap
* If there is a failure in loading
* or starting the resource adapter.
*/
@Override
public void init(ResourceAdapter ra, ConnectorDescriptor desc, String moduleName, ClassLoader jcl)
throws ConnectorRuntimeException {
super.init(ra, desc, moduleName, jcl);
this.factories_ = new Hashtable<String, MessageEndpointFactoryInfo>();
}

public ActiveInboundResourceAdapterImpl() {
this.factories_ = new Hashtable<>();
}

/**
* Destroys default pools and resources. Stops the Resource adapter
* java bean.
*/
@Override
public void destroy() {
deactivateEndPoints();
super.destroy();
}

private void deactivateEndPoints() {
if (resourceadapter_ != null) {
//deactivateEndpoints as well!
Iterator<MessageEndpointFactoryInfo> iter = getAllEndpointFactories().iterator();
while (iter.hasNext()) {
MessageEndpointFactoryInfo element = iter.next();
for (MessageEndpointFactoryInfo element : getAllEndpointFactories()) {
try {
this.resourceadapter_.endpointDeactivation(
element.getEndpointFactory(), element.getActivationSpec());
} catch (RuntimeException e) {
_logger.warning(e.getMessage());
_logger.log(Level.FINE, "Error during endpointDeactivation ", e);
_logger.log(Level.SEVERE, "Error during endpointDeactivation ", e);
}
}
}
Expand All @@ -113,15 +108,18 @@ public Collection<MessageEndpointFactoryInfo> getAllEndpointFactories() {
* @param id Id of the endpoint factory.
* @return <code>MessageEndpointFactoryIndo</code> object.
*/
@Override
public MessageEndpointFactoryInfo getEndpointFactoryInfo(String id) {
return factories_.get(id);
}

@Override
public void updateMDBRuntimeInfo(EjbMessageBeanDescriptor descriptor_, BeanPoolDescriptor poolDescriptor)
throws ConnectorRuntimeException {
//do nothing
}

@Override
public void validateActivationSpec(ActivationSpec spec) {
//do nothing
}
Expand All @@ -139,6 +137,7 @@ public Set getAllEndpointFactoryInfo() {
/**
* {@inheritDoc}
*/
@Override
public boolean handles(ConnectorDescriptor cd, String moduleName) {
return (cd.getInBoundDefined() && !ConnectorsUtil.isJMSRA(moduleName));
}
Expand All @@ -150,6 +149,7 @@ public boolean handles(ConnectorDescriptor cd, String moduleName) {
* @param id Unique identifier of the endpoint factory.
* @param info <code>MessageEndpointFactoryInfo</code> object.
*/
@Override
public void addEndpointFactoryInfo(
String id, MessageEndpointFactoryInfo info) {
factories_.put(id, info);
Expand All @@ -161,6 +161,7 @@ public void addEndpointFactoryInfo(
* @param id Unique identifier of the endpoint factory to be
* removed.
*/
@Override
public void removeEndpointFactoryInfo(String id) {
factories_.remove(id);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -347,8 +347,7 @@ private void logMergedProperties(Set<ConnectorConfigProperty> mergedProps) {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("Passing in the following properties " +
"before calling RA.start of " + this.moduleName_);
StringBuffer b = new StringBuffer();

StringBuilder b = new StringBuilder();
for (ConnectorConfigProperty element : mergedProps) {
b.append("\nName: " + element.getName()
+ " Value: " + element.getValue());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -115,7 +115,10 @@ protected boolean setAttributeValue(XMLElement elementName, XMLElement attribute
public Node writeDescriptor(Node parent, String nodeName, ResourceAdapter descriptor) {
Element raNode = (Element) super.writeDescriptor(parent, nodeName, descriptor);
appendTextChild(raNode, TagNames.DESCRIPTION, descriptor.getDescription());
setAttribute(raNode, RuntimeTagNames.JNDI_NAME, descriptor.getValue(ResourceAdapter.JNDI_NAME));
SimpleJndiName jndiName = (SimpleJndiName) descriptor.getValue(ResourceAdapter.JNDI_NAME);
if (jndiName != null) {
setAttribute(raNode, RuntimeTagNames.JNDI_NAME, jndiName.toString());
}
setAttribute(raNode, RuntimeTagNames.MAX_POOL_SIZE,
(String) descriptor.getValue(ResourceAdapter.MAX_POOL_SIZE));
setAttribute(raNode, RuntimeTagNames.STEADY_POOL_SIZE,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -297,7 +297,7 @@ public static Object lookupRemote30BusinessObject(Object jndiObj, String busines
return createRemoteBusinessObject(loader, businessInterface, delegate);
} catch (Exception e) {
NamingException ne = new NamingException(
"ejb ref resolution error for remote business interface" + businessInterface);
"ejb ref resolution error for remote business interface " + businessInterface);
ne.initCause(e instanceof InvocationTargetException ? e.getCause() : e);
throw ne;
}
Expand Down Expand Up @@ -532,4 +532,4 @@ private static Collection<Field> getSerializationFields(Class<?> clazz) {

return sortedMap.values();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static Logger getLogger() {
public static final String SHUTDOWN_FAIL_GRIZZLY = LOGMSG_PREFIX + "-00009";

@LogMessageInfo(
message = "Error occurs when shutting down JMSRA : {0}",
message = "Error occurs when shutting down JMSRA",
level = "WARNING",
cause = "unknown",
action = "unknown"
Expand Down Expand Up @@ -111,14 +111,6 @@ public static Logger getLogger() {
)
public static final String CLOSE_CONNECTION_FAILED = LOGMSG_PREFIX + "-00013";

@LogMessageInfo(
message = "rardeployment.mcfcreation_error {0}",
level = "WARNING",
cause = "unknown",
action = "unknown"
)
public static final String RARDEPLOYMENT_MCF_ERROR = LOGMSG_PREFIX + "-00014";

@LogMessageInfo(
message = "Exception while getting configured RMI port : {0}",
level = "WARNING",
Expand Down
Loading