diff --git a/src/main/java/com/rabbitmq/client/Channel.java b/src/main/java/com/rabbitmq/client/Channel.java index 88106d0a31..d45b3dcb9d 100644 --- a/src/main/java/com/rabbitmq/client/Channel.java +++ b/src/main/java/com/rabbitmq/client/Channel.java @@ -84,14 +84,6 @@ public interface Channel extends ShutdownNotifier { */ void close(int closeCode, String closeMessage) throws IOException, TimeoutException; - /** - * Deprecated, superseded by TCP back pressure. - * Will be removed in next major release. - * @deprecated - * @see Resource-driven alarms - */ - boolean flowBlocked(); - /** * Abort this channel with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code * and message 'OK'. @@ -128,37 +120,6 @@ public interface Channel extends ShutdownNotifier { */ void clearReturnListeners(); - /** - * Add a {@link FlowListener}. - * Deprecated, superseded by TCP back pressure. - * Will be removed in next major release. - * @deprecated - * @see Resource-driven alarms - * @param listener the listener to add - */ - void addFlowListener(FlowListener listener); - - /** - * Remove a {@link FlowListener}. - * Deprecated, superseded by TCP back pressure. - * Will be removed in next major release. - * @deprecated - * @see Resource-driven alarms - * @param listener the listener to remove - * @return true if the listener was found and removed, - * false otherwise - */ - boolean removeFlowListener(FlowListener listener); - - /** - * Remove all {@link FlowListener}s. - * Deprecated, superseded by TCP back pressure. - * Will be removed in next major release. - * @deprecated - * @see Resource-driven alarms - */ - void clearFlowListeners(); - /** * Add a {@link ConfirmListener}. * @param listener the listener to add diff --git a/src/main/java/com/rabbitmq/client/ExceptionHandler.java b/src/main/java/com/rabbitmq/client/ExceptionHandler.java index 958bb1c5df..d93671a0d2 100644 --- a/src/main/java/com/rabbitmq/client/ExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/ExceptionHandler.java @@ -38,16 +38,6 @@ public interface ExceptionHandler { */ void handleReturnListenerException(Channel channel, Throwable exception); - /** - * Perform any required exception processing for the situation - * when the driver thread for the connection has called a - * FlowListener's handleFlow method, and that method has - * thrown an exception. - * @param channel the ChannelN that held the FlowListener - * @param exception the exception thrown by FlowListener.handleFlow - */ - void handleFlowListenerException(Channel channel, Throwable exception); - /** * Perform any required exception processing for the situation * when the driver thread for the connection has called a diff --git a/src/main/java/com/rabbitmq/client/FlowListener.java b/src/main/java/com/rabbitmq/client/FlowListener.java deleted file mode 100644 index 4f6ac1b3e8..0000000000 --- a/src/main/java/com/rabbitmq/client/FlowListener.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -// -// This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 -// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see -// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, -// please see LICENSE-APACHE2. -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. -// -// If you have any questions regarding licensing, please contact us at -// info@rabbitmq.com. - - -package com.rabbitmq.client; - -import java.io.IOException; - -/** - * Implement this interface in order to be notified of Channel.Flow - * events. - * Deprecated, superseded by TCP back pressure. - * Will be removed in next major release. - * @deprecated - */ -public interface FlowListener { - void handleFlow(boolean active) - throws IOException; -} diff --git a/src/main/java/com/rabbitmq/client/NullTrustManager.java b/src/main/java/com/rabbitmq/client/NullTrustManager.java deleted file mode 100644 index b99d252615..0000000000 --- a/src/main/java/com/rabbitmq/client/NullTrustManager.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -// -// This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 -// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see -// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, -// please see LICENSE-APACHE2. -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. -// -// If you have any questions regarding licensing, please contact us at -// info@rabbitmq.com. - - -package com.rabbitmq.client; - -import org.slf4j.LoggerFactory; - -import java.security.cert.X509Certificate; - -import javax.net.ssl.X509TrustManager; - -/** - * Convenience class providing a default implementation of javax.net.ssl.X509TrustManager. - * Trusts every single certificate presented to it. - * - * Deprecated, use {@link TrustEverythingTrustManager} instead. - * Will be removed in next major release. - * - * @deprecated - */ -public class NullTrustManager implements X509TrustManager { - - public NullTrustManager() { - LoggerFactory.getLogger(NullTrustManager.class).warn( - "This trust manager trusts every certificate, effectively disabling peer verification. " + - "This is convenient for local development but prone to man-in-the-middle attacks. " + - "Please see http://www.rabbitmq.com/ssl.html#validating-cerficates to learn more about peer certificate validation." - ); - } - - /** - * Doesn't even bother looking at its arguments, simply returns, - * which makes the check succeed. - */ - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) { - // Do nothing. - } - - /** - * Doesn't even bother looking at its arguments, simply returns, - * which makes the check succeed. - */ - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) { - // Do nothing. - } - - /** - * Always returns an empty array of X509Certificates. - */ - @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[0]; - } -} diff --git a/src/main/java/com/rabbitmq/client/impl/ChannelN.java b/src/main/java/com/rabbitmq/client/impl/ChannelN.java index a7622bd34a..fc2952ee37 100644 --- a/src/main/java/com/rabbitmq/client/impl/ChannelN.java +++ b/src/main/java/com/rabbitmq/client/impl/ChannelN.java @@ -64,8 +64,6 @@ public class ChannelN extends AMQChannel implements com.rabbitmq.client.Channel /* All listeners collections are in CopyOnWriteArrayList objects */ /** The ReturnListener collection. */ private final Collection returnListeners = new CopyOnWriteArrayList(); - /** The FlowListener collection. */ - private final Collection flowListeners = new CopyOnWriteArrayList(); /** The ConfirmListener collection. */ private final Collection confirmListeners = new CopyOnWriteArrayList(); @@ -147,24 +145,6 @@ public void clearReturnListeners() { returnListeners.clear(); } - @Override - @Deprecated - public void addFlowListener(FlowListener listener) { - flowListeners.add(listener); - } - - @Override - @Deprecated - public boolean removeFlowListener(FlowListener listener) { - return flowListeners.remove(listener); - } - - @Override - @Deprecated - public void clearFlowListeners() { - flowListeners.clear(); - } - @Override public void addConfirmListener(ConfirmListener listener) { confirmListeners.add(listener); @@ -353,7 +333,6 @@ private void releaseChannel() { transmit(new Channel.FlowOk(!_blockContent)); _channelMutex.notifyAll(); } - callFlowListeners(command, channelFlow); return true; } else if (method instanceof Basic.Ack) { Basic.Ack ack = (Basic.Ack) method; @@ -469,16 +448,6 @@ private void callReturnListeners(Command command, Basic.Return basicReturn) { } } - private void callFlowListeners(@SuppressWarnings("unused") Command command, Channel.Flow channelFlow) { - try { - for (FlowListener l : this.flowListeners) { - l.handleFlow(channelFlow.getActive()); - } - } catch (Throwable ex) { - getConnection().getExceptionHandler().handleFlowListenerException(this, ex); - } - } - private void callConfirmListeners(@SuppressWarnings("unused") Command command, Basic.Ack ack) { try { for (ConfirmListener l : this.confirmListeners) { @@ -1337,13 +1306,6 @@ public Confirm.SelectOk confirmSelect() } - /** Public API - {@inheritDoc} */ - @Override - @Deprecated - public boolean flowBlocked() { - return _blockContent; - } - /** Public API - {@inheritDoc} */ @Override public long getNextPublishSeqNo() { diff --git a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java index c13758459e..a91bf86f30 100644 --- a/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/ForgivingExceptionHandler.java @@ -41,11 +41,6 @@ public void handleReturnListenerException(Channel channel, Throwable exception) handleChannelKiller(channel, exception, "ReturnListener.handleReturn"); } - @Override - public void handleFlowListenerException(Channel channel, Throwable exception) { - handleChannelKiller(channel, exception, "FlowListener.handleFlow"); - } - @Override public void handleConfirmListenerException(Channel channel, Throwable exception) { handleChannelKiller(channel, exception, "ConfirmListener.handle{N,A}ck"); diff --git a/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java b/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java index 2c722d5d76..d1c1214e5a 100644 --- a/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java +++ b/src/main/java/com/rabbitmq/client/impl/StrictExceptionHandler.java @@ -35,11 +35,6 @@ public void handleReturnListenerException(Channel channel, Throwable exception) handleChannelKiller(channel, exception, "ReturnListener.handleReturn"); } - @Override - public void handleFlowListenerException(Channel channel, Throwable exception) { - handleChannelKiller(channel, exception, "FlowListener.handleFlow"); - } - @Override public void handleConfirmListenerException(Channel channel, Throwable exception) { handleChannelKiller(channel, exception, "ConfirmListener.handle{N,A}ck"); diff --git a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java index 2ce488f00d..fdc9fb86ce 100644 --- a/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java +++ b/src/main/java/com/rabbitmq/client/impl/recovery/AutorecoveringChannel.java @@ -36,7 +36,6 @@ public class AutorecoveringChannel implements RecoverableChannel { private final List recoveryListeners = new CopyOnWriteArrayList(); private final List returnListeners = new CopyOnWriteArrayList(); private final List confirmListeners = new CopyOnWriteArrayList(); - private final List flowListeners = new CopyOnWriteArrayList(); private final Set consumerTags = Collections.synchronizedSet(new HashSet()); private int prefetchCountConsumer; private int prefetchCountGlobal; @@ -83,12 +82,6 @@ public void close(int closeCode, String closeMessage) throws IOException, Timeou } } - @Override - @Deprecated - public boolean flowBlocked() { - return delegate.flowBlocked(); - } - @Override public void abort() throws IOException { delegate.abort(); @@ -117,27 +110,6 @@ public void clearReturnListeners() { delegate.clearReturnListeners(); } - @Override - @Deprecated - public void addFlowListener(FlowListener listener) { - this.flowListeners.add(listener); - delegate.addFlowListener(listener); - } - - @Override - @Deprecated - public boolean removeFlowListener(FlowListener listener) { - this.flowListeners.remove(listener); - return delegate.removeFlowListener(listener); - } - - @Override - @Deprecated - public void clearFlowListeners() { - this.flowListeners.clear(); - delegate.clearFlowListeners(); - } - @Override public void addConfirmListener(ConfirmListener listener) { this.confirmListeners.add(listener); @@ -607,7 +579,6 @@ public void automaticallyRecover(AutorecoveringConnection connection, Connection this.recoverShutdownListeners(); this.recoverReturnListeners(); this.recoverConfirmListeners(); - this.recoverFlowListeners(); this.recoverState(); this.notifyRecoveryListenersComplete(); } @@ -630,13 +601,6 @@ private void recoverConfirmListeners() { } } - @Deprecated - private void recoverFlowListeners() { - for(FlowListener fl : this.flowListeners) { - this.delegate.addFlowListener(fl); - } - } - private void recoverState() throws IOException { if (this.prefetchCountConsumer != 0) { basicQos(this.prefetchCountConsumer, false); diff --git a/src/main/java/com/rabbitmq/utility/SingleShotLinearTimer.java b/src/main/java/com/rabbitmq/utility/SingleShotLinearTimer.java deleted file mode 100644 index bef801229c..0000000000 --- a/src/main/java/com/rabbitmq/utility/SingleShotLinearTimer.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved. -// -// This software, the RabbitMQ Java client library, is triple-licensed under the -// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 -// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see -// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, -// please see LICENSE-APACHE2. -// -// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, -// either express or implied. See the LICENSE file for specific language governing -// rights and limitations of this software. -// -// If you have any questions regarding licensing, please contact us at -// info@rabbitmq.com. - - -package com.rabbitmq.utility; - -import com.rabbitmq.client.impl.AMQChannel; - -/** - * This class provides a very stripped-down clone of some of the functionality in - * java.util.Timer (notably Timer.schedule(TimerTask task, long delay) but - * uses System.nanoTime() rather than System.currentTimeMillis() as a measure - * of the underlying time, and thus behaves correctly if the system clock jumps - * around. - * - * This class does not have any relation to TimerTask due to the coupling - * between TimerTask and Timer - for example if someone invokes - * TimerTask.cancel(), we can't find out about it as TimerTask.state is - * package-private. - * - * We currently just use this to time the quiescing RPC in AMQChannel. - * - * Will be removed in next major release. - * - * @deprecated - * @see AMQChannel - */ - -public class SingleShotLinearTimer { - private volatile Runnable _task; - private Thread _thread; - - public synchronized void schedule(Runnable task, int timeoutMillisec) { - if (task == null) { - throw new IllegalArgumentException("Don't schedule a null task"); - } - - if (_task != null) { - throw new UnsupportedOperationException("Don't schedule more than one task"); - } - - if (timeoutMillisec < 0) { - throw new IllegalArgumentException("Timeout must not be negative"); - } - - _task = task; - - _thread = new Thread(new TimerThread(timeoutMillisec)); - _thread.setDaemon(true); - _thread.start(); - } - - private static final long NANOS_IN_MILLI = 1000 * 1000; - - private class TimerThread implements Runnable { - private final long _runTime; - - public TimerThread(long timeoutMillisec) { - _runTime = System.nanoTime() / NANOS_IN_MILLI + timeoutMillisec; - } - - @Override - public void run() { - try { - long now; - boolean wasInterrupted = false; - try { - while ((now = System.nanoTime() / NANOS_IN_MILLI) < _runTime) { - if (_task == null) break; - - try { - synchronized(this) { - wait(_runTime - now); - } - } catch (InterruptedException e) { - wasInterrupted = true; - } - } - } finally { - if (wasInterrupted) - Thread.currentThread().interrupt(); - } - - Runnable task = _task; - if (task != null) { - task.run(); - } - - } finally { - _task = null; - } - } - } - - public void cancel() { - _task = null; - } -} diff --git a/src/main/java/com/rabbitmq/client/QueueingConsumer.java b/src/test/java/com/rabbitmq/client/QueueingConsumer.java similarity index 99% rename from src/main/java/com/rabbitmq/client/QueueingConsumer.java rename to src/test/java/com/rabbitmq/client/QueueingConsumer.java index 0a67a8b322..e803720e42 100644 --- a/src/main/java/com/rabbitmq/client/QueueingConsumer.java +++ b/src/test/java/com/rabbitmq/client/QueueingConsumer.java @@ -26,7 +26,8 @@ /** * Convenience class: an implementation of {@link Consumer} with - * straightforward blocking semantics. + * straightforward blocking semantics. It is meant to be using in + * tests. * * Deprecated in favor of {@link DefaultConsumer} (see below for background). * Will be removed in next major release. @@ -87,7 +88,6 @@ * to extend DefaultConsumer and QueueingConsumer * is a lot less relevant.

* - * @deprecated */ public class QueueingConsumer extends DefaultConsumer { private final BlockingQueue _queue;