public void returnResponse(int code, String remark) { final RemotingCommand response = RemotingCommand.createResponseCommand(code, remark); response.setOpaque(request.getOpaque()); this.channel.writeAndFlush(response); } }
public void returnResponse(int code, String remark) { final RemotingCommand response = RemotingCommand.createResponseCommand(code, remark); response.setOpaque(request.getOpaque()); this.channel.writeAndFlush(response); } }
@Override public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof RequestTask)) return false; final RequestTask that = (RequestTask) o; if (getCreateTimestamp() != that.getCreateTimestamp()) return false; if (isStopRun() != that.isStopRun()) return false; if (channel != null ? !channel.equals(that.channel) : that.channel != null) return false; return request != null ? request.getOpaque() == that.request.getOpaque() : that.request == null; }
@Override public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof RequestTask)) return false; final RequestTask that = (RequestTask) o; if (getCreateTimestamp() != that.getCreateTimestamp()) return false; if (isStopRun() != that.isStopRun()) return false; if (channel != null ? !channel.equals(that.channel) : that.channel != null) return false; return request != null ? request.getOpaque() == that.request.getOpaque() : that.request == null; }
@Override public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof RequestTask)) return false; final RequestTask that = (RequestTask) o; if (getCreateTimestamp() != that.getCreateTimestamp()) return false; if (isStopRun() != that.isStopRun()) return false; if (channel != null ? !channel.equals(that.channel) : that.channel != null) return false; return request != null ? request.getOpaque() == that.request.getOpaque() : that.request == null; }
public void returnResponse(int code, String remark) { final RemotingCommand response = RemotingCommand.createResponseCommand(code, remark); response.setOpaque(request.getOpaque()); this.channel.writeAndFlush(response); } }
@Override public void run() { try { final RemotingCommand response = PullMessageProcessor.this.processRequest(channel, request, false); if (response != null) { response.setOpaque(request.getOpaque()); response.markResponseType(); try { channel.writeAndFlush(response).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { log.error("processRequestWrapper response to " + future.channel().remoteAddress() + " failed", future.cause()); log.error(request.toString()); log.error(response.toString()); } } }); } catch (Throwable e) { log.error("processRequestWrapper process request over, but response failed", e); log.error(request.toString()); log.error(response.toString()); } } } catch (RemotingCommandException e1) { log.error("excuteRequestWhenWakeup run", e1); } } };
response.setOpaque(request.getOpaque()); response.markResponseType(); try {
headerBuffer.putInt(cmd.getOpaque());
headerBuffer.putInt(cmd.getOpaque());
public void invokeAsyncImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis, final InvokeCallback invokeCallback) throws InterruptedException, RemotingTooMuchRequestException, RemotingTimeoutException, RemotingSendRequestException { final int opaque = request.getOpaque(); boolean acquired = this.semaphoreAsync.tryAcquire(timeoutMillis, TimeUnit.MILLISECONDS); if (acquired) {
public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) { final int opaque = cmd.getOpaque(); final ResponseFuture responseFuture = responseTable.get(opaque); if (responseFuture != null) {
public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) { final int opaque = cmd.getOpaque(); final ResponseFuture responseFuture = responseTable.get(opaque); if (responseFuture != null) {
public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) { final int opaque = cmd.getOpaque(); final ResponseFuture responseFuture = responseTable.get(opaque); if (responseFuture != null) {
public RemotingCommand invokeSyncImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis) throws InterruptedException, RemotingSendRequestException, RemotingTimeoutException { final int opaque = request.getOpaque();
public RemotingCommand invokeSyncImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis) throws InterruptedException, RemotingSendRequestException, RemotingTimeoutException { final int opaque = request.getOpaque();
response.setOpaque(request.getOpaque());
response.setOpaque(request.getOpaque());
public RemotingCommand invokeSyncImpl(final Channel channel, final RemotingCommand request, final long timeoutMillis) throws InterruptedException, RemotingSendRequestException, RemotingTimeoutException { final int opaque = request.getOpaque();
private RemotingCommand updateAndCreateTopic(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(null); final CreateTopicRequestHeader requestHeader = (CreateTopicRequestHeader) request.decodeCommandCustomHeader(CreateTopicRequestHeader.class); log.info("updateAndCreateTopic called by {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel())); if (requestHeader.getTopic().equals(this.brokerController.getBrokerConfig().getBrokerClusterName())) { String errorMsg = "the topic[" + requestHeader.getTopic() + "] is conflict with system reserved words."; log.warn(errorMsg); response.setCode(ResponseCode.SYSTEM_ERROR); response.setRemark(errorMsg); return response; } try { response.setCode(ResponseCode.SUCCESS); response.setOpaque(request.getOpaque()); response.markResponseType(); response.setRemark(null); ctx.writeAndFlush(response); } catch (Exception e) { } TopicConfig topicConfig = new TopicConfig(requestHeader.getTopic()); topicConfig.setReadQueueNums(requestHeader.getReadQueueNums()); topicConfig.setWriteQueueNums(requestHeader.getWriteQueueNums()); topicConfig.setTopicFilterType(requestHeader.getTopicFilterTypeEnum()); topicConfig.setPerm(requestHeader.getPerm()); topicConfig.setTopicSysFlag(requestHeader.getTopicSysFlag() == null ? 0 : requestHeader.getTopicSysFlag()); this.brokerController.getTopicConfigManager().updateTopicConfig(topicConfig); this.brokerController.registerBrokerAll(false, true); return null; }