use of com.ociweb.gl.impl.PubSubMethodListenerBase in project GreenLightning by oci-pronghorn.
the class ReactiveListenerStage method addSubscription.
public final <T extends Behavior> ListenerFilter addSubscription(CharSequence topic, CallableStaticMethod<T> method) {
if (null == methods) {
methodLookup = new TrieParser(16, 1, false, false, false);
methodReader = new TrieParserReader(0, true);
methods = new CallableStaticMethod[0];
}
if (!startupCompleted && listener instanceof PubSubMethodListenerBase) {
builder.addStartupSubscription(topic, System.identityHashCode(listener), parallelInstance);
toStringDetails = toStringDetails + "sub:'" + topic + "'\n";
} else {
if (startupCompleted) {
throw new UnsupportedOperationException("Method dispatch subscritpions may not be modified at runtime.");
}
}
int id = methods.length;
methodLookup.setUTF8Value(topic, id);
// grow the array of methods to be called
CallableStaticMethod[] newArray = new CallableStaticMethod[id + 1];
System.arraycopy(methods, 0, newArray, 0, id);
newArray[id] = method;
methods = newArray;
//
return this;
}
Aggregations