public ProxyConnection(FabricConnection connection, FabricProtocol protocol) { super(connection); this.connection = connection; this.protocol = protocol; this.rpcConfig = protocol.getConfig(); }
@Override public FabricCommandRunner getCommandRunner(String address, int port) { Preconditions.checkNotNull(factory, "You must register your protocol before you attempt to send a message."); return factory.getCommandRunner(address, port); }
void registerProtocol(FabricProtocol protocol){ Preconditions.checkArgument(protocols[protocol.getProtocolId()] == null, "Protocols already registered at logical id " + protocol.getProtocolId()); protocols[protocol.getProtocolId()] = protocol; sync.incrementAndGet(); }
@Test(expected=ChannelClosedException.class) public void failureOnDisconnection() throws Exception { FabricRunnerFactory factory = getFabric().registerProtocol(new Protocol(null)); FabricCommandRunner runner = factory.getCommandRunner(getFabric().getAddress(), getFabric().getPort()); SimpleMessage m = new SimpleMessage(2); runner.runCommand(m); m.getFuture().checkedGet(1000, TimeUnit.MILLISECONDS); }
public void cancelFragment(RpcOutcomeListener<Ack> outcomeListener, FragmentHandle handle){ final SignalFragment b = new SignalFragment(outcomeListener, handle, RpcType.REQ_CANCEL_FRAGMENTS); manager.runCommand(b); }
protected abstract Response handle(PhysicalConnection connection, int rpcType, ByteString pBody, ByteBuf dBody) throws RpcException;
public void sendFragments(RpcOutcomeListener<Ack> outcomeListener, InitializeFragments fragments){ SendFragment b = new SendFragment(outcomeListener, fragments); manager.runCommand(b); }
@Override public SendEndpoint<REQUEST, RESPONSE> getEndpoint(String address, int port) { return new RequestSender(factory.getCommandRunner(address, port)); }
public void sendFragmentStatus(RpcOutcomeListener<Ack> outcomeListener, FragmentStatus status){ SendFragmentStatus b = new SendFragmentStatus(outcomeListener, status); manager.runCommand(b); }
public CoordToExecTunnel getTunnel(NodeEndpoint ep){ return new CoordToExecTunnel(ep, factory.getCommandRunner(ep.getAddress(), ep.getFabricPort())); } }
public void sendStreamComplete(RpcOutcomeListener<Ack> outcomeListener, FragmentStreamComplete streamComplete) { manager.runCommand(new SendStreamCompleteListen(outcomeListener, streamComplete)); }
public CoordTunnel getTunnel(NodeEndpoint ep){ return new CoordTunnel(ep, factory.getCommandRunner(ep.getAddress(), ep.getFabricPort())); } }
public void sendRecordBatch(RpcOutcomeListener<Ack> outcomeListener, FragmentWritableBatch batch) { manager.runCommand(new SendBatchAsyncListen(outcomeListener, batch)); }
public ExecTunnel getTunnel(NodeEndpoint endpoint) { return new ExecTunnel(factory.getCommandRunner(endpoint.getAddress(), endpoint.getFabricPort())); } }
public void sendData(RpcOutcomeListener<Ack> outcomeListener, QueryWritableBatch data) { manager.runCommand(new SendBatch(outcomeListener, data)); }
public RpcFuture<Ack> requestCancelQuery(ExternalId queryId, String reason){ CancelQuery c = new CancelQuery(queryId, reason); manager.runCommand(c); return c.getFuture(); }
public RpcFuture<QueryProfile> requestQueryProfile(ExternalId queryId) { RequestProfile b = new RequestProfile(queryId); manager.runCommand(b); return b.getFuture(); } }
public RpcFuture<Ack> sendFragmentStatus(FragmentStatus status){ SendFragmentStatusFuture b = new SendFragmentStatusFuture(status); manager.runCommand(b); return b.getFuture(); }
public RpcFuture<Ack> sendNodeQueryStatus(NodeQueryStatus status){ SendNodeQueryStatusFuture b = new SendNodeQueryStatusFuture(status); manager.runCommand(b); return b.getFuture(); }
public void sendOOBMessage(RpcOutcomeListener<Ack> outcomeListener, OutOfBandMessage message) { manager.runCommand(new SendOOBMessage(outcomeListener, message.toProtoMessage())); }