Search in sources :

Example 6 with TrieParserReader

use of com.ociweb.pronghorn.util.TrieParserReader in project GreenLightning by oci-pronghorn.

the class MsgCommandChannel method unScopedCheckForTrack.

private static void unScopedCheckForTrack(MsgCommandChannel cmd, DataOutputBlobWriter<MessagePubSub> output) {
    boolean addSuffix = false;
    if (null != cmd.unScopedReader) {
        // only do this if 1. we are tracked & 2. there are unscoped topics
        addSuffix = BuilderImpl.notUnscoped(cmd.unScopedReader, output);
    } else {
        cmd.unScopedReader = new TrieParserReader(0, true);
        // only do this if 1. we are tracked & 2. there are unscoped topics
        addSuffix = BuilderImpl.notUnscoped(cmd.unScopedReader, output);
    }
    if (addSuffix) {
        output.write(cmd.track);
    }
}
Also used : TrieParserReader(com.ociweb.pronghorn.util.TrieParserReader)

Example 7 with TrieParserReader

use of com.ociweb.pronghorn.util.TrieParserReader 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;
}
Also used : PubSubMethodListenerBase(com.ociweb.gl.impl.PubSubMethodListenerBase) TrieParser(com.ociweb.pronghorn.util.TrieParser) TrieParserReader(com.ociweb.pronghorn.util.TrieParserReader)

Aggregations

TrieParserReader (com.ociweb.pronghorn.util.TrieParserReader)7 TrieParser (com.ociweb.pronghorn.util.TrieParser)3 Pipe (com.ociweb.pronghorn.pipe.Pipe)2 RawDataSchema (com.ociweb.pronghorn.pipe.RawDataSchema)2 PubSubMethodListenerBase (com.ociweb.gl.impl.PubSubMethodListenerBase)1 IntHashTable (com.ociweb.pronghorn.pipe.util.hash.IntHashTable)1 Test (org.junit.Test)1