private long doRead(@NotNull ExcerptTailer tailer, int expected) { int[] i = {0}; long t_index = 0; while (true) { try (DocumentContext dc = tailer.readingDocument()) { if (!dc.isPresent()) break; t_index = tailer.index(); dc.wire().read("log").marshallable(m -> { String msg = m.read("msg").text(); assertNotNull(msg); System.out.println("msg:" + msg); i[0]++; }); } } assertEquals(expected, i[0]); return t_index; }
private static long doReadBad(@NotNull ExcerptTailer tailer, int expected, boolean additionalClose) { int[] i = {0}; long t_index = 0; while (true) { try (DocumentContext dc = tailer.readingDocument()) { if (!dc.isPresent()) break; t_index = tailer.index(); dc.wire().read("log").marshallable(m -> { String msg = m.read("msg").text(); assertNotNull(msg); i[0]++; }); if (additionalClose) { dc.close(); } } } assertEquals(expected, i[0]); return t_index; }
@Override public void readMarshallable(@NotNull WireIn wire) throws IllegalStateException { StringBuilder clusterName = Wires.acquireStringBuilder(); while (!wire.isEmpty()) { wire.readEventName(clusterName).marshallable(host -> { EngineCluster engineCluster = clusterMap.computeIfAbsent(clusterName.toString(), EngineCluster::new); engineCluster.readMarshallable(host); }); } }
private void readMarshallable(String path, @NotNull WireIn wire) { @NotNull StringBuilder name = new StringBuilder(); while (!wire.isEmpty()) { @NotNull ValueIn in = wire.read(name); long pos = wire.bytes().readPosition(); @NotNull String path2 = path + "/" + name; if (wire.getValueIn().isTyped()) { wire.bytes().readPosition(pos); @Nullable Object o = in.typedMarshallable(); installableMap.put(path2, (Installable) o); } else { in.marshallable(w -> this.readMarshallable(path2, w)); } } }
@Override public void onRead(@NotNull WireIn inWire, @NotNull WireOut outWire) { final StringBuilder eventName = Wires.acquireStringBuilder(); @NotNull final ValueIn valueIn = inWire.readEventName(eventName); if (lastUpdateTime.contentEquals(eventName)) { final long time = valueIn.int64(); final byte id = inWire.read(() -> "id").int8(); replication.setLastModificationTime(id, time); return; } // receives replication events if (replicationEvent.contentEquals(eventName)) { final VanillaReplicatedEntry entry = vre.get(); entry.clear(); valueIn.marshallable(entry); replication.applyReplication(entry); } }
@Override public void onConsumer(@NotNull final WireIn w) { w.readDocument(null, d -> { final StringBuilder eventname = Wires.acquireStringBuilder(); @NotNull final ValueIn valueIn = d.readEventName(eventname); if (EventId.onEndOfSubscription.contentEquals(eventname)) { subscriber.onEndOfSubscription(); subscribersToTid.remove(this); hub.unsubscribe(tid()); } else if (CoreFields.reply.contentEquals(eventname)) { valueIn.marshallable(m -> { @Nullable final E message = m.read(() -> "message").object(messageClass); RemoteReference.this.onEvent(message, subscriber); }); } }); }
valueIn.marshallable(m -> view.registerTopicSubscriber(listener)); return; valueIn.marshallable(wire -> { @NotNull final Params[] params = publish.params(); final T topic = wireToT.apply(wire.read(params[0]));
@Override public void onConsumer(@NotNull final WireIn inWire) { inWire.readDocument(null, d -> { StringBuilder sb = Wires.acquireStringBuilder(); @NotNull ValueIn valueIn = d.readEventName(sb); if (reply.contentEquals(sb)) { valueIn.marshallable(m -> { @Nullable final K topic = m.read(() -> "topic").object(kClass); @Nullable final V message = m.read(() -> "message").object(vClass); RemoteKVSSubscription.this.onEvent(topic, message, subscriber); }); } else if (onEndOfSubscription.contentEquals(sb)) { RemoteKVSSubscription.this.onEndOfSubscription(); hub.unsubscribe(tid()); } }); } });
@Override public void onConsumer(@NotNull final WireIn w) { w.readDocument(null, d -> { final StringBuilder eventname = Wires.acquireStringBuilder(); @NotNull final ValueIn valueIn = d.readEventName(eventname); if (onEndOfSubscription.contentEquals(eventname)) { subscriber.onEndOfSubscription(); subscribersToTid.remove(this); hub.unsubscribe(tid()); } else if (CoreFields.reply.contentEquals(eventname)) { valueIn.marshallable(m -> { try { @Nullable final M message = m.read(() -> "message").object(messageClass); RemotePublisher.this.onEvent(message, subscriber); } catch (InvalidSubscriberException e) { throw Jvm.rethrow(e); } }); } }); } });
valueIn.marshallable(m -> view.registerSubscriber(bootstrap, requestContext.throttlePeriodMs(), listener)); return; valueIn.marshallable(wire -> { @NotNull final Params[] params = publish.params();
@Override public void onConsumer(@NotNull final WireIn w) { w.readDocument(null, d -> { final StringBuilder eventname = Wires.acquireStringBuilder(); @NotNull final ValueIn valueIn = d.readEventName(eventname); if (onEndOfSubscription.contentEquals(eventname)) { topicSubscriber.onEndOfSubscription(); hub.unsubscribe(tid()); } else if (CoreFields.reply.contentEquals(eventname)) { valueIn.marshallable(m -> { @Nullable final T topic = m.read(() -> "topic").object(topicClass); @Nullable final M message = m.read(() -> "message").object(messageClass); try { RemoteTopicPublisher.this.onEvent(topic, message, topicSubscriber); } catch (InvalidSubscriberException e) { throw Jvm.rethrow(e); } }); } }); } });
valueIn.marshallable(replicatedEntry);
@Override public boolean action() throws InvalidEventHandlerException, InterruptedException { try { if (tailer == null) { tailer = rollingChronicleQueue.createTailer(); if (index > 0) tailer.moveToIndex(index); tailer.readingDocument(false).close(); } try (DocumentContext documentContext = tailer.readingDocument(false)) { if (!documentContext.isPresent()) return false; StringBuilder sb = Wires.acquireStringBuilder(); @NotNull ValueIn valueIn = documentContext.wire().read(sb); if ("NetworkStats".contentEquals(sb)) { valueIn.marshallable(ns); final String userId = ns.userId(); if (userId != null && !userId.isEmpty()) { updateMap(ns, documentContext.index()); } } } return true; } catch (Throwable t) { t.printStackTrace(); return true; } }
valueIn.marshallable(m -> view.registerSubscriber(bootstrap, requestContext.throttlePeriodMs(), listener)); valueIn.marshallable(w -> { @NotNull final Params[] params = publish.params();
valueIn.marshallable(v);
read.marshallable(MessageHistory.get()); return true; long readPosition = dc.wire().bytes().readPosition(); try { read.marshallable(v); } catch (Exception e) {
Jvm.debug().on(getClass(), "server : received replicationEvent"); VanillaReplicatedEntry replicatedEntry = vre.get(); valueIn.marshallable(replicatedEntry);
valueIn.marshallable(m -> view.registerTopicSubscriber(listener)); return; valueIn.marshallable(wire -> { @NotNull final Params[] params = publish.params(); final T topic = wireToT.apply(wire.read(params[0]));
valueIn.marshallable(wire -> { newRow.clear(); oldRow.clear(); valueIn.marshallable(sortedFilter); long token = nextToken.incrementAndGet(); final long cid = cspManager.createProxy("ColumnViewIterator", token);
Jvm.debug().on(getClass(), "server : received replicationEvent"); VanillaReplicatedEntry replicatedEntry = vre.get(); valueIn.marshallable(replicatedEntry);