Package org.apache.thrift

Examples of org.apache.thrift.TApplicationException


                    try {
                        long timeRemaining = 0;
                        if (taskTimeoutMillis > 0) {
                            long timeElapsed = System.currentTimeMillis() - message.getProcessStartTimeMillis();
                            if (timeElapsed >= taskTimeoutMillis) {
                                TApplicationException taskTimeoutException = new TApplicationException(
                                        TApplicationException.INTERNAL_ERROR,
                                        "Task stayed on the queue for " + timeElapsed +
                                        " milliseconds, exceeding configured task timeout of " + taskTimeoutMillis +
                                        " milliseconds.");
                                sendTApplicationException(taskTimeoutException, ctx, message, messageTransport,
                                        inProtocol, outProtocol);
                                return;
                            } else {
                                timeRemaining = taskTimeoutMillis - timeElapsed;
                            }
                        }

                        if (timeRemaining > 0) {
                            taskTimeoutTimer.newTimeout(new TimerTask() {
                                @Override
                                public void run(Timeout timeout) throws Exception {
                                    // The immediateFuture returned by processors isn't cancellable, cancel() and
                                    // isCanceled() always return false. Use a flag to detect task expiration.
                                    if(responseSent.compareAndSet(false, true)) {
                                        TApplicationException ex = new TApplicationException(
                                                TApplicationException.INTERNAL_ERROR,
                                                "Task timed out while executing."
                                        );
                                        // Create a temporary transport to send the exception
                                        ChannelBuffer duplicateBuffer = message.getBuffer().duplicate();
View Full Code Here


            ThriftMethodHandler methodHandler = methods.get(method);

            try {
                if (methodHandler == null) {
                    throw new TApplicationException(UNKNOWN_METHOD, "Unknown method : '" + method + "'");
                }

                if (channel.hasError()) {
                    throw new TTransportException(channel.getError());
                }
View Full Code Here

      scheduler.notifyScheduler();
      sessionNotifier.deleteSession(handle);

    } catch (RuntimeException e) {
      LOG.error("Error in sessionEnd of " + handle, e);
      throw new TApplicationException(e.getMessage());
    }
  }
View Full Code Here

      LOG.info("sessionUpdateInfo called for session: " + handle +
               " with info: " + info);
      sessionManager.heartbeat(handle);
      sessionManager.updateInfo(handle, info);
    } catch (RuntimeException e) {
      throw new TApplicationException(e.getMessage());
    }
  }
View Full Code Here

      InvalidSessionHandle, SafeModeException {
    checkSafeMode("sessionHeartbeat");
    try {
      sessionManager.heartbeat(handle);
    } catch (RuntimeException e) {
      throw new TApplicationException(e.getMessage());
    }
  }
View Full Code Here

      if (!session.checkHeartbeatInfo(jtInfo)) {
        sessionEnd(session.getSessionId(), SessionStatus.FAILED_JOBTRACKER);
      }
      sessionManager.heartbeatV2(handle, jtInfo);
    } catch (RuntimeException e) {
      throw new TApplicationException(e.getMessage());
    }
  }
View Full Code Here

    try {
      LOG.info ("Request " + requestList.size() +
          " resources from session: " + handle);
      if (!checkResourceRequestType(requestList)) {
        LOG.error ("Bad resource type from session: " + handle);
        throw new TApplicationException("Bad resource type");
      }
      if (!checkResourceRequestExcluded(requestList)) {
        LOG.error("Bad excluded hosts from session: " + handle);
        throw new TApplicationException("Requesting excluded hosts");
      }
      checkResourceRequestLimit(requestList, handle);

      sessionManager.heartbeat(handle);
      sessionManager.getSession(handle).setResourceRequest(requestList);
      List<ResourceRequestInfo> reqInfoList =
          new ArrayList<ResourceRequestInfo>(requestList.size());
      for (ResourceRequest request : requestList) {
        List<String> hosts = request.getHosts();
        List<RequestedNode> requestedNodes = null;
        if (hosts != null && hosts.size() > 0) {
          requestedNodes = new ArrayList<RequestedNode>(hosts.size());
          for (String host : hosts) {
            requestedNodes.add(nodeManager.resolve(host, request.type));
          }
        }
        ResourceRequestInfo info =
          new ResourceRequestInfo(request, requestedNodes);
        reqInfoList.add(info);
      }
      sessionManager.requestResource(handle, reqInfoList);
      for (ResourceRequest req : requestList) {
        metrics.requestResource(req.type);
      }
      scheduler.notifyScheduler();
    } catch (RuntimeException e) {
      e.printStackTrace();
      throw new TApplicationException(e.getMessage());
    }
  }
View Full Code Here

        metrics.releaseResource(grant.type);
      }

      scheduler.notifyScheduler();
    } catch (RuntimeException e) {
      throw new TApplicationException(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.thrift.TApplicationException

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.