Copyright update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / connection / ConnectionAdapterImpl.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9
10 package org.opendaylight.openflowjava.protocol.impl.connection;
11
12 import io.netty.channel.Channel;
13 import io.netty.channel.ChannelFuture;
14 import io.netty.util.concurrent.GenericFutureListener;
15
16 import java.util.Collection;
17 import java.util.Collections;
18 import java.util.List;
19 import java.util.concurrent.Future;
20 import java.util.concurrent.TimeUnit;
21
22 import org.opendaylight.controller.sal.common.util.RpcErrors;
23 import org.opendaylight.controller.sal.common.util.Rpcs;
24 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInput;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigInput;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigOutput;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInput;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEvent;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
64 import org.opendaylight.yangtools.yang.binding.DataContainer;
65 import org.opendaylight.yangtools.yang.binding.DataObject;
66 import org.opendaylight.yangtools.yang.binding.Notification;
67 import org.opendaylight.yangtools.yang.common.RpcError;
68 import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
69 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
70 import org.opendaylight.yangtools.yang.common.RpcResult;
71 import org.slf4j.Logger;
72 import org.slf4j.LoggerFactory;
73
74 import com.google.common.cache.Cache;
75 import com.google.common.cache.CacheBuilder;
76 import com.google.common.cache.RemovalListener;
77 import com.google.common.cache.RemovalNotification;
78 import com.google.common.collect.Lists;
79 import com.google.common.util.concurrent.SettableFuture;
80
81 /**
82  * Handles messages (notifications + rpcs) and connections
83  * @author mirehak
84  * @author michal.polkorab
85  */
86 public class ConnectionAdapterImpl implements ConnectionFacade {
87
88     /** after this time, rpc future response objects will be thrown away (in minutes) */
89     public static final int RPC_RESPONSE_EXPIRATION = 1;
90
91     protected static final Logger LOG = LoggerFactory
92             .getLogger(ConnectionAdapterImpl.class);
93
94     private static final String APPLICATION_TAG = "OPENFLOW_LIBRARY";
95     private static final String TAG = "OPENFLOW";
96     private Channel channel;
97     private OpenflowProtocolListener messageListener;
98     /** expiring cache for future rpcResponses */
99     protected Cache<RpcResponseKey, SettableFuture<?>> responseCache;
100     private SystemNotificationsListener systemListener;
101     private boolean disconnectOccured = false;
102
103     protected ConnectionReadyListener connectionReadyListener;
104
105     /**
106      * default ctor
107      */
108     public ConnectionAdapterImpl() {
109         responseCache = CacheBuilder.newBuilder()
110                 .concurrencyLevel(1)
111                 .expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES)
112                 .removalListener(new ResponseRemovalListener()).build();
113         LOG.debug("ConnectionAdapter created");
114     }
115
116     /**
117      * @param channel the channel to be set - used for communication
118      */
119     public void setChannel(Channel channel) {
120         this.channel = channel;
121     }
122
123     @Override
124     public Future<RpcResult<BarrierOutput>> barrier(BarrierInput input) {
125         return sendToSwitchExpectRpcResultFuture(
126                 input, BarrierOutput.class, "barrier-input sending failed");
127     }
128
129     @Override
130     public Future<RpcResult<EchoOutput>> echo(EchoInput input) {
131         return sendToSwitchExpectRpcResultFuture(
132                 input, EchoOutput.class, "echo-input sending failed");
133     }
134
135     @Override
136     public Future<RpcResult<Void>> echoReply(EchoReplyInput input) {
137         return sendToSwitchFuture(input, "echo-reply sending failed");
138     }
139
140     @Override
141     public Future<RpcResult<Void>> experimenter(ExperimenterInput input) {
142         return sendToSwitchFuture(input, "experimenter sending failed");
143     }
144
145     @Override
146     public Future<RpcResult<Void>> flowMod(FlowModInput input) {
147         return sendToSwitchFuture(input, "flow-mod sending failed");
148     }
149
150     @Override
151     public Future<RpcResult<GetConfigOutput>> getConfig(GetConfigInput input) {
152         return sendToSwitchExpectRpcResultFuture(
153                 input, GetConfigOutput.class, "get-config-input sending failed");
154     }
155
156     @Override
157     public Future<RpcResult<GetFeaturesOutput>> getFeatures(
158             GetFeaturesInput input) {
159         return sendToSwitchExpectRpcResultFuture(
160                 input, GetFeaturesOutput.class, "get-features-input sending failed");
161     }
162
163     @Override
164     public Future<RpcResult<GetQueueConfigOutput>> getQueueConfig(
165             GetQueueConfigInput input) {
166         return sendToSwitchExpectRpcResultFuture(
167                 input, GetQueueConfigOutput.class, "get-queue-config-input sending failed");
168     }
169
170     @Override
171     public Future<RpcResult<Void>> groupMod(GroupModInput input) {
172         return sendToSwitchFuture(input, "group-mod-input sending failed");
173     }
174
175     @Override
176     public Future<RpcResult<Void>> hello(HelloInput input) {
177         return sendToSwitchFuture(input, "hello-input sending failed");
178     }
179
180     @Override
181     public Future<RpcResult<Void>> meterMod(MeterModInput input) {
182         return sendToSwitchFuture(input, "meter-mod-input sending failed");
183     }
184
185     @Override
186     public Future<RpcResult<Void>> packetOut(PacketOutInput input) {
187         return sendToSwitchFuture(input, "packet-out-input sending failed");
188     }
189
190     @Override
191     public Future<RpcResult<Void>> multipartRequest(MultipartRequestInput input) {
192         return sendToSwitchFuture(input, "multi-part-request sending failed");
193     }
194
195     @Override
196     public Future<RpcResult<Void>> portMod(PortModInput input) {
197         return sendToSwitchFuture(input, "port-mod-input sending failed");
198     }
199
200     @Override
201     public Future<RpcResult<RoleRequestOutput>> roleRequest(
202             RoleRequestInput input) {
203         return sendToSwitchExpectRpcResultFuture(
204                 input, RoleRequestOutput.class, "role-request-config-input sending failed");
205     }
206
207     @Override
208     public Future<RpcResult<Void>> setConfig(SetConfigInput input) {
209         return sendToSwitchFuture(input, "set-config-input sending failed");
210     }
211
212     @Override
213     public Future<RpcResult<Void>> tableMod(TableModInput input) {
214         return sendToSwitchFuture(input, "table-mod-input sending failed");
215     }
216
217     @Override
218     public Future<RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input) {
219         return sendToSwitchExpectRpcResultFuture(
220                 input, GetAsyncOutput.class, "get-async-input sending failed");
221     }
222
223     @Override
224     public Future<RpcResult<Void>> setAsync(SetAsyncInput input) {
225         return sendToSwitchFuture(input, "set-async-input sending failed");
226     }
227
228     @Override
229     public Future<Boolean> disconnect() {
230         ChannelFuture disconnectResult = channel.disconnect();
231         responseCache.invalidateAll();
232         disconnectOccured = true;
233
234         String failureInfo = "switch disconnecting failed";
235         ErrorSeverity errorSeverity = ErrorSeverity.ERROR;
236         String message = "Check the switch connection";
237         return handleTransportChannelFuture(disconnectResult, failureInfo, errorSeverity, message);
238     }
239
240     @Override
241     public boolean isAlive() {
242         return channel.isOpen();
243     }
244
245     @Override
246     public void setMessageListener(OpenflowProtocolListener messageListener) {
247         this.messageListener = messageListener;
248     }
249
250     @Override
251     public void consume(DataObject message) {
252         LOG.debug("ConsumeIntern msg");
253         if (disconnectOccured ) {
254             return;
255         }
256         if (message instanceof Notification) {
257             // System events
258             if (message instanceof DisconnectEvent) {
259                 systemListener.onDisconnectEvent((DisconnectEvent) message);
260                 responseCache.invalidateAll();
261                 disconnectOccured = true;
262             } else if (message instanceof SwitchIdleEvent) {
263                 systemListener.onSwitchIdleEvent((SwitchIdleEvent) message);
264             }
265             // OpenFlow messages
266               else if (message instanceof EchoRequestMessage) {
267                 messageListener.onEchoRequestMessage((EchoRequestMessage) message);
268             } else if (message instanceof ErrorMessage) {
269                 messageListener.onErrorMessage((ErrorMessage) message);
270             } else if (message instanceof ExperimenterMessage) {
271                 messageListener.onExperimenterMessage((ExperimenterMessage) message);
272             } else if (message instanceof FlowRemovedMessage) {
273                 messageListener.onFlowRemovedMessage((FlowRemovedMessage) message);
274             } else if (message instanceof HelloMessage) {
275                 LOG.info("Hello received / branch");
276                 messageListener.onHelloMessage((HelloMessage) message);
277             } else if (message instanceof MultipartReplyMessage) {
278                 messageListener.onMultipartReplyMessage((MultipartReplyMessage) message);
279             } else if (message instanceof PacketInMessage) {
280                 messageListener.onPacketInMessage((PacketInMessage) message);
281             } else if (message instanceof PortStatusMessage) {
282                 messageListener.onPortStatusMessage((PortStatusMessage) message);
283             } else {
284                 LOG.warn("message listening not supported for type: "+message.getClass());
285             }
286         } else {
287             if (message instanceof OfHeader) {
288                 LOG.debug("OFheader msg received");
289                 RpcResponseKey key = createRpcResponseKey((OfHeader) message);
290                 final SettableFuture<RpcResult<?>> rpcFuture = findRpcResponse(key);
291                 if (rpcFuture != null) {
292                     LOG.debug("corresponding rpcFuture found");
293                     List<RpcError> errors = Collections.emptyList();
294                     LOG.debug("before setting rpcFuture");
295                     rpcFuture.set(Rpcs.getRpcResult(true, message, errors));
296                     LOG.debug("after setting rpcFuture");
297                     responseCache.invalidate(key);
298                 } else {
299                     LOG.warn("received unexpected rpc response: "+key);
300                 }
301             } else {
302                 LOG.warn("message listening not supported for type: "+message.getClass());
303             }
304         }
305     }
306
307     /**
308      * sends given message to switch, sending result will be reported via return value
309      * @param input message to send
310      * @param failureInfo describes, what type of message caused failure by sending
311      * @return future object, <ul>
312      *  <li>if send successful, {@link RpcResult} without errors and successful
313      *  status will be returned, </li>
314      *  <li>else {@link RpcResult} will contain errors and failed status</li>
315      *  </ul>
316      */
317     private SettableFuture<RpcResult<Void>> sendToSwitchFuture(
318             DataObject input, final String failureInfo) {
319         LOG.debug("going to flush");
320         ChannelFuture resultFuture = channel.writeAndFlush(input);
321         LOG.debug("flushed");
322
323         ErrorSeverity errorSeverity = ErrorSeverity.ERROR;
324         String errorMessage = "check switch connection";
325         return handleRpcChannelFuture(resultFuture, failureInfo, errorSeverity, errorMessage);
326     }
327
328     /**
329      * sends given message to switch, sending result or switch response will be reported via return value
330      * @param input message to send
331      * @param responseClazz type of response
332      * @param failureInfo describes, what type of message caused failure by sending
333      * @return future object, <ul>
334      *  <li>if send fails, {@link RpcResult} will contain errors and failed status </li>
335      *  <li>else {@link RpcResult} will be stored in responseCache and wait for particular timeout
336      *  ({@link ConnectionAdapterImpl#RPC_RESPONSE_EXPIRATION}),
337      *  <ul><li>either switch will manage to answer
338      *  and then corresponding response message will be set into returned future</li>
339      *  <li>or response in cache will expire and returned future will be cancelled</li></ul>
340      *  </li>
341      *  </ul>
342      */
343     private <IN extends OfHeader, OUT extends OfHeader> SettableFuture<RpcResult<OUT>> sendToSwitchExpectRpcResultFuture(
344             IN input, Class<OUT> responseClazz, final String failureInfo) {
345         LOG.debug("going to flush");
346         SettableFuture<RpcResult<OUT>> rpcResult = SettableFuture.create();
347         RpcResponseKey key = new RpcResponseKey(input.getXid(), responseClazz.getName());
348         responseCache.put(key, rpcResult);
349         ChannelFuture resultFuture = channel.writeAndFlush(input);
350         LOG.debug("flushed");
351
352         ErrorSeverity errorSeverity = ErrorSeverity.ERROR;
353         String errorMessage = "check switch connection";
354
355         return handleRpcChannelFutureWithResponse(resultFuture, failureInfo, errorSeverity,
356                 errorMessage, input, responseClazz, rpcResult, key);
357     }
358
359     /**
360      * @param resultFuture
361      * @param failureInfo
362      * @return
363      */
364     private SettableFuture<RpcResult<Void>> handleRpcChannelFuture(
365             ChannelFuture resultFuture, final String failureInfo,
366             final ErrorSeverity errorSeverity, final String errorMessage) {
367
368         final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
369         LOG.debug("handlerpcchannelfuture");
370         resultFuture.addListener(new GenericFutureListener<io.netty.util.concurrent.Future<? super Void>>() {
371
372             @Override
373             public void operationComplete(
374                     io.netty.util.concurrent.Future<? super Void> future)
375                     throws Exception {
376                 LOG.debug("operation complete");
377                 Collection<RpcError> errors = Collections.emptyList();
378
379                 if (future.cause() != null) {
380                     LOG.debug("future.cause != null");
381                     RpcError rpcError = buildRpcError(failureInfo,
382                             errorSeverity, errorMessage, future.cause());
383                     errors = Lists.newArrayList(rpcError);
384                 }
385
386                 rpcResult.set(Rpcs.getRpcResult(
387                         future.isSuccess(),
388                         (Void) null,
389                         errors)
390                 );
391             }
392         });
393         return rpcResult;
394     }
395
396     /**
397      * @param resultFuture
398      * @param failureInfo
399      * @param errorSeverity
400      * @param errorMessage
401      * @param input
402      * @param responseClazz
403      * @param key of rpcResponse
404      * @return
405      */
406     private <IN extends OfHeader, OUT extends OfHeader> SettableFuture<RpcResult<OUT>> handleRpcChannelFutureWithResponse(
407             ChannelFuture resultFuture, final String failureInfo,
408             final ErrorSeverity errorSeverity, final String errorMessage,
409             final IN input, Class<OUT> responseClazz, final SettableFuture<RpcResult<OUT>> rpcResult, final RpcResponseKey key) {
410         LOG.debug("handleRpcchanfuture with response");
411
412         resultFuture.addListener(new GenericFutureListener<io.netty.util.concurrent.Future<? super Void>>() {
413
414             @Override
415             public void operationComplete(
416                     io.netty.util.concurrent.Future<? super Void> future)
417                     throws Exception {
418
419                 LOG.debug("operation complete");
420                 Collection<RpcError> errors = Collections.emptyList();
421                 if (future.cause() != null) {
422                     LOG.debug("ChannelFuture.cause != null");
423                     RpcError rpcError = buildRpcError(failureInfo,
424                             errorSeverity, errorMessage, future.cause());
425                     errors = Lists.newArrayList(rpcError);
426                     rpcResult.set(Rpcs.getRpcResult(
427                             future.isSuccess(),
428                             (OUT) null,
429                             errors)
430                             );
431                     responseCache.invalidate(key);
432                 } else {
433                     LOG.debug("ChannelFuture.cause == null");
434                     if (responseCache.getIfPresent(key) == null) {
435                         LOG.debug("responcache: key wasn't present");
436                     }
437                 }
438             }
439         });
440         return rpcResult;
441     }
442
443     /**
444      * @param resultFuture
445      * @param failureInfo
446      * @param errorSeverity
447      * @param message
448      * @return
449      */
450     private static SettableFuture<Boolean> handleTransportChannelFuture(
451             ChannelFuture resultFuture, final String failureInfo,
452             final ErrorSeverity errorSeverity, final String message) {
453
454         final SettableFuture<Boolean> transportResult = SettableFuture.create();
455
456         resultFuture.addListener(new GenericFutureListener<io.netty.util.concurrent.Future<? super Void>>() {
457
458             @Override
459             public void operationComplete(
460                     io.netty.util.concurrent.Future<? super Void> future)
461                     throws Exception {
462                 transportResult.set(future.isSuccess());
463                 if (!future.isSuccess()) {
464                     transportResult.setException(future.cause());
465                 }
466             }
467         });
468         return transportResult;
469     }
470
471     /**
472      * @param cause
473      * @return
474      */
475     protected RpcError buildRpcError(String info, ErrorSeverity severity, String message,
476             Throwable cause) {
477         RpcError error = RpcErrors.getRpcError(APPLICATION_TAG, TAG, info, severity, message,
478                 ErrorType.RPC, cause);
479         return error;
480     }
481
482     /**
483      * @param cause
484      * @return
485      */
486     protected RpcError buildTransportError(String info, ErrorSeverity severity, String message,
487             Throwable cause) {
488         RpcError error = RpcErrors.getRpcError(APPLICATION_TAG, TAG, info, severity, message,
489                 ErrorType.TRANSPORT, cause);
490         return error;
491     }
492
493     /**
494      * @param message
495      * @return
496      */
497     private static RpcResponseKey createRpcResponseKey(OfHeader message) {
498         return new RpcResponseKey(message.getXid(), message.getImplementedInterface().getName());
499     }
500
501     /**
502      * @return
503      */
504     @SuppressWarnings("unchecked")
505     private SettableFuture<RpcResult<?>> findRpcResponse(RpcResponseKey key) {
506         return (SettableFuture<RpcResult<?>>) responseCache.getIfPresent(key);
507     }
508
509     @Override
510     public void setSystemListener(SystemNotificationsListener systemListener) {
511         this.systemListener = systemListener;
512     }
513
514     @Override
515     public void checkListeners() {
516         StringBuffer buffer =  new StringBuffer();
517         if (systemListener == null) {
518             buffer.append("SystemListener ");
519         }
520         if (messageListener == null) {
521             buffer.append("MessageListener ");
522         }
523         if (connectionReadyListener == null) {
524             buffer.append("ConnectionReadyListener ");
525         }
526
527         if (buffer.length() > 0) {
528             throw new IllegalStateException("Missing listeners: " + buffer.toString());
529         }
530     }
531
532     static class ResponseRemovalListener implements RemovalListener<RpcResponseKey, SettableFuture<?>> {
533         @Override
534         public void onRemoval(
535                 RemovalNotification<RpcResponseKey, SettableFuture<?>> notification) {
536             SettableFuture<?> future = notification.getValue();
537             if (!future.isDone()) {
538                 LOG.warn("rpc response discarded: " + notification.getKey());
539                 future.cancel(true);
540             }
541         }
542     }
543
544     /**
545      * Class is used ONLY for exiting msgQueue processing thread
546      * @author michal.polkorab
547      */
548     static class ExitingDataObject implements DataObject {
549         @Override
550         public Class<? extends DataContainer> getImplementedInterface() {
551             return null;
552         }
553     }
554
555     @Override
556     public void fireConnectionReadyNotification() {
557         new Thread(new Runnable() {
558             @Override
559             public void run() {
560                 connectionReadyListener.onConnectionReady();
561             }
562         }).start();
563     }
564
565
566     @Override
567     public void setConnectionReadyListener(
568             ConnectionReadyListener connectionReadyListener) {
569         this.connectionReadyListener = connectionReadyListener;
570     }
571
572 }