public class JMSSQLFilter
extends weblogic.messaging.common.SQLFilter
In this Filter implementation, the "expression" is a string that must match JMS SQL filter syntax, plus the special JMS "noLocal" flag. The expression must be created by creating an instance of the class JMSSQLExpression. The object to match must be a weblogic.jms.common.MessageImpl.
There are two data structures in this implementation. The first is used for the special case of a "xxx IS NOT NULL" selector. In this case, we use a map where the key is the value of "xxx" and the values are a list of queues. This gives us constant-time matching of messages, depending on the number of properties in the JMS message; constant-time insertion of new subscribers; and linear-time removal, depending on the number of "xxx IS NOT NULL" consumers.
The second data structure is used by all other types of selectors. It consists of a an ordered map (we use the LinkedHashMap class) of all the consumers. To implement "fairness", the first matching consumer is "rotated" to the end of the list by removing it and re-inserting it.
In this data structure, Each consumer points to an expression, and multiple consumers may point to the same expression, to save evaluation of duplicate selectors. This gives us linear-time matching of messages, depending mostly on the number of unique selectors; constant-time insertion of new subscribers; and constant-time removal.
Modifier and Type | Class and Description |
---|---|
private class |
JMSSQLFilter.Exp
This is the class for evaluating a regular JMS SQL expression.
|
Modifier and Type | Field and Description |
---|---|
private static boolean |
enable1213NoLocalSemanticForDuraSubRestrictedClientID |
private java.util.Map<weblogic.messaging.kernel.Sink,weblogic.messaging.kernel.Expression> |
filteredForwardedAndMoreSubs
Subscribers with only filtered forwarded selector ("NOT JMS_WL_DDForwarded AND (other expression)")
|
private java.util.Map |
filteredForwardedIndexedSubs
This map associates the "NOT JMS_WL_DDForwarded AND (value IS NOT NULL)"
subscriber ID with an object.
|
private java.util.Set<weblogic.messaging.kernel.Sink> |
filteredForwardedSubs
Subscribers with only filtered forwarded selector ("NOT JMS_WL_DDForwarded")
|
private java.util.Map |
indexedSubscribers
This map associates the "value IS NOT NULL" subscriber ID with an object.
|
Constructor and Description |
---|
JMSSQLFilter(weblogic.messaging.kernel.Kernel kernel) |
Modifier and Type | Method and Description |
---|---|
private void |
addIndexedSubscriber(weblogic.messaging.kernel.Sink sink,
java.lang.String selectorId,
boolean isFilteredForwarded) |
weblogic.messaging.kernel.Expression |
createExpression(java.lang.Object exp)
Parse the expression and create an object for later evaluation.
|
java.util.Collection |
match(weblogic.messaging.kernel.MessageElement message)
Override the generic "match" method to provide indexed subscriber support.
|
private void |
removeIndexedSubscriber(weblogic.messaging.kernel.Sink sink) |
void |
subscribe(weblogic.messaging.kernel.Sink sink,
weblogic.messaging.kernel.Expression exp)
Here, we override the normal subscription mechanism from SQLFilter
to deal with indexed subscribers.
|
void |
unsubscribe(weblogic.messaging.kernel.Sink sink) |
private static boolean enable1213NoLocalSemanticForDuraSubRestrictedClientID
private final java.util.Map indexedSubscribers
private final java.util.Map filteredForwardedIndexedSubs
private final java.util.Set<weblogic.messaging.kernel.Sink> filteredForwardedSubs
private final java.util.Map<weblogic.messaging.kernel.Sink,weblogic.messaging.kernel.Expression> filteredForwardedAndMoreSubs
public weblogic.messaging.kernel.Expression createExpression(java.lang.Object exp) throws weblogic.messaging.kernel.KernelException
createExpression
in interface weblogic.messaging.kernel.Filter
createExpression
in class weblogic.messaging.common.SQLFilter
weblogic.messaging.kernel.KernelException
public void subscribe(weblogic.messaging.kernel.Sink sink, weblogic.messaging.kernel.Expression exp)
subscribe
in interface weblogic.messaging.kernel.Filter
subscribe
in class weblogic.messaging.common.SQLFilter
private void addIndexedSubscriber(weblogic.messaging.kernel.Sink sink, java.lang.String selectorId, boolean isFilteredForwarded)
public void unsubscribe(weblogic.messaging.kernel.Sink sink)
unsubscribe
in interface weblogic.messaging.kernel.Filter
unsubscribe
in class weblogic.messaging.common.SQLFilter
private void removeIndexedSubscriber(weblogic.messaging.kernel.Sink sink)
public java.util.Collection match(weblogic.messaging.kernel.MessageElement message)
match
in interface weblogic.messaging.kernel.Filter
match
in class weblogic.messaging.common.SQLFilter