@Override public CodecType getCodec() { CodecType result; try { result = CodecType.valueOf(codec); } catch (Exception e) { return CodecType.Avro; } return result; }
@Override public AbstractNettyCodec call(CodecType codec) { Map<Byte, AbstractNettyCodec> map = new HashMap<>(); map.put(CodecType.Avro.getVersion(), new EurekaCodecWrapper(new EurekaAvroCodec(REGISTRATION_PROTOCOL_MODEL_SET, INTEREST_AVRO_SCHEMA, new SchemaReflectData(INTEREST_AVRO_SCHEMA)))); map.put(CodecType.Json.getVersion(), new EurekaCodecWrapper(new EurekaJsonCodec(REGISTRATION_PROTOCOL_MODEL_SET))); return new DynamicNettyCodec(INTEREST_PROTOCOL_MODEL_SET, Collections.unmodifiableMap(map), codec.getVersion()); } };
this.heartbeatIntervalMs = heartbeatIntervalMs; this.connectionAutoTimeoutMs = connectionAutoTimeoutMs; this.codec = codec == null ? this.codec : codec.name(); this.evictionTimeoutMs = evictionTimeoutMs; this.evictionStrategyType = evictionStrategyType == null ? this.evictionStrategyType : evictionStrategyType.name();
@Override public AbstractNettyCodec call(CodecType codec) { Map<Byte, AbstractNettyCodec> map = new HashMap<>(); map.put(CodecType.Avro.getVersion(), new EurekaCodecWrapper(new EurekaAvroCodec(REGISTRATION_PROTOCOL_MODEL_SET, REGISTRATION_AVRO_SCHEMA, new SchemaReflectData(REGISTRATION_AVRO_SCHEMA)))); map.put(CodecType.Json.getVersion(), new EurekaCodecWrapper(new EurekaJsonCodec(REGISTRATION_PROTOCOL_MODEL_SET))); return new DynamicNettyCodec(REGISTRATION_PROTOCOL_MODEL_SET, Collections.unmodifiableMap(map), codec.getVersion()); } };
public static void main(String[] args) throws IOException { CodecType codec = null; switch (args.length) { case 0: codec = CodecType.Avro; break; case 2: if ("-c".equals(args[0])) { codec = CodecType.valueOf(args[1]); break; } default: System.err.println("ERROR: invalid command line parameters; expected none or '-c <codec_name>"); System.exit(-1); } EurekaTransportConfig transportConfig = new BasicEurekaTransportConfig.Builder().withCodec(codec).build(); new EurekaCLI(transportConfig).readExecutePrintLoop(); }
@Override public AbstractNettyCodec call(CodecType codec) { Map<Byte, AbstractNettyCodec> map = new HashMap<>(); map.put(CodecType.Avro.getVersion(), new EurekaCodecWrapper(new EurekaAvroCodec(REGISTRATION_PROTOCOL_MODEL_SET, REPLICATION_AVRO_SCHEMA, new SchemaReflectData(REPLICATION_AVRO_SCHEMA)))); map.put(CodecType.Json.getVersion(), new EurekaCodecWrapper(new EurekaJsonCodec(REGISTRATION_PROTOCOL_MODEL_SET))); return new DynamicNettyCodec(REPLICATION_PROTOCOL_MODEL_SET, Collections.unmodifiableMap(map), codec.getVersion()); } };