qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1723937 - in /qpid/java/trunk: bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/ broker-core/src/main/java/org/apache/qpid/server/model/ broker-core/src/main/java/org/apache/qpid/server/queue/ broker-core/src/main/java/...
Date Sun, 10 Jan 2016 16:30:04 GMT
Author: rgodfrey
Date: Sun Jan 10 16:30:03 2016
New Revision: 1723937

URL: http://svn.apache.org/viewvc?rev=1723937&view=rev
Log:
QPID-6982 : [Java Broker] Refactor VirtualHost to remove unnecessary methods

Removed:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostConnectionListener.java
Modified:
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java
    qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
    qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
    qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
    qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
(original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
Sun Jan 10 16:30:03 2016
@@ -344,20 +344,6 @@ public class BDBHAReplicaVirtualHostImpl
     }
 
     @Override
-    public ListenableFuture<Integer> removeQueueAsync(final Queue<?> queue)
-    {
-        throwUnsupportedForReplica();
-        return null;
-    }
-
-    @Override
-    public int removeQueue(final Queue<?> queue)
-    {
-        throwUnsupportedForReplica();
-        return 0;
-    }
-
-    @Override
     public Collection<Exchange<?>> getExchanges()
     {
         return Collections.emptyList();
@@ -541,15 +527,4 @@ public class BDBHAReplicaVirtualHostImpl
                                         + " does not permit this operation.");
     }
 
-    @Override
-    public void addConnectionAssociationListener(VirtualHostConnectionListener listener)
-    {
-
-    }
-
-    @Override
-    public void removeConnectionAssociationListener(VirtualHostConnectionListener listener)
-    {
-
-    }
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/Queue.java Sun
Jan 10 16:30:03 2016
@@ -202,7 +202,10 @@ public interface Queue<X extends Queue<X
 
     void visit(QueueEntryVisitor visitor);
 
-    ListenableFuture<Integer> deleteAndReturnCount();
+    ListenableFuture<Integer> deleteAndReturnCountAsync();
+
+    int deleteAndReturnCount();
+
 
     void setNotificationListener(QueueNotificationListener listener);
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java
Sun Jan 10 16:30:03 2016
@@ -29,8 +29,6 @@ import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ScheduledFuture;
 
-import com.google.common.util.concurrent.ListenableFuture;
-
 import org.apache.qpid.server.logging.EventLoggerProvider;
 import org.apache.qpid.server.message.MessageDestination;
 import org.apache.qpid.server.message.MessageSource;
@@ -45,7 +43,6 @@ import org.apache.qpid.server.transport.
 import org.apache.qpid.server.txn.DtxRegistry;
 import org.apache.qpid.server.virtualhost.HouseKeepingTask;
 import org.apache.qpid.server.virtualhost.NodeAutoCreationPolicy;
-import org.apache.qpid.server.virtualhost.VirtualHostConnectionListener;
 
 @ManagedObject( defaultType = "ProvidedStore", description = VirtualHost.CLASS_DESCRIPTION)
 public interface VirtualHost<X extends VirtualHost<X>> extends ConfiguredObject<X>,
StatisticsGatherer,
@@ -228,10 +225,6 @@ public interface VirtualHost<X extends V
 
     MessageSource getAttainedMessageSource(String name);
 
-    int removeQueue(Queue<?> queue);
-
-    ListenableFuture<Integer> removeQueueAsync(Queue<?> queue);
-
     Exchange getAttainedExchange(String name);
 
     MessageDestination getAttainedMessageDestination(String name);
@@ -280,6 +273,4 @@ public interface VirtualHost<X extends V
 
     long getTotalQueueDepthBytes();
 
-    void addConnectionAssociationListener(VirtualHostConnectionListener listener);
-    void removeConnectionAssociationListener(VirtualHostConnectionListener listener);
 }

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
Sun Jan 10 16:30:03 2016
@@ -20,7 +20,6 @@ package org.apache.qpid.server.queue;
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.nio.ByteBuffer;
 import java.security.AccessControlContext;
 import java.security.AccessControlException;
 import java.security.AccessController;
@@ -525,7 +524,7 @@ public abstract class AbstractQueue<X ex
                                  @Override
                                  public Void run()
                                  {
-                                     getVirtualHost().removeQueue(AbstractQueue.this);
+                                     AbstractQueue.this.delete();
                                      return null;
                                  }
                              });
@@ -954,7 +953,7 @@ public abstract class AbstractQueue<X ex
                                  @Override
                                  public Object run()
                                  {
-                                     getVirtualHost().removeQueue(AbstractQueue.this);
+                                     AbstractQueue.this.delete();
                                      return null;
                                  }
                              });
@@ -1909,7 +1908,14 @@ public abstract class AbstractQueue<X ex
         _deleteTaskList.remove(task);
     }
 
-    public ListenableFuture<Integer> deleteAndReturnCount()
+    @Override
+    public int deleteAndReturnCount()
+    {
+        return doSync(deleteAndReturnCountAsync());
+    }
+
+    @Override
+    public ListenableFuture<Integer> deleteAndReturnCountAsync()
     {
         // Check access
         _virtualHost.getSecurityManager().authoriseDelete(this);
@@ -1951,6 +1957,7 @@ public abstract class AbstractQueue<X ex
                         routeToAlternate(entries);
 
                         preSetAlternateExchange();
+                        _alternateExchange = null;
 
                         performQueueDeleteTasks();
                         deleted();
@@ -1959,6 +1966,7 @@ public abstract class AbstractQueue<X ex
                         getEventLogger().message(_logSubject, QueueMessages.DELETED());
 
                         _deleteFuture.set(queueDepthMessages);
+                        setState(State.DELETED);
                     }
                     catch(Throwable e)
                     {
@@ -3067,14 +3075,13 @@ public abstract class AbstractQueue<X ex
     @StateTransition(currentState = State.ACTIVE, desiredState = State.DELETED)
     private ListenableFuture<Void> doDelete()
     {
-        ListenableFuture<Integer> removeFuture = _virtualHost.removeQueueAsync(this);
+        ListenableFuture<Integer> removeFuture = deleteAndReturnCountAsync();
         return doAfter(removeFuture, new Runnable()
         {
             @Override
             public void run()
             {
-                preSetAlternateExchange();
-                setState(State.DELETED);
+
             }
         });
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
Sun Jan 10 16:30:03 2016
@@ -108,7 +108,6 @@ public abstract class AbstractVirtualHos
 
 
     private final Set<AMQPConnection<?>> _connections = newSetFromMap(new ConcurrentHashMap<AMQPConnection<?>,
Boolean>());
-    private final Set<VirtualHostConnectionListener> _connectionAssociationListeners
= new CopyOnWriteArraySet<>();
     private final AccessControlContext _housekeepingJobContext;
     private final AccessControlContext _fileSystemSpaceCheckerJobContext;
 
@@ -856,18 +855,6 @@ public abstract class AbstractVirtualHos
         return children;
     }
 
-    @Override
-    public int removeQueue(Queue<?> queue)
-    {
-        return doSync(removeQueueAsync(queue));
-    }
-
-    @Override
-    public ListenableFuture<Integer> removeQueueAsync(final Queue<?> queue)
-    {
-        return queue.deleteAndReturnCount();
-    }
-
     public Queue<?> createQueue(Map<String, Object> attributes) throws QueueExistsException
     {
         return (Queue<?> )createChild(Queue.class, attributes);
@@ -1885,10 +1872,6 @@ public abstract class AbstractVirtualHos
 
                 connection.setScheduler(_networkConnectionScheduler);
 
-                for (VirtualHostConnectionListener listener : _connectionAssociationListeners)
-                {
-                    listener.connectionAssociated(connection);
-                }
                 return Futures.immediateFuture(null);
             }
 
@@ -1926,13 +1909,8 @@ public abstract class AbstractVirtualHos
             @Override
             public ListenableFuture<Void> execute()
             {
-                if (_connections.remove(connection))
-                {
-                    for (VirtualHostConnectionListener listener : _connectionAssociationListeners)
-                    {
-                        listener.connectionRemoved(connection);
-                    }
-                }
+                _connections.remove(connection);
+
                 return Futures.immediateFuture(null);
             }
 
@@ -2116,18 +2094,6 @@ public abstract class AbstractVirtualHos
         }
     }
 
-    @Override
-    public void addConnectionAssociationListener(VirtualHostConnectionListener listener)
-    {
-        _connectionAssociationListeners.add(listener);
-    }
-
-    @Override
-    public void removeConnectionAssociationListener(VirtualHostConnectionListener listener)
-    {
-        _connectionAssociationListeners.remove(listener);
-    }
-
     @StateTransition( currentState = { State.STOPPED, State.ERRORED }, desiredState = State.ACTIVE
)
     private ListenableFuture<Void> onRestart()
     {

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java
Sun Jan 10 16:30:03 2016
@@ -345,20 +345,6 @@ class RedirectingVirtualHostImpl
     }
 
     @Override
-    public ListenableFuture<Integer> removeQueueAsync(final Queue<?> queue)
-    {
-        throwUnsupportedForRedirector();
-        return null;
-    }
-
-    @Override
-    public int removeQueue(final Queue<?> queue)
-    {
-        throwUnsupportedForRedirector();
-        return 0;
-    }
-
-    @Override
     public Collection<Exchange<?>> getExchanges()
     {
         return Collections.emptyList();
@@ -542,16 +528,4 @@ class RedirectingVirtualHostImpl
                                         + " does not permit this operation.");
     }
 
-    @Override
-    public void addConnectionAssociationListener(VirtualHostConnectionListener listener)
-    {
-
-    }
-
-    @Override
-    public void removeConnectionAssociationListener(VirtualHostConnectionListener listener)
-    {
-
-    }
-
 }

Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
(original)
+++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/queue/StandardQueueTest.java
Sun Jan 10 16:30:03 2016
@@ -47,7 +47,7 @@ public class StandardQueueTest extends A
     public void testAutoDeleteQueue() throws Exception
     {
         getQueue().close();
-        getQueue().deleteAndReturnCount();
+        getQueue().delete();
         Map<String,Object> queueAttributes = new HashMap<>();
         queueAttributes.put(Queue.NAME, getQname());
         queueAttributes.put(Queue.LIFETIME_POLICY, LifetimePolicy.DELETE_ON_NO_OUTBOUND_LINKS);

Modified: qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
(original)
+++ qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerSessionDelegate.java
Sun Jan 10 16:30:03 2016
@@ -1529,7 +1529,7 @@ public class ServerSessionDelegate exten
 
                     try
                     {
-                        virtualHost.removeQueue(queue);
+                        queue.delete();
                     }
                     catch (AccessControlException e)
                     {

Modified: qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
(original)
+++ qpid/java/trunk/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
Sun Jan 10 16:30:03 2016
@@ -3453,7 +3453,7 @@ public class AMQChannel
                 {
                     try
                     {
-                        int purged = virtualHost.removeQueue(queue);
+                        int purged = queue.deleteAndReturnCount();
 
                         if (!nowait || _connection.isSendQueueDeleteOkRegardless())
                         {

Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java?rev=1723937&r1=1723936&r2=1723937&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
(original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/SendingLink_1_0.java
Sun Jan 10 16:30:03 2016
@@ -69,6 +69,7 @@ import org.apache.qpid.server.filter.JMS
 import org.apache.qpid.server.message.MessageInstance;
 import org.apache.qpid.server.message.MessageSource;
 import org.apache.qpid.server.model.Binding;
+import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.model.ExclusivityPolicy;
 import org.apache.qpid.server.model.LifetimePolicy;
@@ -429,12 +430,12 @@ public class SendingLink_1_0 implements
             {
                 try
                 {
-                    _vhost.removeQueue((Queue<?>)_queue);
+                    ((ConfiguredObject<?>)_queue).delete();
                 }
                 catch (AccessControlException e)
                 {
                     //TODO
-                    _logger.error("Error registering subscription", e);
+                    _logger.error("Error unregistering subscription", e);
                 }
             }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message