Java Code Examples for org.apache.thrift.protocol.TMessageType#ONEWAY

The following examples show how to use org.apache.thrift.protocol.TMessageType#ONEWAY . 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: TypedParser.java    From armeria with Apache License 2.0 6 votes vote down vote up
@Override
void writeValue(JsonGenerator jw, Byte val) throws IOException {
    final String serialized;
    switch (val.byteValue()) {
    case TMessageType.CALL:
        serialized = "CALL";
        break;
    case TMessageType.REPLY:
        serialized = "REPLY";
        break;
    case TMessageType.EXCEPTION:
        serialized = "EXCEPTION";
        break;
    case TMessageType.ONEWAY:
        serialized = "ONEWAY";
        break;
    default:
        throw new IllegalArgumentException("Unsupported message type: " + val);
    }
    jw.writeString(serialized);
}
 
Example 2
Source File: THttpService.java    From armeria with Apache License 2.0 5 votes vote down vote up
private static String typeString(byte typeValue) {
    switch (typeValue) {
        case TMessageType.CALL:
            return "CALL";
        case TMessageType.REPLY:
            return "REPLY";
        case TMessageType.EXCEPTION:
            return "EXCEPTION";
        case TMessageType.ONEWAY:
            return "ONEWAY";
        default:
            return "UNKNOWN(" + (typeValue & 0xFF) + ')';
    }
}
 
Example 3
Source File: ThriftCall.java    From armeria with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance that contains a Thrift {@link TMessageType#CALL} or {@link TMessageType#ONEWAY}
 * message.
 */
public ThriftCall(TMessage header, TBase<?, ?> args) {
    super(header);
    if (header.type != TMessageType.CALL && header.type != TMessageType.ONEWAY) {
        throw new IllegalArgumentException(
                "header.type: " + typeStr(header.type) + " (expected: CALL or ONEWAY)");
    }

    this.args = requireNonNull(args, "args");
}
 
Example 4
Source File: ThriftMessage.java    From armeria with Apache License 2.0 5 votes vote down vote up
static String typeStr(byte type) {
    switch (type) {
        case TMessageType.CALL:
            return "CALL";
        case TMessageType.ONEWAY:
            return "ONEWAY";
        case TMessageType.REPLY:
            return "REPLY";
        case TMessageType.EXCEPTION:
            return "EXCEPTION";
        default:
            return "UNKNOWN(" + (type & 0xFF) + ')';
    }
}
 
Example 5
Source File: TypedParser.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Override
Byte readFromString(String s) {
    switch (s) {
    case "CALL":
        return TMessageType.CALL;
    case "REPLY":
        return TMessageType.REPLY;
    case "EXCEPTION":
        return TMessageType.EXCEPTION;
    case "ONEWAY":
        return TMessageType.ONEWAY;
    default:
        throw new IllegalArgumentException("Unsupported message type: " + s);
    }
}
 
Example 6
Source File: ThriftFunction.java    From armeria with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the type of this function.
 *
 * @return {@link TMessageType#CALL} or {@link TMessageType#ONEWAY}
 */
public byte messageType() {
    return isOneWay() ? TMessageType.ONEWAY : TMessageType.CALL;
}