4040import com .datastax .oss .driver .internal .core .protocol .FrameDecoder ;
4141import com .datastax .oss .driver .internal .core .protocol .FrameEncoder ;
4242import com .datastax .oss .driver .internal .core .protocol .FrameToSegmentEncoder ;
43- import com .datastax .oss .driver .internal .core .protocol .ProtocolFeatureManager ;
44- import com .datastax .oss .driver .internal .core .protocol .ProtocolFeatureParser ;
4543import com .datastax .oss .driver .internal .core .protocol .ProtocolFeatureStore ;
4644import com .datastax .oss .driver .internal .core .protocol .SegmentToBytesEncoder ;
4745import com .datastax .oss .driver .internal .core .protocol .SegmentToFrameDecoder ;
7169import java .util .List ;
7270import java .util .Map ;
7371import java .util .Objects ;
74- import java .util .Optional ;
7572import net .jcip .annotations .NotThreadSafe ;
7673import org .slf4j .Logger ;
7774import org .slf4j .LoggerFactory ;
@@ -97,7 +94,6 @@ class ProtocolInitHandler extends ConnectInitHandler {
9794 private String logPrefix ;
9895 private ChannelHandlerContext ctx ;
9996 private final boolean querySupportedOptions ;
100- private ProtocolFeatureManager protocolFeatureManager ;
10197 private ProtocolFeatureStore featureStore ;
10298
10399 /**
@@ -196,12 +192,6 @@ Message getRequest() {
196192 if (featureStore != null ) {
197193 featureStore .populateStartupOptions (startupOptions );
198194 }
199- Optional .ofNullable (protocolFeatureManager )
200- .ifPresent (m -> m .optionallyAddLwtInfoOption (startupOptions ));
201- Optional .ofNullable (protocolFeatureManager )
202- .ifPresent (m -> m .optionallyAddTabletInfoOption (startupOptions ));
203- Optional .ofNullable (protocolFeatureManager )
204- .ifPresent (m -> m .optionallyAddMetadataIdOption (startupOptions ));
205195 return request = new Startup (startupOptions );
206196 case GET_CLUSTER_NAME :
207197 return request = CLUSTER_NAME_QUERY ;
@@ -231,18 +221,11 @@ void onResponse(Message response) {
231221 ProtocolUtils .opcodeString (response .opcode ));
232222 try {
233223 if (step == Step .OPTIONS && response instanceof Supported ) {
234- channel .attr (DriverChannel .OPTIONS_KEY ).set (((Supported ) response ).options );
235- Supported res = (Supported ) response ;
236- featureStore = ProtocolFeatureStore .parseSupportedOptions (res .options );
237- featureStore .storeInChannel (channel );
238224 Supported supported = (Supported ) response ;
239- ProtocolFeatureParser featureParser =
240- ProtocolFeatureParser .Builder .fromOptions (supported ).build ();
241- protocolFeatureManager = featureParser .parse ();
242- protocolFeatureManager .updateOptionsAttributeForChannel (channel );
243- protocolFeatureManager .updateShardingInfoAttributeForChannel (channel );
244- protocolFeatureManager .updateLwtInfoAttributeForChannel (channel );
245- maybeUpdatePipelineWithProtocolOptions (protocolFeatureManager .isMetadataIdEnabled ());
225+ channel .attr (DriverChannel .OPTIONS_KEY ).set (supported .options );
226+ featureStore = ProtocolFeatureStore .parseSupportedOptions (supported .options );
227+ featureStore .storeInChannel (channel );
228+ maybeUpdatePipelineWithProtocolOptions (featureStore .isMetadataIdEnabled ());
246229 step = Step .STARTUP ;
247230 send ();
248231 } else if (step == Step .STARTUP && response instanceof Ready ) {
@@ -457,21 +440,21 @@ private void maybeUpdatePipelineWithProtocolOptions(boolean metadataIdEnabled) {
457440 ProtocolFeatures protocolFeatures = new ProtocolFeatures ();
458441 protocolFeatures .addFeature (ProtocolFeatures .Feature .SCYLLA_USE_METADATA_ID );
459442 int maxFrameLength =
460- (int )
461- context
462- .getConfig ()
463- .getDefaultProfile ()
464- .getBytes (DefaultDriverOption .PROTOCOL_MAX_FRAME_LENGTH );
443+ (int )
444+ context
445+ .getConfig ()
446+ .getDefaultProfile ()
447+ .getBytes (DefaultDriverOption .PROTOCOL_MAX_FRAME_LENGTH );
465448
466449 ChannelPipeline pipeline = ctx .pipeline ();
467450 pipeline .replace (
468- ChannelFactory .FRAME_TO_BYTES_ENCODER_NAME ,
469- ChannelFactory .FRAME_TO_BYTES_ENCODER_NAME ,
470- new FrameEncoder (context .getFrameCodec (), protocolFeatures , maxFrameLength ));
451+ ChannelFactory .FRAME_TO_BYTES_ENCODER_NAME ,
452+ ChannelFactory .FRAME_TO_BYTES_ENCODER_NAME ,
453+ new FrameEncoder (context .getFrameCodec (), protocolFeatures , maxFrameLength ));
471454 pipeline .replace (
472- ChannelFactory .BYTES_TO_FRAME_DECODER_NAME ,
473- ChannelFactory .BYTES_TO_FRAME_DECODER_NAME ,
474- new FrameDecoder (context .getFrameCodec (), protocolFeatures , maxFrameLength ));
455+ ChannelFactory .BYTES_TO_FRAME_DECODER_NAME ,
456+ ChannelFactory .BYTES_TO_FRAME_DECODER_NAME ,
457+ new FrameDecoder (context .getFrameCodec (), protocolFeatures , maxFrameLength ));
475458 }
476459 }
477460
0 commit comments