Added network and fault tolerant flags to ConnectionContext

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@631241 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-02-26 14:56:31 +00:00
parent 33724ec1c3
commit 25b6812daa
3 changed files with 24 additions and 0 deletions

View File

@ -105,4 +105,10 @@ public interface Connection extends Service {
String getConnectionId(); String getConnectionId();
/**
* return true if a network connection
* @return
*/
boolean isNetworkConnection();
} }

View File

@ -53,6 +53,7 @@ public class ConnectionContext {
private boolean producerFlowControl = true; private boolean producerFlowControl = true;
private MessageAuthorizationPolicy messageAuthorizationPolicy; private MessageAuthorizationPolicy messageAuthorizationPolicy;
private boolean networkConnection; private boolean networkConnection;
private boolean faultTolerant;
private final AtomicBoolean stopping = new AtomicBoolean(); private final AtomicBoolean stopping = new AtomicBoolean();
private final MessageEvaluationContext messageEvaluationContext = new MessageEvaluationContext(); private final MessageEvaluationContext messageEvaluationContext = new MessageEvaluationContext();
private boolean dontSendReponse; private boolean dontSendReponse;
@ -278,4 +279,12 @@ public class ConnectionContext {
public void setClientMaster(boolean clientMaster) { public void setClientMaster(boolean clientMaster) {
this.clientMaster = clientMaster; this.clientMaster = clientMaster;
} }
public boolean isFaultTolerant() {
return faultTolerant;
}
public void setFaultTolerant(boolean faultTolerant) {
this.faultTolerant = faultTolerant;
}
} }

View File

@ -146,6 +146,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
private CountDownLatch dispatchStoppedLatch = new CountDownLatch(1); private CountDownLatch dispatchStoppedLatch = new CountDownLatch(1);
private ConnectionContext context; private ConnectionContext context;
private boolean networkConnection; private boolean networkConnection;
private boolean faultTolerantConnection;
private AtomicInteger protocolVersion = new AtomicInteger(CommandTypes.PROTOCOL_VERSION); private AtomicInteger protocolVersion = new AtomicInteger(CommandTypes.PROTOCOL_VERSION);
private DemandForwardingBridge duplexBridge; private DemandForwardingBridge duplexBridge;
private final TaskRunnerFactory taskRunnerFactory; private final TaskRunnerFactory taskRunnerFactory;
@ -647,6 +648,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
context.setConnector(connector); context.setConnector(connector);
context.setMessageAuthorizationPolicy(getMessageAuthorizationPolicy()); context.setMessageAuthorizationPolicy(getMessageAuthorizationPolicy());
context.setNetworkConnection(networkConnection); context.setNetworkConnection(networkConnection);
context.setFaultTolerant(faultTolerantConnection);
context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>());
context.setUserName(info.getUserName()); context.setUserName(info.getUserName());
context.setWireFormatInfo(wireFormatInfo); context.setWireFormatInfo(wireFormatInfo);
@ -1077,6 +1079,10 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
return starting; return starting;
} }
public synchronized boolean isNetworkConnection() {
return networkConnection;
}
protected synchronized void setStarting(boolean starting) { protected synchronized void setStarting(boolean starting) {
this.starting = starting; this.starting = starting;
} }
@ -1255,6 +1261,9 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
} }
public Response processConnectionControl(ConnectionControl control) throws Exception { public Response processConnectionControl(ConnectionControl control) throws Exception {
if(control != null) {
faultTolerantConnection=control.isFaultTolerant();
}
return null; return null;
} }