Re: [jboss-user] [JBoss Microcontainer] - AbstractRealDeployerWithInput fails to call undeploy() on deployer, for failed deployments
by Ales Justin
Ales Justin [http://community.jboss.org/people/alesj] replied to the discussion
"AbstractRealDeployerWithInput fails to call undeploy() on deployer, for failed deployments"
To view the discussion, visit: http://community.jboss.org/message/555221#555221
--------------------------------------------------------------
> That would effectively mean, that *every* implementation of the org.jboss.deployers.spi.deployer.helpers.DeploymentVisitor interface, has to have the following code in their deploy:
>
No, why?
See existing impl, none has that.
Either they don't have anything, since the deploy action is very simple (almost atomic :) ),
or they have some other additional undeploy logic; e.g. remove added components.
The idea is that the visitor's deploy is very simple, or you missused the deployer.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/555221#555221]
Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months
[JBoss Microcontainer] - AbstractRealDeployerWithInput fails to call undeploy() on deployer, for failed deployments
by jaikiran pai
jaikiran pai [http://community.jboss.org/people/jaikiran] created the discussion
"AbstractRealDeployerWithInput fails to call undeploy() on deployer, for failed deployments"
To view the discussion, visit: http://community.jboss.org/message/555208#555208
--------------------------------------------------------------
While investigating this issue http://community.jboss.org/message/555195#555195 http://community.jboss.org/message/555195#555195, I have stumbled upon a MC deployer bug. Here's an simplified version of what's happening:
public class MyDeployer extends AbstractRealDeployerWithInput<JBossEnterpriseBeanMetaData>
implements
DeploymentVisitor<JBossEnterpriseBeanMetaData>
{
...
@Override
public void deploy(DeploymentUnit unit, JBossEnterpriseBeanMetaData beanMetaData) throws DeploymentException
{
doStepOne(); // like register component to some service name
doStepTwo(); // can be any operation which ends up throwing an runtime exception
}
@Override
public void undeploy(DeploymentUnit unit, JBossEnterpriseBeanMetaData enterpriseBean)
{
undoStepOne(); // i.e. unregister the service
}
}
As can be seen, the deploy() involves more than one step. The first step does registering of services (or some functionality internal to my deployer). The second step of deploy() does some other thing but ends up throwing an exception. I would expect that the undeploy() method
would be called on MyDeployer for this (failed) deployment unit, so that I can undo/cleanup whatever was done in doStepOne() of deploy() operation.
However, the undeploy() never gets called. Looking at MC's AbstractRealDeployerWithInput.deploy() method:
protected <U> void deploy(DeploymentUnit unit, DeploymentVisitor<U> visitor) throws DeploymentException
{
if (visitor == null)
throw new IllegalArgumentException("Null visitor.");
List<U> visited = new ArrayList<U>();
try
{
Set<? extends U> deployments = unit.getAllMetaData(visitor.getVisitorType());
for (U deployment : deployments)
{
visitor.deploy(unit, deployment);
visited.add(deployment);
}
}
catch (Throwable t)
{
for (int i = visited.size()-1; i >= 0; --i)
{
try
{
visitor.undeploy(unit, visited.get(i));
}
catch (Throwable ignored)
{
log.warn("Error during undeploy: " + unit.getName(), ignored);
}
}
throw DeploymentException.rethrowAsDeploymentException("Error deploying: " + unit.getName(), t);
}
}
More specifically:
visitor.deploy(unit, deployment);
visited.add(deployment);
visitor.deploy(...) throws the exception and hence the deployment is never added to "visited" which effectively means that in the catch block:
for (int i = visited.size()-1; i >= 0; --i)
{
try
{
visitor.undeploy(unit, visited.get(i));
}
catch (Throwable ignored)
{
log.warn("Error during undeploy: " + unit.getName(), ignored);
}
}
The "visited" will never contain this failed deployment. Ultimately, the undeploy() will never get called for that failed deployment unit.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/555208#555208]
Start a new discussion in JBoss Microcontainer at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months
[JBoss Messaging] - Message Delay (upto 9 hours) in JBoss Messaging 1.4.0 SP3 in JBoss cluster environment
by Vijay Rawat
Vijay Rawat [http://community.jboss.org/people/vijayraw] created the discussion
"Message Delay (upto 9 hours) in JBoss Messaging 1.4.0 SP3 in JBoss cluster environment"
To view the discussion, visit: http://community.jboss.org/message/555175#555175
--------------------------------------------------------------
We are using JBoss cluster with two nodes and JBoss Messaging 1.4.0 SP3 as our JMS provider. We are facing message delay issue in our production environment. Logs indicates that message has been put in the queue but on the consumer side they are not consumed. They delays are quite long (upto 9-10 hours) or on restart it get consumed. We are using spring (DefaultMessageListenerContainer) on the consumer side. Each queue has only one consumer attached
Our Message Sending Code looks like this :
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public void writeToQueue(Queue queue, JmsMessage message) throws JMSException {
LOG.info("Entering with queue " + queue);
Connection jmsConnection = null;
try {
jmsConnection = connectionFactory.createConnection();
jmsConnection.start();
// Create the session
Session jmsSession = jmsConnection.createSession(message.isTransacted(),
Session.AUTO_ACKNOWLEDGE);
// Create the JMS message producer which will post messages to the
// destination;
MessageProducer messageProducer = jmsSession.createProducer(queue);
if (message.isPersistent()) {
messageProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
} else {
messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
}
MapMessage mapMessage = jmsSession.createMapMessage();
for (Map.Entry<String, String> entry : message.getMessage().entrySet()) {
mapMessage.setString(entry.getKey(), entry.getValue());
}
messageProducer.send(mapMessage);
if (message.isTransacted()) {
jmsSession.commit();
}
} catch (JMSException jex) {
LOG.error(jex.getMessage(), jex);
throw jex;
} finally {
if (jmsConnection != null) {
try {
jmsConnection.close();
} catch (JMSException ignore) {
LOG.error(ignore.getMessage(), ignore);
}
}
}
LOG.info("Published a message to queue " + queue);
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Attached are the Configuration Files for JBoss Messaging
Unfortunately I could not replicate this problem in our QA or local environment.
If anybody has faced this problem, and have workaround for this, Pls let me know.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/555175#555175]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months