summaryrefslogtreecommitdiff
path: root/java/broker/src
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2009-08-06 16:57:12 +0000
committerMartin Ritchie <ritchiem@apache.org>2009-08-06 16:57:12 +0000
commite11e9d4618f8ae436f714737219aa3e4e1f6343b (patch)
treed1ab14d35c50dbf8512ed11ee10a208abfb95579 /java/broker/src
parentfd92cbe296fb90a1064ce9adfbc44ac7e30fb04d (diff)
downloadqpid-python-e11e9d4618f8ae436f714737219aa3e4e1f6343b.tar.gz
QPID-2002 : SubscriptionLogging Tests, update to SubscriptionImpl for new exclusive flag on setQueue
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@801719 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/src')
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java70
1 files changed, 50 insertions, 20 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java
index 51da884d1e..a959944434 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/subscription/SubscriptionImpl.java
@@ -33,6 +33,10 @@ import org.apache.qpid.common.ClientProperties;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.AMQChannel;
+import org.apache.qpid.server.logging.actors.CurrentActor;
+import org.apache.qpid.server.logging.messages.SubscriptionMessages;
+import org.apache.qpid.server.logging.subjects.SubscriptionLogSubject;
+import org.apache.qpid.server.logging.LogSubject;
import org.apache.qpid.server.queue.QueueEntry;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.subscription.Subscription;
@@ -63,14 +67,14 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage
private final AtomicReference<QueueEntry> _queueContext = new AtomicReference<QueueEntry>(null);
private final ClientDeliveryMethod _deliveryMethod;
private final RecordDeliveryMethod _recordMethod;
-
+
private QueueEntry.SubscriptionAcquiredState _owningState = new QueueEntry.SubscriptionAcquiredState(this);
private final Lock _stateChangeLock;
private static final AtomicLong idGenerator = new AtomicLong(0);
// Create a simple ID that increments for ever new Subscription
private final long _subscriptionID = idGenerator.getAndIncrement();
-
+ private LogSubject _logSubject;
static final class BrowserSubscription extends SubscriptionImpl
{
@@ -278,7 +282,7 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage
-
+
public SubscriptionImpl(AMQChannel channel , AMQProtocolSession protocolSession,
AMQShortString consumerTag, FieldTable arguments,
boolean noLocal, FlowCreditManager creditManager,
@@ -327,13 +331,51 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage
- public synchronized void setQueue(AMQQueue queue)
+ public synchronized void setQueue(AMQQueue queue, boolean exclusive)
{
if(getQueue() != null)
{
throw new IllegalStateException("Attempt to set queue for subscription " + this + " to " + queue + "when already set to " + getQueue());
}
_queue = queue;
+
+ _logSubject = new SubscriptionLogSubject(this);
+
+ if (CurrentActor.get().getRootMessageLogger().
+ isMessageEnabled(CurrentActor.get(), _logSubject))
+ {
+ // Get the string value of the filters
+ String filterLogString = null;
+ if (_filters != null && _filters.hasFilters())
+ {
+ filterLogString = _filters.toString();
+ }
+
+ if (isAutoClose())
+ {
+ if (filterLogString == null)
+ {
+ filterLogString = "";
+ }
+ else
+ {
+ filterLogString += ",";
+ }
+ filterLogString += "AutoClose";
+ }
+
+ if (isBrowser())
+ {
+ // We do not need to check for null here as all Browsers are AutoClose
+ filterLogString +=",Browser";
+ }
+
+ CurrentActor.get().
+ message(_logSubject,
+ SubscriptionMessages.SUB_1001(filterLogString,
+ queue.isDurable() && exclusive,
+ filterLogString != null));
+ }
}
public String toString()
@@ -480,20 +522,8 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage
}
- if (closed)
- {
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Called close() on a closed subscription");
- }
-
- return;
- }
-
- if (_logger.isInfoEnabled())
- {
- _logger.info("Closing subscription (" + debugIdentity() + "):" + this);
- }
+ //Log Subscription closed
+ CurrentActor.get().message(_logSubject, SubscriptionMessages.SUB_1002());
}
public boolean isClosed()
@@ -544,7 +574,7 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage
public AMQQueue getQueue()
{
- return _queue;
+ return _queue;
}
public void restoreCredit(final QueueEntry queueEntry)
@@ -555,7 +585,7 @@ public abstract class SubscriptionImpl implements Subscription, FlowCreditManage
public void creditStateChanged(boolean hasCredit)
{
-
+
if(hasCredit)
{
if(_state.compareAndSet(State.SUSPENDED, State.ACTIVE))