Commit 53bc9ad7 authored by Guillaume Surrel's avatar Guillaume Surrel
Browse files

Fix: Remove static transaction variable, as it can change when agent server stops and restarts.

parent 0ba511da
...@@ -39,7 +39,6 @@ import org.ow2.joram.mom.amqp.marshalling.AMQP.Basic.BasicProperties; ...@@ -39,7 +39,6 @@ import org.ow2.joram.mom.amqp.marshalling.AMQP.Basic.BasicProperties;
import org.ow2.joram.mom.amqp.structures.PublishToQueue; import org.ow2.joram.mom.amqp.structures.PublishToQueue;
import fr.dyade.aaa.agent.AgentServer; import fr.dyade.aaa.agent.AgentServer;
import fr.dyade.aaa.util.Transaction;
public abstract class IExchange implements Serializable { public abstract class IExchange implements Serializable {
...@@ -60,8 +59,6 @@ public abstract class IExchange implements Serializable { ...@@ -60,8 +59,6 @@ public abstract class IExchange implements Serializable {
private boolean published; private boolean published;
protected static Transaction transaction = AgentServer.getTransaction();
public IExchange() { } public IExchange() { }
public IExchange(String name, boolean durable) { public IExchange(String name, boolean durable) {
...@@ -120,7 +117,7 @@ public abstract class IExchange implements Serializable { ...@@ -120,7 +117,7 @@ public abstract class IExchange implements Serializable {
logger.log(BasicLevel.DEBUG, "IExchange.loadExchange(" + name + ')'); logger.log(BasicLevel.DEBUG, "IExchange.loadExchange(" + name + ')');
// load IExchange // load IExchange
IExchange exchange = (IExchange) transaction.load(name); IExchange exchange = (IExchange) AgentServer.getTransaction().load(name);
try { try {
Naming.bindExchange(exchange.name, exchange); Naming.bindExchange(exchange.name, exchange);
} catch (AlreadyBoundException exc) { } catch (AlreadyBoundException exc) {
...@@ -134,7 +131,7 @@ public abstract class IExchange implements Serializable { ...@@ -134,7 +131,7 @@ public abstract class IExchange implements Serializable {
if (logger.isLoggable(BasicLevel.DEBUG)) if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "IExchange.createExchange(" + name + ')'); logger.log(BasicLevel.DEBUG, "IExchange.createExchange(" + name + ')');
try { try {
transaction.create(this, saveName); AgentServer.getTransaction().create(this, saveName);
} catch (IOException e) { } catch (IOException e) {
if (logger.isLoggable(BasicLevel.ERROR)) if (logger.isLoggable(BasicLevel.ERROR))
logger.log(BasicLevel.ERROR, "IExchange.createExchange ERROR::", e); logger.log(BasicLevel.ERROR, "IExchange.createExchange ERROR::", e);
...@@ -146,7 +143,7 @@ public abstract class IExchange implements Serializable { ...@@ -146,7 +143,7 @@ public abstract class IExchange implements Serializable {
if (logger.isLoggable(BasicLevel.DEBUG)) if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "IExchange.saveExchange(" + name + ')'); logger.log(BasicLevel.DEBUG, "IExchange.saveExchange(" + name + ')');
try { try {
transaction.save(this, saveName); AgentServer.getTransaction().save(this, saveName);
} catch (IOException e) { } catch (IOException e) {
if (logger.isLoggable(BasicLevel.ERROR)) if (logger.isLoggable(BasicLevel.ERROR))
logger.log(BasicLevel.ERROR, "IExchange.saveExchange ERROR::", e); logger.log(BasicLevel.ERROR, "IExchange.saveExchange ERROR::", e);
...@@ -161,7 +158,7 @@ public abstract class IExchange implements Serializable { ...@@ -161,7 +158,7 @@ public abstract class IExchange implements Serializable {
throw new AccessRefusedException("Can't delete default exchange."); throw new AccessRefusedException("Can't delete default exchange.");
} }
if (durable) { if (durable) {
transaction.delete(saveName); AgentServer.getTransaction().delete(saveName);
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment