/** * Requires the {@link CloudPool} to be in a started (and configured) state, * or else throws an {@link InternalServerErrorException} which breaks the * request processing and responds with a * {@code 500 (Internal Server Error)} response. */ private void requireStartedCloudPool() { CloudPoolStatus cloudPoolStatus = this.cloudPool.getStatus(); if (!cloudPoolStatus.isStarted()) { String errorMessage = "attempt to invoke cloudpool before being started"; LOG.warn(errorMessage); ErrorType error = new ErrorType(errorMessage); throw new InternalServerErrorException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(error).build()); } }