Package org.jredis.protocol

Examples of org.jredis.protocol.Response


          Protocol protocol = Assert.notNull (newProtocolHandler(), "the delegate protocol handler", ClientRuntimeException.class);
         
      Log.log("Pipeline <%s> thread for <%s> started.", Thread.currentThread().getName(), PipelineConnectionBase.this.toString());
          PendingRequest pending = null;
          while(work_flag.get()){
            Response response = null;
        try {
                  pending = pendingResponseQueue.take();
          try {
            response = protocol.createResponse(pending.cmd);
            response.read(getInputStream());
            pending.response = response;
            pending.completion.signal();
            if(response.getStatus().isError()) {
              Log.error ("(Asynch) Error response for " + pending.cmd.code + " => " + response.getStatus().message());
            }

          }
         
          // this exception handling as of now is basically broken and fairly useless
View Full Code Here


      //
      Future<Response> pendingResponse = queueRequest(cmd, args);
     
      // wait for response
      //
      Response response;
        try {
          // This will block.
          response = pendingResponse.get();
        }
        catch (InterruptedException e) {
          e.printStackTrace();
          throw new ClientRuntimeException("on pendingResponse.get()", e);
        }
        catch (ExecutionException e) {
          if(e.getCause() instanceof RedisException) {
            throw (RedisException) e.getCause();
          }
          else {
            e.printStackTrace();
            throw new ProviderException("on pendingResponse.get()", e);
          }
        }
     
        // check response status
        //
    ResponseStatus status = Assert.notNull (response.getStatus(), "status from response object", ProviderException.class);
    if(status.isError()) {
      Log.error ("Error response for " + cmd.code + " => " + status.message());
      throw new RedisException(cmd, status.message());
    }
    /* this is handled by the super class */
 
View Full Code Here

  /* (non-Javadoc)
   * @see org.jredis.connector.Protocol#createResponse(org.jredis.Command)
   */
  public Response createResponse(Command cmd) throws ProviderException, ClientRuntimeException {

    Response response = null;
    switch (cmd.responseType){
      case BOOLEAN:
        response = createBooleanResponse(cmd);
        break;
      case BULK:
View Full Code Here

   */
  public JRedis sync () {
    return new JRedisSupport() {
      @Override
            protected Response serviceRequest (Command cmd, byte[]... args) throws RedisException, ClientRuntimeException, ProviderException {
        Response response = null;
        try {
                  response = JRedisPipeline.this.queueRequest(cmd, args).get();
                }
                catch (InterruptedException e) {
                  throw new ClientRuntimeException("Interrupted!", e);
View Full Code Here

   */
  public JRedis sync (final long timeout, final TimeUnit unit) {
    return new JRedisSupport() {
      @Override
            protected Response serviceRequest (Command cmd, byte[]... args) throws RedisException, ClientRuntimeException, ProviderException {
        Response response = null;
        try {
                  response = JRedisPipeline.this.queueRequest(cmd, args).get(timeout, unit);
                }
                catch (InterruptedException e) {
                  throw new ClientRuntimeException("Interrupted!", e);
View Full Code Here

TOP

Related Classes of org.jredis.protocol.Response

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.