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

@ -104,5 +104,11 @@ public interface Connection extends Service {
void serviceExceptionAsync(IOException e);
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 MessageAuthorizationPolicy messageAuthorizationPolicy;
private boolean networkConnection;
private boolean faultTolerant;
private final AtomicBoolean stopping = new AtomicBoolean();
private final MessageEvaluationContext messageEvaluationContext = new MessageEvaluationContext();
private boolean dontSendReponse;
@ -278,4 +279,12 @@ public class ConnectionContext {
public void setClientMaster(boolean 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 ConnectionContext context;
private boolean networkConnection;
private boolean faultTolerantConnection;
private AtomicInteger protocolVersion = new AtomicInteger(CommandTypes.PROTOCOL_VERSION);
private DemandForwardingBridge duplexBridge;
private final TaskRunnerFactory taskRunnerFactory;
@ -647,6 +648,7 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
context.setConnector(connector);
context.setMessageAuthorizationPolicy(getMessageAuthorizationPolicy());
context.setNetworkConnection(networkConnection);
context.setFaultTolerant(faultTolerantConnection);
context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>());
context.setUserName(info.getUserName());
context.setWireFormatInfo(wireFormatInfo);
@ -1076,6 +1078,10 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
public synchronized boolean isStarting() {
return starting;
}
public synchronized boolean isNetworkConnection() {
return networkConnection;
}
protected synchronized void setStarting(boolean starting) {
this.starting = starting;
@ -1255,6 +1261,9 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
}
public Response processConnectionControl(ConnectionControl control) throws Exception {
if(control != null) {
faultTolerantConnection=control.isFaultTolerant();
}
return null;
}