Package com.google.dataconnector.protocol

Examples of com.google.dataconnector.protocol.FramingException


        if (outputQueueMap.containsKey(socketDataInfo.getConnectionId())) {
          outputQueueMap.get(connectionId).put(socketDataInfo);
        }
      // Unknown states.
      } else {
        throw new FramingException("Unknown State: " + socketDataInfo.getState() +
            " received while dispatching");
      }
    } catch (InvalidProtocolBufferException e) {
      throw new FramingException(e);
    } catch (IOException e) {
      // TODO(rayc) Later on do something more intelligent such as reject this request not kill
      // the tunnel.
      throw new FramingException(e);
    } catch (InterruptedException e) {
      throw new FramingException(e);
    } catch (RejectedExecutionException e){
      LOG.warn("Out of threads, waiting for some to free up.  Total active " +
          threadPoolExecutor.getActiveCount() + " queue Map entries" + outputQueueMap.size());
      throw new FramingException("Out of threads!");
    }
  }
View Full Code Here


    try {
      HealthCheckInfo.parseFrom(frameInfo.getPayload());
      // Assignment is thread safe.
      lastHealthCheckReceivedStamp = clock.currentTimeMillis();
    } catch (InvalidProtocolBufferException e) {
      throw new FramingException(e);
    }
  }
View Full Code Here

      processRegistrationResponse(frameInfo);
    } catch (RegistrationException e) {
      // this re-throws a registration exception - but caller of this method catches it and
      // throws it as ConnectionException - which is what RegistrationException is.
      // TODO(mtp): fix this convoluted exception chaining.
      throw new FramingException(e);
    }
  }
View Full Code Here

        sendToCloud(reply);
        this.sessionManager.notifySent(reply.getSocketHandle(), reply);
      } catch (InvalidProtocolBufferException e2) {
        LOG.warn("Unknown message type: " + frameInfo.getType() +
            ":" + frameInfo);
          throw new FramingException("Unknown message type: " + frameInfo.getType() +
              ":" + frameInfo);
      }
    }
  }
View Full Code Here

        public FetchRequest parse(ByteString s) throws InvalidProtocolBufferException {
          return FetchRequest.parseFrom(s);
        }
      });
    } catch (InvalidProtocolBufferException e) {
      throw new FramingException(e);
    }

    if (request == null) {
      return;
    }
    // Now we have the request.  Check the request:
    FetchReply.Builder replyBuilder = FetchReply.newBuilder().setId(request.getId());
    try {
      validate(request);
    } catch (IllegalArgumentException e) {
      logExceptionInReply(request, replyBuilder, e);
      sendReply(replyBuilder.setStatus(StatusCode.BAD_REQUEST.value).build());
      LOG.warn(request.getId() + ": Bad request: " + request, e);
      throw new FramingException(e);
    } catch (MalformedURLException e) {
      logExceptionInReply(request, replyBuilder, e);
      sendReply(replyBuilder.setStatus(StatusCode.BAD_REQUEST.value).build());
      LOG.warn("Bad request: " + request, e);
      throw new FramingException(e);
    }

    // Now execute work asynchronously.
    try {
      StrategyType strategyType = StrategyType.match(request.getStrategy());
      Strategy strategy = injector.getInstance(strategyType.strategyClz);
      ResourceFetcher fetcher = new ResourceFetcher(request, strategy);
      threadPoolExecutor.submit(fetcher);
    } catch (Exception e) {
      LOG.warn(request.getId() + ": Agent error: " + request, e);
      throw new FramingException(e);
    }
  }
View Full Code Here

    throws FramingException, InvalidProtocolBufferException {
    Preconditions.checkNotNull(frameInfo);
    String message = "";
    if (!frameInfo.hasPayload()) {
      message = ("No payload in received FrameInfo: " + frameInfo);
      throw new FramingException(message);
    }
    if (!frameInfo.hasSessionId()) {
      message = "Session id missing in fetch protocol.";
      throw new FramingException(message);
    }

    if (!frameInfo.getSessionId().equals(getSessionId())) {
      LOG.warn("Mismatched session id.");
      return null;
View Full Code Here

TOP

Related Classes of com.google.dataconnector.protocol.FramingException

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.