use of org.apache.qpid.server.session.AMQPSession in project qpid-broker-j by apache.
the class BrokerTestHelper method createSession.
public static AMQPSession<?, ?> createSession(int channelId, AMQPConnection<?> connection) {
@SuppressWarnings("rawtypes") AMQPSession session = mock(AMQPSession.class);
when(session.getAMQPConnection()).thenReturn(connection);
when(session.getChannelId()).thenReturn(channelId);
return session;
}
use of org.apache.qpid.server.session.AMQPSession in project qpid-broker-j by apache.
the class AbstractQueue method switchToConnectionExclusivity.
private void switchToConnectionExclusivity() throws ExistingConsumerPreventsExclusive {
switch(_exclusive) {
case NONE:
case CONTAINER:
case PRINCIPAL:
AMQPConnection con = null;
Iterator<QueueConsumer<?, ?>> queueConsumerIterator = _queueConsumerManager.getAllIterator();
while (queueConsumerIterator.hasNext()) {
QueueConsumer<?, ?> c = queueConsumerIterator.next();
if (con == null) {
con = c.getSession().getAMQPConnection();
} else if (!con.equals(c.getSession().getAMQPConnection())) {
throw new ExistingConsumerPreventsExclusive();
}
}
_exclusiveOwner = con;
break;
case SESSION:
_exclusiveOwner = _exclusiveOwner == null ? null : ((AMQPSession<?, ?>) _exclusiveOwner).getAMQPConnection();
break;
case LINK:
_exclusiveOwner = _exclusiveSubscriber == null ? null : _exclusiveSubscriber.getSession().getAMQPConnection();
}
}
Aggregations