Package com.taobao.gecko.core.command

Examples of com.taobao.gecko.core.command.ResponseCommand


        final String group = jettyRequest.getParameter("group");
        final long offset = Long.parseLong(jettyRequest.getParameter("offset"));

        try {
            final OffsetCommand offsetCommand = this.convert2OffsetCommand(topic, partition, group, offset);
            final ResponseCommand responseCommand = this.commandProcessor.processOffsetCommand(offsetCommand, null);
            response.setStatus(((BooleanCommand) responseCommand).getCode());
            response.getWriter().write(((BooleanCommand) responseCommand).getErrorMsg());
        }
        catch (final Throwable e) {
            logger.error("Could not get message from position " + offset, e);
View Full Code Here


        final long offset = Long.parseLong(jettyRequest.getParameter("offset"));
        final int maxSize = Integer.parseInt(jettyRequest.getParameter("maxsize"));

        try {
            final GetCommand getCommand = this.convert2GetCommand(topic, partition, group, offset, maxSize);
            final ResponseCommand responseCommand = this.commandProcessor.processGetCommand(getCommand, null, false);
            if (responseCommand instanceof DataCommand) {
                response.setStatus(HttpStatus.Success);
                response.getOutputStream().write(((DataCommand) responseCommand).getData());
            }
            else {
View Full Code Here

                        int partition = 0;
                        SyncCommand command =
                                new SyncCommand(testTopic, partition, encodePayload, flag,
                                    SamsaCommandProcessor.this.idWorker.nextId(), CheckSum.crc32(encodePayload),
                                    OpaqueGenerator.getNextOpaque());
                        ResponseCommand resp =
                                SamsaCommandProcessor.this.remotingClient.invokeToGroup(
                                    SamsaCommandProcessor.this.slaveUrl, command,
                                    SamsaCommandProcessor.this.sendToSlaveTimeoutInMills, TimeUnit.MILLISECONDS);
                        // Slave was back.
                        if (resp.getResponseStatus() == ResponseStatus.NO_ERROR) {
                            slaveOk = true;
                        }
                        else {
                            // Wait some time to re-check it.
                            Thread.sleep(SamsaCommandProcessor.this.checkSlaveIntervalInMills);
View Full Code Here

    }


    @Override
    public void handleRequest(final OffsetCommand request, final Connection conn) {
        final ResponseCommand response =
                this.processor
                    .processOffsetCommand(request, SessionContextHolder.getOrCreateSessionContext(conn, null));
        if (response != null) {
            RemotingUtils.response(conn, response);
        }
View Full Code Here

    }


    @Override
    public void handleRequest(final GetCommand request, final Connection conn) {
        final ResponseCommand response =
                this.processor.processGetCommand(request, SessionContextHolder.getOrCreateSessionContext(conn, null));
        if (response != null) {
            RemotingUtils.response(conn, response);
        }
    }
View Full Code Here

    }


    @Override
    public void handleRequest(final HeartBeatRequestCommand request, final Connection conn) {
        final ResponseCommand response =
                this.processor.processVesionCommand((VersionCommand) request,
                    SessionContextHolder.getOrCreateSessionContext(conn, null));
        if (response != null) {
            RemotingUtils.response(conn, response);
        }
View Full Code Here

    }


    @Override
    public void handleRequest(final StatsCommand request, final Connection conn) {
        final ResponseCommand response =
                this.processor.processStatCommand(request, SessionContextHolder.getOrCreateSessionContext(conn, null));
        if (response != null) {
            RemotingUtils.response(conn, response);
        }
    }
View Full Code Here


    @Override
    public ResponseCommand invokeToGroup(final String group, final RequestCommand command, final long time,
            final TimeUnit timeUnit) throws InterruptedException, TimeoutException, NotifyRemotingException {
        ResponseCommand resp = this.remotingClient.invokeToGroup(group, command, time, timeUnit);
        if (resp.getResponseStatus() == ResponseStatus.ERROR_COMM) {
            BooleanCommand booleanCommand = (BooleanCommand) resp;
            // It's ugly,but it work right now.
            if (booleanCommand.getErrorMsg().contains("�޿�������")) {
                // try to connect it.
                this.connectWithRef(group, this);
View Full Code Here

            final GetCommand getCmd =
                    new GetCommand(fetchRequest.getTopic(), this.consumerConfig.getGroup(),
                        fetchRequest.getPartition(), currentOffset, fetchRequest.getMaxSize(),
                        OpaqueGenerator.getNextOpaque());
            final ResponseCommand response = this.remotingClient.invokeToGroup(serverUrl, getCmd, timeout, timeUnit);
            if (response instanceof DataCommand) {
                final DataCommand dataCmd = (DataCommand) response;
                final byte[] data = dataCmd.getData();
                // ��ȡ���������ز����ʱ������maxSize
                if (data.length < fetchRequest.getMaxSize() / 2) {
View Full Code Here

TOP

Related Classes of com.taobao.gecko.core.command.ResponseCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.