RabbitUtils.closeConnection(this.ackInfo.getConnection()); this.acknowledged = true;
if (resp == null) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); return null; RabbitUtils.closeConnection(connection); throw RabbitExceptionTranslator.convertRabbitAccessException(e);
public void closeAll() { for (Channel channel : this.channels) { try { if (channel != ConsumerChannelRegistry.getConsumerChannel()) { channel.close(); } else { if (logger.isDebugEnabled()) { logger.debug("Skipping close of consumer channel: " + channel.toString()); } } } catch (Exception ex) { logger.debug("Could not close synchronized Rabbit Channel after transaction", ex); } } for (Connection con : this.connections) { //NOSONAR RabbitUtils.closeConnection(con); } this.connections.clear(); this.channels.clear(); this.channelsPerConnection.clear(); }
private void cleanUpAfterAction(Channel channel, boolean invokeScope, RabbitResourceHolder resourceHolder, Connection connection) { if (!invokeScope) { if (resourceHolder != null) { ConnectionFactoryUtils.releaseResources(resourceHolder); } else { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); } } }
public void closeAll() { for (Channel channel : this.channels) { try { if (channel != ConsumerChannelRegistry.getConsumerChannel()) { channel.close(); } else { if (logger.isDebugEnabled()) { logger.debug("Skipping close of consumer channel: " + channel.toString()); } } } catch (Exception ex) { logger.debug("Could not close synchronized Rabbit Channel after transaction", ex); } } for (Connection con : this.connections) { //NOSONAR RabbitUtils.closeConnection(con); } this.connections.clear(); this.channels.clear(); this.channelsPerConnection.clear(); }
private void cleanUpAfterAction(Channel channel, boolean invokeScope, RabbitResourceHolder resourceHolder, Connection connection) { if (!invokeScope) { if (resourceHolder != null) { ConnectionFactoryUtils.releaseResources(resourceHolder); } else { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); } } }
private void cleanUpAfterAction(RabbitResourceHolder resourceHolder, Connection connection, Channel channel, ConfirmListener listener) { if (listener != null) { channel.removeConfirmListener(listener); } this.activeTemplateCallbacks.decrementAndGet(); this.dedicatedChannels.remove(); if (resourceHolder != null) { ConnectionFactoryUtils.releaseResources(resourceHolder); } else { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); } }
private void cleanUpAfterAction(RabbitResourceHolder resourceHolder, Connection connection, Channel channel, ConfirmListener listener) { if (listener != null) { channel.removeConfirmListener(listener); } this.activeTemplateCallbacks.decrementAndGet(); this.dedicatedChannels.remove(); if (resourceHolder != null) { ConnectionFactoryUtils.releaseResources(resourceHolder); } else { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); } }
public void destroy() { if (CachingConnectionFactory.this.cacheMode == CacheMode.CHANNEL) { reset(CachingConnectionFactory.this.cachedChannelsNonTransactional, CachingConnectionFactory.this.cachedChannelsTransactional, this.channelsAwaitingAcks); } else { reset(CachingConnectionFactory.this.allocatedConnectionNonTransactionalChannels.get(this), CachingConnectionFactory.this.allocatedConnectionTransactionalChannels.get(this), this.channelsAwaitingAcks); } if (this.target != null) { RabbitUtils.closeConnection(this.target); this.notifyCloseIfNecessary(); } this.target = null; }
public void destroy() { if (CachingConnectionFactory.this.cacheMode == CacheMode.CHANNEL) { reset(CachingConnectionFactory.this.cachedChannelsNonTransactional, CachingConnectionFactory.this.cachedChannelsTransactional, this.channelsAwaitingAcks); } else { reset(CachingConnectionFactory.this.allocatedConnectionNonTransactionalChannels.get(this), CachingConnectionFactory.this.allocatedConnectionTransactionalChannels.get(this), this.channelsAwaitingAcks); } if (this.target != null) { RabbitUtils.closeConnection(this.target); this.notifyCloseIfNecessary(); } this.target = null; }
public static void releaseResources(@Nullable RabbitResourceHolder resourceHolder) { if (resourceHolder == null || resourceHolder.isSynchronizedWithTransaction()) { return; } RabbitUtils.closeChannel(resourceHolder.getChannel()); RabbitUtils.closeConnection(resourceHolder.getConnection()); }
public static void releaseResources(@Nullable RabbitResourceHolder resourceHolder) { if (resourceHolder == null || resourceHolder.isSynchronizedWithTransaction()) { return; } RabbitUtils.closeChannel(resourceHolder.getChannel()); RabbitUtils.closeConnection(resourceHolder.getConnection()); }
RabbitUtils.closeConnection(connection);
public void destroy() { if (this.target != null) { getConnectionListener().onClose(target); RabbitUtils.closeConnection(this.target); } this.target = null; }
private void finalizeConsumer() { RabbitUtils.setPhysicalCloseRequired(getChannel(), true); RabbitUtils.closeChannel(getChannel()); RabbitUtils.closeConnection(this.connection); DirectMessageListenerContainer.this.cancellationLock.release(this); consumerRemoved(this); }
private void finalizeConsumer() { RabbitUtils.setPhysicalCloseRequired(getChannel(), true); RabbitUtils.closeChannel(getChannel()); RabbitUtils.closeConnection(this.connection); DirectMessageListenerContainer.this.cancellationLock.release(this); consumerRemoved(this); }
RabbitUtils.closeConnection(this.ackInfo.getConnection()); this.acknowledged = true;
if (resp == null) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); return null; RabbitUtils.closeConnection(connection); throw RabbitExceptionTranslator.convertRabbitAccessException(e);
@Nullable private SimpleConsumer consume(String queue, Connection connection) { Channel channel = null; SimpleConsumer consumer = null; try { channel = connection.createChannel(isChannelTransacted()); channel.basicQos(getPrefetchCount()); consumer = new SimpleConsumer(connection, channel, queue); channel.queueDeclarePassive(queue); consumer.consumerTag = channel.basicConsume(queue, getAcknowledgeMode().isAutoAck(), (getConsumerTagStrategy() != null ? getConsumerTagStrategy().createConsumerTag(queue) : ""), // NOSONAR never null isNoLocal(), isExclusive(), getConsumerArguments(), consumer); } catch (AmqpApplicationContextClosedException e) { throw new AmqpConnectException(e); } catch (Exception e) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); consumer = handleConsumeException(queue, consumer, e); } return consumer; }
@Nullable private SimpleConsumer consume(String queue, Connection connection) { Channel channel = null; SimpleConsumer consumer = null; try { channel = connection.createChannel(isChannelTransacted()); channel.basicQos(getPrefetchCount()); consumer = new SimpleConsumer(connection, channel, queue); channel.queueDeclarePassive(queue); consumer.consumerTag = channel.basicConsume(queue, getAcknowledgeMode().isAutoAck(), (getConsumerTagStrategy() != null ? getConsumerTagStrategy().createConsumerTag(queue) : ""), // NOSONAR never null isNoLocal(), isExclusive(), getConsumerArguments(), consumer); } catch (AmqpApplicationContextClosedException e) { throw new AmqpConnectException(e); } catch (Exception e) { RabbitUtils.closeChannel(channel); RabbitUtils.closeConnection(connection); consumer = handleConsumeException(queue, consumer, e); } return consumer; }