Bug 3041 - Meter and Meter Config messages not sent when controller starts after...
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / ConnectionConductorImpl.java
1 /**
2  * Copyright (c) 2013-2014 Cisco Systems, Inc. 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 package org.opendaylight.openflowplugin.openflow.md.core;
10
11 import com.google.common.annotations.VisibleForTesting;
12 import com.google.common.util.concurrent.Futures;
13 import java.util.concurrent.Future;
14 import java.util.concurrent.LinkedBlockingQueue;
15 import java.util.concurrent.ThreadPoolExecutor;
16 import java.util.concurrent.TimeUnit;
17 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
18 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyListener;
19 import org.opendaylight.openflowplugin.api.OFConstants;
20 import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext;
21 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
22 import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
23 import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeListener;
24 import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeManager;
25 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
26 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationQueueWrapper;
27 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
28 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
29 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionManager;
30 import org.opendaylight.openflowplugin.api.openflow.md.queue.QueueKeeper;
31 import org.opendaylight.openflowplugin.api.openflow.md.queue.QueueKeeper.QueueType;
32 import org.opendaylight.openflowplugin.api.openflow.md.queue.QueueProcessor;
33 import org.opendaylight.openflowplugin.api.openflow.md.queue.WaterMarkListener;
34 import org.opendaylight.openflowplugin.api.openflow.md.queue.WaterMarkListenerImpl;
35 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
36 import org.opendaylight.openflowplugin.openflow.md.core.session.PortFeaturesUtil;
37 import org.opendaylight.openflowplugin.openflow.md.queue.QueueKeeperFactory;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInputBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoReplyInputBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessage;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OpenflowProtocolListener;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatus;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortDescCaseBuilder;
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.DataObject;
65 import org.opendaylight.yangtools.yang.common.RpcError;
66 import org.opendaylight.yangtools.yang.common.RpcResult;
67 import org.slf4j.Logger;
68 import org.slf4j.LoggerFactory;
69
70 /**
71  * @author mirehak
72  */
73 public class ConnectionConductorImpl implements OpenflowProtocolListener,
74         SystemNotificationsListener, ConnectionConductor,
75         ConnectionReadyListener, HandshakeListener, NotificationEnqueuer,
76         AutoCloseable {
77
78     /**
79      * ingress queue limit
80      */
81     private static final int INGRESS_QUEUE_MAX_SIZE = 200;
82
83     protected static final Logger LOG = LoggerFactory
84             .getLogger(ConnectionConductorImpl.class);
85
86     /*
87      * variable to make BitMap-based negotiation enabled / disabled. it will
88      * help while testing and isolating issues related to processing of BitMaps
89      * from switches.
90      */
91     private boolean isBitmapNegotiationEnable = true;
92     protected ErrorHandler errorHandler;
93
94     private final ConnectionAdapter connectionAdapter;
95     private ConnectionConductor.CONDUCTOR_STATE conductorState;
96     private Short version;
97
98     protected SwitchConnectionDistinguisher auxiliaryKey;
99
100     protected SessionContext sessionContext;
101
102     private QueueProcessor<OfHeader, DataObject> queueProcessor;
103     private QueueKeeper<OfHeader> queue;
104     private ThreadPoolExecutor hsPool;
105     private HandshakeManager handshakeManager;
106
107     private boolean firstHelloProcessed;
108
109     private PortFeaturesUtil portFeaturesUtils;
110
111     private int conductorId;
112
113     private int ingressMaxQueueSize;
114     private HandshakeContext handshakeContext;
115
116     /**
117      * @param connectionAdapter
118      */
119     public ConnectionConductorImpl(ConnectionAdapter connectionAdapter) {
120         this(connectionAdapter, INGRESS_QUEUE_MAX_SIZE);
121     }
122
123     /**
124      * @param connectionAdapter
125      * @param ingressMaxQueueSize
126      *            ingress queue limit (blocking)
127      */
128     public ConnectionConductorImpl(ConnectionAdapter connectionAdapter,
129             int ingressMaxQueueSize) {
130         this.connectionAdapter = connectionAdapter;
131         this.ingressMaxQueueSize = ingressMaxQueueSize;
132         conductorState = CONDUCTOR_STATE.HANDSHAKING;
133         firstHelloProcessed = false;
134         handshakeManager = new HandshakeManagerImpl(connectionAdapter,
135                 ConnectionConductor.versionOrder.get(0),
136                 ConnectionConductor.versionOrder);
137         handshakeManager.setUseVersionBitmap(isBitmapNegotiationEnable);
138         handshakeManager.setHandshakeListener(this);
139         portFeaturesUtils = PortFeaturesUtil.getInstance();
140     }
141
142     @Override
143     public void init() {
144         int handshakeThreadLimit = 1;
145         hsPool = new ThreadPoolLoggingExecutor(handshakeThreadLimit,
146                 handshakeThreadLimit, 0L, TimeUnit.MILLISECONDS,
147                 new LinkedBlockingQueue<Runnable>(), "OFHandshake-"
148                         + conductorId);
149
150         connectionAdapter.setMessageListener(this);
151         connectionAdapter.setSystemListener(this);
152         connectionAdapter.setConnectionReadyListener(this);
153         WaterMarkListener waterMarkListener = new WaterMarkListenerImpl(
154                 connectionAdapter);
155         queue = QueueKeeperFactory.createFairQueueKeeper(queueProcessor,
156                 ingressMaxQueueSize, waterMarkListener);
157     }
158
159     @Override
160     public void setQueueProcessor(
161             QueueProcessor<OfHeader, DataObject> queueProcessor) {
162         this.queueProcessor = queueProcessor;
163     }
164
165     /**
166      * @param errorHandler
167      *            the errorHandler to set
168      */
169     @Override
170     public void setErrorHandler(ErrorHandler errorHandler) {
171         this.errorHandler = errorHandler;
172         handshakeManager.setErrorHandler(errorHandler);
173     }
174
175     @Override
176     public void onEchoRequestMessage(final EchoRequestMessage echoRequestMessage) {
177         new Thread(new Runnable() {
178             @Override
179             public void run() {
180                 LOG.debug("echo request received: "
181                         + echoRequestMessage.getXid());
182                 EchoReplyInputBuilder builder = new EchoReplyInputBuilder();
183                 builder.setVersion(echoRequestMessage.getVersion());
184                 builder.setXid(echoRequestMessage.getXid());
185                 builder.setData(echoRequestMessage.getData());
186
187                 getConnectionAdapter().echoReply(builder.build());
188             }
189         }).start();
190     }
191
192     @Override
193     public void onErrorMessage(ErrorMessage errorMessage) {
194         enqueueMessage(errorMessage);
195     }
196
197     /**
198      * @param message
199      */
200     private void enqueueMessage(OfHeader message) {
201         enqueueMessage(message, QueueType.DEFAULT);
202     }
203
204     @Override
205     public void enqueueNotification(NotificationQueueWrapper notification) {
206         enqueueMessage(notification);
207     }
208
209     /**
210      * @param message
211      * @param queueType
212      *            enqueue type
213      */
214     private void enqueueMessage(OfHeader message, QueueType queueType) {
215         queue.push(message, this, queueType);
216     }
217
218     @Override
219     public void onExperimenterMessage(ExperimenterMessage experimenterMessage) {
220         enqueueMessage(experimenterMessage);
221     }
222
223     @Override
224     public void onFlowRemovedMessage(FlowRemovedMessage message) {
225         enqueueMessage(message);
226     }
227
228     /**
229      * version negotiation happened as per following steps: 1. If HelloMessage
230      * version field has same version, continue connection processing. If
231      * HelloMessage version is lower than supported versions, just disconnect.
232      * 2. If HelloMessage contains bitmap and common version found in bitmap
233      * then continue connection processing. if no common version found, just
234      * disconnect. 3. If HelloMessage version is not supported, send
235      * HelloMessage with lower supported version. 4. If Hello message received
236      * again with not supported version, just disconnect.
237      */
238     @Override
239     public void onHelloMessage(final HelloMessage hello) {
240         LOG.debug("processing HELLO.xid: {}", hello.getXid());
241         firstHelloProcessed = true;
242         checkState(CONDUCTOR_STATE.HANDSHAKING);
243         HandshakeStepWrapper handshakeStepWrapper = new HandshakeStepWrapper(
244                 hello, handshakeManager, connectionAdapter);
245         hsPool.submit(handshakeStepWrapper);
246     }
247
248     /**
249      * @return rpc-response timeout in [ms]
250      */
251     protected long getMaxTimeout() {
252         // TODO:: get from configuration
253         return 2000;
254     }
255
256     /**
257      * @return milliseconds
258      */
259     protected TimeUnit getMaxTimeoutUnit() {
260         // TODO:: get from configuration
261         return TimeUnit.MILLISECONDS;
262     }
263
264     @Override
265     public void onMultipartReplyMessage(MultipartReplyMessage message) {
266         enqueueMessage(message);
267     }
268
269     @Override
270     public void onPacketInMessage(PacketInMessage message) {
271         enqueueMessage(message, QueueKeeper.QueueType.UNORDERED);
272     }
273
274     @Override
275     public void onPortStatusMessage(PortStatusMessage message) {
276         processPortStatusMsg(message);
277         enqueueMessage(message);
278     }
279
280     protected void processPortStatusMsg(PortStatus msg) {
281         if (msg.getReason().getIntValue() == 2) {
282             updatePort(msg);
283         } else if (msg.getReason().getIntValue() == 0) {
284             updatePort(msg);
285         } else if (msg.getReason().getIntValue() == 1) {
286             deletePort(msg);
287         }
288     }
289
290     protected void updatePort(PortStatus msg) {
291         Long portNumber = msg.getPortNo();
292         Boolean portBandwidth = portFeaturesUtils.getPortBandwidth(msg);
293
294         if (portBandwidth == null) {
295             LOG.debug(
296                     "can't get bandwidth info from port: {}, aborting port update",
297                     msg.toString());
298         } else {
299             this.getSessionContext().getPhysicalPorts().put(portNumber, msg);
300             this.getSessionContext().getPortsBandwidth()
301                     .put(portNumber, portBandwidth);
302         }
303     }
304
305     protected void deletePort(PortGrouping port) {
306         Long portNumber = port.getPortNo();
307
308         this.getSessionContext().getPhysicalPorts().remove(portNumber);
309         this.getSessionContext().getPortsBandwidth().remove(portNumber);
310     }
311
312     @Override
313     public void onSwitchIdleEvent(SwitchIdleEvent notification) {
314         new Thread(new Runnable() {
315             @Override
316             public void run() {
317                 if (!CONDUCTOR_STATE.WORKING.equals(getConductorState())) {
318                     // idle state in any other conductorState than WORKING means
319                     // real
320                     // problem and wont be handled by echoReply, but
321                     // disconnection
322                     disconnect();
323                     OFSessionUtil.getSessionManager().invalidateOnDisconnect(
324                             ConnectionConductorImpl.this);
325                 } else {
326                     LOG.debug(
327                             "first idle state occured, sessionCtx={}|auxId={}",
328                             sessionContext, auxiliaryKey);
329                     EchoInputBuilder builder = new EchoInputBuilder();
330                     builder.setVersion(getVersion());
331                     builder.setXid(getSessionContext().getNextXid());
332
333                     Future<RpcResult<EchoOutput>> echoReplyFuture = getConnectionAdapter()
334                             .echo(builder.build());
335
336                     try {
337                         RpcResult<EchoOutput> echoReplyValue = echoReplyFuture
338                                 .get(getMaxTimeout(), getMaxTimeoutUnit());
339                         if (echoReplyValue.isSuccessful()) {
340                             setConductorState(CONDUCTOR_STATE.WORKING);
341                         } else {
342                             for (RpcError replyError : echoReplyValue
343                                     .getErrors()) {
344                                 Throwable cause = replyError.getCause();
345                                 LOG.error(
346                                         "while receiving echoReply in TIMEOUTING state: "
347                                                 + cause.getMessage(), cause);
348                             }
349                             // switch issue occurred
350                             throw new Exception("switch issue occurred");
351                         }
352                     } catch (Exception e) {
353                         LOG.error("while waiting for echoReply in TIMEOUTING state: "
354                                 + e.getMessage());
355                         errorHandler.handleException(e, sessionContext);
356                         // switch is not responding
357                         disconnect();
358                         OFSessionUtil.getSessionManager()
359                                 .invalidateOnDisconnect(
360                                         ConnectionConductorImpl.this);
361                     }
362                 }
363             }
364
365         }).start();
366     }
367
368     /**
369      * @param conductorState
370      *            the connectionState to set
371      */
372     @Override
373     public void setConductorState(CONDUCTOR_STATE conductorState) {
374         this.conductorState = conductorState;
375     }
376
377     @Override
378     public CONDUCTOR_STATE getConductorState() {
379         return conductorState;
380     }
381
382     /**
383      * @param expectedState
384      */
385     protected void checkState(CONDUCTOR_STATE expectedState) {
386         if (!conductorState.equals(expectedState)) {
387             throw new IllegalStateException("Expected state: " + expectedState
388                     + ", actual state:" + conductorState);
389         }
390     }
391
392     @Override
393     public void onDisconnectEvent(DisconnectEvent arg0) {
394         SessionManager sessionManager = OFSessionUtil.getSessionManager();
395         sessionManager.invalidateOnDisconnect(this);
396         close();
397     }
398
399     @Override
400     public Short getVersion() {
401         return version;
402     }
403
404     @Override
405     public Future<Boolean> disconnect() {
406         LOG.trace("disconnecting: sessionCtx={}|auxId={}", sessionContext,
407                 auxiliaryKey);
408
409         Future<Boolean> result = null;
410         if (connectionAdapter.isAlive()) {
411             result = connectionAdapter.disconnect();
412         } else {
413             LOG.debug("connection already disconnected");
414             result = Futures.immediateFuture(true);
415         }
416         close();
417         return result;
418     }
419
420     @Override
421     public void setConnectionCookie(SwitchConnectionDistinguisher auxiliaryKey) {
422         this.auxiliaryKey = auxiliaryKey;
423     }
424
425     @Override
426     public void setSessionContext(SessionContext sessionContext) {
427         this.sessionContext = sessionContext;
428     }
429
430     @Override
431     public SwitchConnectionDistinguisher getAuxiliaryKey() {
432         return auxiliaryKey;
433     }
434
435     @Override
436     public SessionContext getSessionContext() {
437         return sessionContext;
438     }
439
440     @Override
441     public ConnectionAdapter getConnectionAdapter() {
442         return connectionAdapter;
443     }
444
445     @Override
446     public void onConnectionReady() {
447         LOG.debug("connection is ready-to-use");
448         if (!firstHelloProcessed) {
449             checkState(CONDUCTOR_STATE.HANDSHAKING);
450             HandshakeStepWrapper handshakeStepWrapper = new HandshakeStepWrapper(
451                     null, handshakeManager, connectionAdapter);
452             hsPool.execute(handshakeStepWrapper);
453             firstHelloProcessed = true;
454         } else {
455             LOG.debug("already touched by hello message");
456         }
457     }
458
459     @Override
460     public void onHandshakeSuccessfull(GetFeaturesOutput featureOutput,
461                                        Short negotiatedVersion) {
462         postHandshakeBasic(featureOutput, negotiatedVersion);
463
464         // post-handshake actions
465         if (version == OFConstants.OFP_VERSION_1_3) {
466             requestPorts();
467         }
468
469         requestDesc();
470     }
471
472     @Override
473     public void onHandshakeFailure() {
474         LOG.info("OF handshake failed, doing cleanup.");
475         close();
476     }
477
478     /**
479      * used by tests
480      *
481      * @param featureOutput
482      * @param negotiatedVersion
483      */
484     protected void postHandshakeBasic(GetFeaturesOutput featureOutput,
485             Short negotiatedVersion) {
486         version = negotiatedVersion;
487         if (version == OFConstants.OFP_VERSION_1_0) {
488             // Because the GetFeaturesOutput contains information about the port
489             // in OF1.0 (that we would otherwise get from the PortDesc) we have
490             // to pass
491             // it up for parsing to convert into a NodeConnectorUpdate
492             //
493             // BUG-1988 - this must be the first item in queue in order not to
494             // get behind link-up message
495             enqueueMessage(featureOutput);
496         }
497
498         OFSessionUtil.registerSession(this, featureOutput, negotiatedVersion);
499         hsPool.shutdown();
500         hsPool.purge();
501         conductorState = CONDUCTOR_STATE.WORKING;
502         QueueKeeperFactory.plugQueue(queueProcessor, queue);
503     }
504
505     /*
506      * Send an OFPMP_DESC request message to the switch
507      */
508     private void requestDesc() {
509         MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
510         builder.setType(MultipartType.OFPMPDESC);
511         builder.setVersion(getVersion());
512         builder.setFlags(new MultipartRequestFlags(false));
513         builder.setMultipartRequestBody(new MultipartRequestDescCaseBuilder()
514                 .build());
515         builder.setXid(getSessionContext().getNextXid());
516         getConnectionAdapter().multipartRequest(builder.build());
517     }
518
519     private void requestPorts() {
520         MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
521         builder.setType(MultipartType.OFPMPPORTDESC);
522         builder.setVersion(getVersion());
523         builder.setFlags(new MultipartRequestFlags(false));
524         builder.setMultipartRequestBody(new MultipartRequestPortDescCaseBuilder()
525                 .build());
526         builder.setXid(getSessionContext().getNextXid());
527         getConnectionAdapter().multipartRequest(builder.build());
528     }
529
530     private void requestGroupFeatures() {
531         MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
532         mprInput.setType(MultipartType.OFPMPGROUPFEATURES);
533         mprInput.setVersion(getVersion());
534         mprInput.setFlags(new MultipartRequestFlags(false));
535         mprInput.setXid(getSessionContext().getNextXid());
536
537         MultipartRequestGroupFeaturesCaseBuilder mprGroupFeaturesBuild = new MultipartRequestGroupFeaturesCaseBuilder();
538         mprInput.setMultipartRequestBody(mprGroupFeaturesBuild.build());
539
540         LOG.debug("Send group features statistics request :{}",
541                 mprGroupFeaturesBuild);
542         getConnectionAdapter().multipartRequest(mprInput.build());
543
544     }
545
546     private void requestMeterFeatures() {
547         MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
548         mprInput.setType(MultipartType.OFPMPMETERFEATURES);
549         mprInput.setVersion(getVersion());
550         mprInput.setFlags(new MultipartRequestFlags(false));
551         mprInput.setXid(getSessionContext().getNextXid());
552
553         MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild = new MultipartRequestMeterFeaturesCaseBuilder();
554         mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
555
556         LOG.debug("Send meter features statistics request :{}",
557                 mprMeterFeaturesBuild);
558         getConnectionAdapter().multipartRequest(mprInput.build());
559
560     }
561
562     /**
563      * @param isBitmapNegotiationEnable
564      *            the isBitmapNegotiationEnable to set
565      */
566     public void setBitmapNegotiationEnable(boolean isBitmapNegotiationEnable) {
567         this.isBitmapNegotiationEnable = isBitmapNegotiationEnable;
568     }
569
570     @Override
571     public void setId(int conductorId) {
572         this.conductorId = conductorId;
573     }
574
575     @Override
576     public void close() {
577         conductorState = CONDUCTOR_STATE.RIP;
578         try {
579             handshakeContext.close();
580         } catch (Exception e) {
581             LOG.warn("Closing handshake context failed: {}", e.getMessage());
582             LOG.debug("Detail in hanshake context close:", e);
583         }
584     }
585
586     @Override
587     public void setHandshakeContext(HandshakeContext handshakeContext) {
588         this.handshakeContext = handshakeContext;
589     }
590
591     @VisibleForTesting
592     ThreadPoolExecutor getHsPool() {
593         return hsPool;
594     }
595 }