Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

some AS7 integration logging and security tweaks #677

Merged
merged 2 commits into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
5 hornetq-jms-server/src/main/java/org/hornetq/jms/server/HornetQJMSServerLogger.java
@@ -165,6 +165,11 @@
format = Message.Format.MESSAGE_FORMAT)
void failedToCorrectHost(@Cause Exception e, String name);
+ @LogMessage(level = Logger.Level.WARN)
+ @Message(id = 122021, value = "Couldn't start recovery discovery on {0}, we will retry every recovery scan until the server is available" ,
+ format = Message.Format.MESSAGE_FORMAT)
+ void xaRecoveryStartError(XARecoveryConfig e);
+
@LogMessage(level = Logger.Level.ERROR)
@Message(id = 124001, value = "key attribute missing for JMS configuration {0}" , format = Message.Format.MESSAGE_FORMAT)
void jmsConfigMissingKey(Node e);
View
4 hornetq-jms-server/src/main/java/org/hornetq/jms/server/recovery/HornetQRecoveryRegistry.java
@@ -104,7 +104,7 @@ public void register(final XARecoveryConfig resourceConfig)
if (discoveryRecord == null)
{
discoveryRecord = newInstance;
- discoveryRecord.start();
+ discoveryRecord.start(false);
}
// you could have a configuration shared with multiple MDBs or RAs
discoveryRecord.incrementUsage();
@@ -201,7 +201,7 @@ public void run()
try
{
HornetQJMSServerLogger.LOGGER.debug("Retrying discovery " + discovery);
- discovery.start();
+ discovery.start(true);
}
catch (Throwable e)
{
View
7 hornetq-jms-server/src/main/java/org/hornetq/jms/server/recovery/RecoveryDiscovery.java
@@ -50,7 +50,7 @@ public RecoveryDiscovery(XARecoveryConfig config)
this.config = config;
}
- public synchronized void start()
+ public synchronized void start(boolean retry)
{
if (!started)
{
@@ -72,7 +72,10 @@ public synchronized void start()
}
catch (Exception startupError)
{
- HornetQJMSServerLogger.LOGGER.warn("Couldn't start recovery discovery on " + config + ", we will retry this on the next recovery scan");
+ if (!retry)
+ {
+ HornetQJMSServerLogger.LOGGER.xaRecoveryStartError(config);
+ }
stop();
HornetQRecoveryRegistry.getInstance().failedDiscovery(this);
}
View
4 hornetq-ra/src/main/java/org/hornetq/ra/HornetQRALogger.java
@@ -85,6 +85,10 @@
@Message(id = 151007, value = "Instantiating {0} \"{1}\" directly since UseJNDI=false.", format = Message.Format.MESSAGE_FORMAT)
void instantiatingDestination(String destinationType, String destination);
+ @LogMessage(level = Logger.Level.INFO)
+ @Message(id = 151008, value = "awaiting HornetQ Server availability", format = Message.Format.MESSAGE_FORMAT)
+ void awaitingJMSServerCreation();
+
@LogMessage(level = Logger.Level.WARN)
@Message(id = 152001, value = "It wasn't possible to lookup for a Transaction Manager through the configured properties TransactionManagerLocatorClass and TransactionManagerLocatorMethod" +
"\nHornetQ Resource Adapter won't be able to set and verify transaction timeouts in certain cases.", format = Message.Format.MESSAGE_FORMAT)
View
2  hornetq-ra/src/main/java/org/hornetq/ra/HornetQRAProperties.java
@@ -52,7 +52,7 @@
/** Method used to locate the TM */
private String transactionManagerLocatorMethod = "getTm;getTM";
- private static final int DEFAULT_SETUP_ATTEMPTS = 10;
+ private static final int DEFAULT_SETUP_ATTEMPTS = -1;
private static final long DEFAULT_SETUP_INTERVAL = 2 * 1000;
View
34 hornetq-ra/src/main/java/org/hornetq/ra/inflow/HornetQActivation.java
@@ -31,6 +31,8 @@
import org.hornetq.api.core.HornetQException;
import org.hornetq.api.core.HornetQExceptionType;
+import org.hornetq.api.core.HornetQNonExistentQueueException;
+import org.hornetq.api.core.HornetQNotConnectedException;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
@@ -482,7 +484,9 @@ protected void setupDestination() throws Exception
String calculatedDestinationName = destinationName.substring(destinationName.lastIndexOf('/') + 1);
- HornetQRALogger.LOGGER.unableToRetrieveDestinationFromJNDI(destinationName, destinationType.getName(), calculatedDestinationName);
+ HornetQRALogger.LOGGER.debug("Unable to retrieve " + destinationName +
+ " from JNDI. Creating a new " + destinationType.getName() +
+ " named " + calculatedDestinationName + " to be used by the MDB.");
// If there is no binding on naming, we will just create a new instance
if (isTopic)
@@ -552,10 +556,14 @@ public String toString()
*/
public void handleFailure(Throwable failure)
{
- if(failure instanceof HornetQException && ((HornetQException)failure).getType() == HornetQExceptionType.QUEUE_DOES_NOT_EXIST)
+ if(failure instanceof HornetQException && !(((HornetQException)failure).getType() == HornetQExceptionType.QUEUE_DOES_NOT_EXIST))
{
HornetQRALogger.LOGGER.awaitingTopicQueueCreation(getActivationSpec().getDestination());
}
+ else if(failure instanceof HornetQException && !(((HornetQException)failure).getType() == HornetQExceptionType.NOT_CONNECTED))
+ {
+ HornetQRALogger.LOGGER.awaitingJMSServerCreation();
+ }
else
{
HornetQRALogger.LOGGER.failureInActivation(failure, spec);
@@ -569,6 +577,7 @@ public void handleFailure(Throwable failure)
return;
try
{
+ Throwable lastException = failure;
while (deliveryActive.get() && (setupAttempts == -1 || reconnectCount < setupAttempts))
{
teardown();
@@ -583,7 +592,10 @@ public void handleFailure(Throwable failure)
break;
}
- HornetQRALogger.LOGGER.attemptingReconnect(spec);
+ if (reconnectCount < 1)
+ {
+ HornetQRALogger.LOGGER.attemptingReconnect(spec);
+ }
try
{
setup();
@@ -592,9 +604,21 @@ public void handleFailure(Throwable failure)
}
catch (Throwable t)
{
- if(failure instanceof HornetQException && ((HornetQException)failure).getType() == HornetQExceptionType.QUEUE_DOES_NOT_EXIST)
+ if(failure instanceof HornetQException && !(((HornetQException)failure).getType() == HornetQExceptionType.QUEUE_DOES_NOT_EXIST))
+ {
+ if (lastException == null && lastException instanceof HornetQNonExistentQueueException)
+ {
+ lastException = t;
+ HornetQRALogger.LOGGER.awaitingTopicQueueCreation(getActivationSpec().getDestination());
+ }
+ }
+ else if(failure instanceof HornetQException && !(((HornetQException)failure).getType() == HornetQExceptionType.NOT_CONNECTED))
{
- HornetQRALogger.LOGGER.awaitingTopicQueueCreation(getActivationSpec().getDestination());
+ if (lastException == null && lastException instanceof HornetQNotConnectedException)
+ {
+ lastException = t;
+ HornetQRALogger.LOGGER.awaitingJMSServerCreation();
+ }
}
else
{
View
8 hornetq-server/src/main/java/org/hornetq/core/remoting/server/impl/RemotingServiceImpl.java
@@ -104,6 +104,8 @@
private final Map<ProtocolType, ProtocolManager> protocolMap = new ConcurrentHashMap<ProtocolType, ProtocolManager>();
+ private HornetQPrincipal defaultInvmSecurityPrincipal;
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -228,6 +230,11 @@ public ClassLoader run()
threadPool,
scheduledThreadPool);
+ if(defaultInvmSecurityPrincipal != null && acceptor.isUnsecurable())
+ {
+ acceptor.setDefaultHornetQPrincipal(defaultInvmSecurityPrincipal);
+ }
+
acceptors.add(acceptor);
if (managementService != null)
@@ -258,6 +265,7 @@ public ClassLoader run()
public synchronized void allowInvmSecurityOverride(HornetQPrincipal principal)
{
+ defaultInvmSecurityPrincipal = principal;
for (Acceptor acceptor : acceptors)
{
if(acceptor.isUnsecurable())
Something went wrong with that request. Please try again.