net.openhft.chronicle.wire.WireOut Java Examples

The following examples show how to use net.openhft.chronicle.wire.WireOut. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VanillaChronicleMap.java    From Chronicle-Map with Apache License 2.0 6 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    ;
    super.writeMarshallable(wireOut);

    wireOut.write(() -> "valueClass").typeLiteral(valueClass);
    wireOut.write(() -> "valueSizeMarshaller").object(valueSizeMarshaller);
    wireOut.write(() -> "valueReader").object(valueReader);
    wireOut.write(() -> "valueDataAccess").object(valueDataAccess);

    wireOut.write(() -> "constantlySizedEntry").bool(constantlySizedEntry);

    wireOut.write(() -> "alignment").int32(alignment);
    wireOut.write(() -> "worstAlignment").int32(worstAlignment);
    wireOut.write(() -> "maxBloatFactor").float64(maxBloatFactor);
}
 
Example #2
Source File: WireEchoRequestHandler.java    From Chronicle-Network with Apache License 2.0 6 votes vote down vote up
/**
 * simply reads the csp,tid and payload and sends back the tid and payload
 *
 * @param inWire  the wire from the client
 * @param outWire the wire to be sent back to the server
 * @param sd      details about this session
 */
@Override
protected void process(@NotNull WireIn inWire,
                       @NotNull WireOut outWire,
                       @NotNull SessionDetailsProvider sd) {

    inWire.readDocument(m -> {
        long tid = inWire.read(() -> "tid").int64();
        outWire.writeDocument(true, meta -> meta.write(() -> "tid")
                .int64(tid));

    }, d -> {
        outWire.writeDocument(false, data -> data.write(() -> "payloadResponse")
                .text(inWire.read(() -> "payload").text()));
    });
}
 
Example #3
Source File: HeartbeatHandler.java    From Chronicle-Network with Apache License 2.0 6 votes vote down vote up
@Override
public void onInitialize(@NotNull WireOut outWire) {

    if (nc().eventLoop().isClosed())
        return;

    if (nc().isAcceptor())
        heartbeatHandler(heartbeatTimeoutMs, heartbeatIntervalMs, cid()).writeMarshallable
                (outWire);

    @NotNull final WriteMarshallable heartbeatMessage = new HeartbeatMessage();

    connectionMonitor = nc().acquireConnectionListener();
    timer = new Timer(nc().eventLoop());
    startPeriodicHeartbeatCheck();
    startPeriodicallySendingHeartbeats(heartbeatMessage);
}
 
Example #4
Source File: ReadonlyTableStore.java    From Chronicle-Queue with Apache License 2.0 5 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wire) {
    ;
    UnsupportedOperationException read_only = new UnsupportedOperationException("Read only");
    read_only.printStackTrace();
    throw read_only;
}
 
Example #5
Source File: WireEchoRequestHandler.java    From Chronicle-Network with Apache License 2.0 5 votes vote down vote up
/**
 * simply reads the csp,tid and payload and sends back the tid and payload
 *
 * @param in      the DocumentContext from the client
 * @param outWire the wire to be sent back to the server
 */
@Override
protected void onRead(@NotNull DocumentContext in,
                      @NotNull WireOut outWire) {

    if (in.isMetaData())
        outWire.writeDocument(true, meta -> meta.write(() -> "tid")
                .int64(in.wire().read(() -> "tid").int64()));
    else
        outWire.writeDocument(false, data -> data.write(() -> "payloadResponse")
                .text(in.wire().read(() -> "payload").text()));

}
 
Example #6
Source File: ReplicatedChronicleMap.java    From Chronicle-Map with Apache License 2.0 5 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    ;
    super.writeMarshallable(wireOut);

    wireOut.write(() -> "tierModIterBitSetSizeInBits").int64(tierModIterBitSetSizeInBits);
    wireOut.write(() -> "tierModIterBitSetOuterSize").int64(tierModIterBitSetOuterSize);
    wireOut.write(() -> "segmentModIterBitSetsForIdentifierOuterSize")
            .int64(segmentModIterBitSetsForIdentifierOuterSize);
    wireOut.write(() -> "tierBulkModIterBitSetsForIdentifierOuterSize")
            .int64(tierBulkModIterBitSetsForIdentifierOuterSize);
}
 
Example #7
Source File: TerminatorHandler.java    From Chronicle-Network with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitialize(@NotNull WireOut outWire) {
    if (isClosed.getAndSet(true))
        return;
    nc().terminationEventHandler().onTerminate(nc());
    Closeable.closeQuietly(closable());
}
 
Example #8
Source File: MapMarshaller.java    From Chronicle-Map with Apache License 2.0 5 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    wireOut.write(() -> "keyReader").typedMarshallable(keyReader);
    wireOut.write(() -> "keyWriter").typedMarshallable(keyWriter);
    wireOut.write(() -> "valueReader").typedMarshallable(valueReader);
    wireOut.write(() -> "valueWriter").typedMarshallable(valueWriter);
}
 
Example #9
Source File: HeartbeatHandler.java    From Chronicle-Network with Apache License 2.0 5 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut w) {
    w.writeDocument(true,
            d -> d.writeEventName(CoreFields.csp).text("/")
                    .writeEventName(CoreFields.cid).int64(cid)
                    .writeEventName(CoreFields.handler).typedMarshallable(new
                            HeartbeatHandler<>(heartbeatTimeoutMs, heartbeatIntervalMs)));
}
 
Example #10
Source File: SCQMeta.java    From Chronicle-Queue with Apache License 2.0 5 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wire) {
    wire
            .write(MetaDataField.roll).typedMarshallable(roll)
            .write(MetaDataField.deltaCheckpointInterval).int32(this.deltaCheckpointInterval)
            .write(MetaDataField.sourceId).int32(this.sourceId);
}
 
Example #11
Source File: CancelOrderRequest.java    From Chronicle-Queue-Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void writeMarshallable(WireOut out) {
    super.writeMarshallable(out);
    if (PREGENERATED_MARSHALLABLE) {
        out.write("clOrdID").object(String.class, clOrdID);
        out.write("symbol").writeLong(Base85LongConverter.INSTANCE, symbol);
    }
}
 
Example #12
Source File: OrderCancelReject.java    From Chronicle-Queue-Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void writeMarshallable(WireOut out) {
    super.writeMarshallable(out);
    if (PREGENERATED_MARSHALLABLE) {
        out.write("clOrdID").object(String.class, clOrdID);
        out.write("symbol").writeLong(Base85LongConverter.INSTANCE, symbol);
        out.write("reason").object(String.class, reason);
    }
}
 
Example #13
Source File: MethodTcpHandler.java    From Chronicle-Network with Apache License 2.0 5 votes vote down vote up
@Override
protected void onRead(@NotNull DocumentContext in, @NotNull WireOut out) {
    for (; ; ) {
        long pos = in.wire().bytes().readPosition();
        if (!reader.readOne())
            return;
        if (pos <= in.wire().bytes().readPosition()) {
            Jvm.warn().on(getClass(), "unable to parse data at the end of message " + in.wire().bytes().toDebugString());
            return;
        }
    }
}
 
Example #14
Source File: SessionDetails.java    From Chronicle-Network with Apache License 2.0 5 votes vote down vote up
@Override
default void writeMarshallable(@NotNull WireOut w) {
    w.writeEventName(EventId.userId).text(userId())
            .writeEventName(EventId.domain).text(domain())
            .writeEventName(EventId.sessionMode).text(sessionMode().toString())
            .writeEventName(EventId.securityToken).text(securityToken())
            .writeEventName(EventId.clientId).text(clientId().toString())
            .writeEventName(EventId.hostId).int8(hostId())
            .writeEventName(EventId.wireType).asEnum(wireType());
}
 
Example #15
Source File: ClientWiredExcerptAppenderStateless.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public WireOut wire() {
    return wire;
}
 
Example #16
Source File: ConstantSizeMarshaller.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    wireOut.write(() -> "constantSize").int64(constantSize);
}
 
Example #17
Source File: StatelessAppender.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public WireOut wire() {
    throw new UnsupportedOperationException();
}
 
Example #18
Source File: QueueTailerResponse.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(WireOut wire) {
    super.writeMarshallable(wire);
    wire.write(() -> "start").int64(start);
}
 
Example #19
Source File: QueueAppenderResponse.java    From Chronicle-Queue with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(WireOut wire) {
    wire.write(CoreFields.csp).text(csp);
    wire.write(CoreFields.cid).int32(cid);
}
 
Example #20
Source File: ByteArrayDataAccess.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    // no fields to write
}
 
Example #21
Source File: InstanceCreatingMarshaller.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    wireOut.write(() -> "tClass").typeLiteral(tClass);
}
 
Example #22
Source File: BytesAsSizedReader.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    wireOut.write(() -> "reader").typedMarshallable(reader);
}
 
Example #23
Source File: AbstractCharSequenceUtf8DataAccess.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    // no config fields to write
}
 
Example #24
Source File: IntegerDataAccess.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    // no config fields to write
}
 
Example #25
Source File: IntegerDataAccess_3_13.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    // no config fields to write
}
 
Example #26
Source File: EnumMarshallable.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
default void writeMarshallable(@NotNull WireOut wireOut) {
    // shouldn't read => shouldn't write fields
}
 
Example #27
Source File: DoubleDataAccess.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    // no config fields to write
}
 
Example #28
Source File: LongDataAccess.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    // no config fields to write
}
 
Example #29
Source File: ExternalizableDataAccess.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    wireOut.write(() -> "tClass").typeLiteral(tClass);
}
 
Example #30
Source File: SizedMarshallableDataAccess.java    From Chronicle-Map with Apache License 2.0 4 votes vote down vote up
@Override
public void writeMarshallable(@NotNull WireOut wireOut) {
    super.writeMarshallable(wireOut);
    wireOut.write(() -> "sizedReader").typedMarshallable(sizedReader);
    wireOut.write(() -> "sizedWriter").typedMarshallable(sizedWriter);
}