/** * Used to determine if the exception is thrown due to a transient failure * and the operation is expected to succeed upon retrying. * * @param throwableException the exception that is thrown * @return true - if the exception is a transient failure * false - if the exception is non-transient */ private boolean isTransientException(Throwable throwableException) { if (throwableException != null) { return !((throwableException instanceof UnsupportedOperationException) || (throwableException instanceof ApplicationException && ((ApplicationException) throwableException).getCode() != ApplicationException.Code.BACKEND_ERROR)); } return true; }
private TaskDef notFoundSafeGetTaskDef(String name) { try { return metadataService.getTaskDef(name); } catch (ApplicationException e) { if (e.getCode() == ApplicationException.Code.NOT_FOUND) { return null; } else { throw e; } } }
@Override public List<EventHandler> getEventHandlersForEvent(String event, boolean activeOnly) { String key = nsKey(EVENT_HANDLERS_BY_EVENT, event); Set<String> names = dynoClient.smembers(key); List<EventHandler> handlers = new LinkedList<>(); for(String name : names) { try { EventHandler eventHandler = getEventHandler(name); recordRedisDaoEventRequests("getEventHandler", event); if(eventHandler.getEvent().equals(event) && (!activeOnly || eventHandler.isActive())) { handlers.add(eventHandler); } } catch (ApplicationException ae) { if(ae.getCode() == Code.NOT_FOUND) {} throw ae; } } return handlers; }
if(e.getCode().equals(Code.NOT_FOUND)) { logger.error("Workflow NOT found for id: " + workflowId, e); queueDAO.remove(WorkflowExecutor.DECIDER_QUEUE, workflowId);
if(e.getCode().equals(Code.NOT_FOUND)) { logger.error("Workflow ID specified is not valid for this environment: " + e.getMessage()); queue.ack(Arrays.asList(msg));
@Override public void startWorkflow(StartWorkflowRequestPb.StartWorkflowRequest pbRequest, StreamObserver<WorkflowServicePb.StartWorkflowResponse> response) { // TODO: better handling of optional 'version' final StartWorkflowRequest request = PROTO_MAPPER.fromProto(pbRequest); try { String id = workflowService.startWorkflow(pbRequest.getName(), GRPC_HELPER.optional(request.getVersion()),request.getCorrelationId(), request.getInput(), request.getExternalInputPayloadStoragePath(), request.getTaskToDomain(), request.getWorkflowDef()); response.onNext(WorkflowServicePb.StartWorkflowResponse.newBuilder() .setWorkflowId(id) .build() ); response.onCompleted(); } catch (ApplicationException ae) { if (ae.getCode().equals(ApplicationException.Code.NOT_FOUND)) { response.onError(Status.NOT_FOUND .withDescription("No such workflow found by name="+request.getName()) .asRuntimeException() ); } else { GRPC_HELPER.onError(response, ae); } } }
/** * Used to determine if the exception is thrown due to a transient failure * and the operation is expected to succeed upon retrying. * * @param throwableException the exception that is thrown * @return true - if the exception is a transient failure * false - if the exception is non-transient */ private boolean isTransientException(Throwable throwableException) { if (throwableException != null) { return !((throwableException instanceof UnsupportedOperationException) || (throwableException instanceof ApplicationException && ((ApplicationException) throwableException).getCode() != ApplicationException.Code.BACKEND_ERROR)); } return true; }
@Override public List<EventHandler> getEventHandlersForEvent(String event, boolean activeOnly) { String key = nsKey(EVENT_HANDLERS_BY_EVENT, event); Set<String> names = dynoClient.smembers(key); List<EventHandler> handlers = new LinkedList<>(); for(String name : names) { try { EventHandler eventHandler = getEventHandler(name); recordRedisDaoEventRequests("getEventHandler", event); if(eventHandler.getEvent().equals(event) && (!activeOnly || eventHandler.isActive())) { handlers.add(eventHandler); } } catch (ApplicationException ae) { if(ae.getCode() == Code.NOT_FOUND) {} throw ae; } } return handlers; }
if(e.getCode().equals(Code.NOT_FOUND)) { logger.error("Workflow NOT found for id: " + workflowId, e); queueDAO.remove(WorkflowExecutor.DECIDER_QUEUE, workflowId);
if(e.getCode().equals(Code.NOT_FOUND)) { logger.error("Workflow ID specified is not valid for this environment: " + e.getMessage()); queue.ack(Arrays.asList(msg));