@Override public void run() { connectionReadyListener.onConnectionReady(); } }).start();
@Override public void close() { handler.onConnectionQueueChanged(null); }
@Override public void onHighWaterMark() { connectionAdapter.setAutoRead(false); LOG.debug("AutoRead is set on false: {}", connectionAdapter.getRemoteAddress()); }
@Override public Future<RpcResult<GetFeaturesOutput>> getFeatures(GetFeaturesInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).getFeatures(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
/** * Initiate Nio event loop groups * @param threadConfiguration number of threads to be created, if not specified in threadConfig */ public void initiateNioEventLoopGroups(ThreadConfiguration threadConfiguration) { socketChannelClass = NioServerSocketChannel.class; if (threadConfiguration != null) { bossGroup = new NioEventLoopGroup(threadConfiguration.getBossThreadCount()); workerGroup = new NioEventLoopGroup(threadConfiguration.getWorkerThreadCount()); } else { bossGroup = new NioEventLoopGroup(); workerGroup = new NioEventLoopGroup(); } ((NioEventLoopGroup)workerGroup).setIoRatio(100); }
@Override public Future<RpcResult<BarrierOutput>> barrier(BarrierInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).barrier(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<RoleRequestOutput>> roleRequest(RoleRequestInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).roleRequest(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<Void>> experimenter(ExperimenterInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).experimenter(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<Void>> packetOut(PacketOutInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).packetOut(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<GetQueueConfigOutput>> getQueueConfig(GetQueueConfigInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).getQueueConfig(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<java.lang.Void>> multipartRequest(MultipartRequestInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).multipartRequest(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<Void>> setConfig(SetConfigInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).setConfig(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).getAsync(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<Void>> setAsync(SetAsyncInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).setAsync(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<GetConfigOutput>> getConfig(GetConfigInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).getConfig(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } }
@Override public Future<RpcResult<Void>> tableMod(TableModInput input, SwitchConnectionDistinguisher cookie) { try { return getConnectionAdapter(cookie).tableMod(input); } catch (ConnectionException e) { return RpcResultUtil.getRpcErrorFuture(e); } } }
/** * Initiate Nio event loop groups * @param threadConfiguration number of threads to be created, if not specified in threadConfig */ public void initiateNioEventLoopGroups(ThreadConfiguration threadConfiguration) { datagramChannelClass = NioDatagramChannel.class; if (threadConfiguration != null) { group = new NioEventLoopGroup(threadConfiguration.getWorkerThreadCount()); } else { group = new NioEventLoopGroup(); } }
@Override public void run() { if (connectionAdapter.isAlive()) { handshakeManager.shake(helloMessage); } else { LOG.debug("connection is down - skipping handshake step"); } }
@Override public void onLowWaterMark() { connectionAdapter.setAutoRead(true); LOG.debug("AutoRead is set on true: {}", connectionAdapter.getRemoteAddress()); } }
public void sendGetFeaturesToSwitch(final Short proposedVersion, final Long xid, final ConnectionAdapter connectionAdapter) { GetFeaturesInputBuilder featuresBuilder = new GetFeaturesInputBuilder(); featuresBuilder.setVersion(proposedVersion).setXid(xid); Future<RpcResult<GetFeaturesOutput>> featuresFuture = connectionAdapter.getFeatures(featuresBuilder.build()); collectGetFeaturesOuput(featuresFuture, connectionAdapter); }