javax.ws.rs.container.Suspended Java Examples
The following examples show how to use
javax.ws.rs.container.Suspended.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StoragePoolDefinitions.java From linstor-server with GNU General Public License v3.0 | 6 votes |
@PUT @Path("{storagePool}") public void modifyStoragePoolDefinition( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("storagePool") String storagePoolName, String jsonData ) throws IOException { JsonGenTypes.StoragePoolDefinitionModify data = objectMapper .readValue(jsonData, JsonGenTypes.StoragePoolDefinitionModify.class); Flux<ApiCallRc> flux = ctrlApiCallHandler.modifyStorPoolDfn( null, storagePoolName, data.override_props, new HashSet<>(data.delete_props), new HashSet<>(data.delete_namespaces) ) .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_STOR_POOL_DFN, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK)); }
Example #2
Source File: ProxyResource.java From presto with Apache License 2.0 | 6 votes |
@DELETE @Path("/v1/proxy") @Produces(APPLICATION_JSON) public void cancelQuery( @QueryParam("uri") String uri, @QueryParam("hmac") String hash, @Context HttpServletRequest servletRequest, @Suspended AsyncResponse asyncResponse) { if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) { throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI"); } Request.Builder request = prepareDelete().setUri(URI.create(uri)); performRequest(servletRequest, asyncResponse, request, response -> responseWithHeaders(noContent(), response)); }
Example #3
Source File: ProxyResource.java From presto with Apache License 2.0 | 6 votes |
@GET @Path("/v1/proxy") @Produces(APPLICATION_JSON) public void getNext( @QueryParam("uri") String uri, @QueryParam("hmac") String hash, @Context HttpServletRequest servletRequest, @Context UriInfo uriInfo, @Suspended AsyncResponse asyncResponse) { if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) { throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI"); } Request.Builder request = prepareGet().setUri(URI.create(uri)); performRequest(servletRequest, asyncResponse, request, response -> buildResponse(uriInfo, response)); }
Example #4
Source File: ExecutingStatementResource.java From presto with Apache License 2.0 | 6 votes |
@ResourceSecurity(PUBLIC) @GET @Path("{queryId}/{slug}/{token}") @Produces(MediaType.APPLICATION_JSON) public void getQueryResults( @PathParam("queryId") QueryId queryId, @PathParam("slug") String slug, @PathParam("token") long token, @QueryParam("maxWait") Duration maxWait, @QueryParam("targetResultSize") DataSize targetResultSize, @Context UriInfo uriInfo, @Suspended AsyncResponse asyncResponse) { Query query = getQuery(queryId, slug, token); asyncQueryResults(query, token, maxWait, targetResultSize, uriInfo, asyncResponse); }
Example #5
Source File: TestResource.java From Sentinel with Apache License 2.0 | 6 votes |
@Path("/async-hello") @GET @Produces({ MediaType.APPLICATION_JSON }) public void asyncSayHello(@Suspended final AsyncResponse asyncResponse) { executor.submit(new Runnable() { @Override public void run() { try { TimeUnit.MILLISECONDS.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } asyncResponse.resume("Hello!"); } }); }
Example #6
Source File: QueryExecutorBean.java From datawave with Apache License 2.0 | 6 votes |
@POST @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff"}) @Path("/{logicName}/async/create") @GZIP @GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/") @EnrichQueryMetrics(methodType = MethodType.CREATE) @Interceptors({RequiredInterceptor.class, ResponseInterceptor.class}) @Asynchronous @Timed(name = "dw.query.createQueryAsync", absolute = true) public void createQueryAsync(@Required("logicName") @PathParam("logicName") String queryLogicName, MultivaluedMap<String,String> queryParameters, @Suspended AsyncResponse asyncResponse) { try { GenericResponse<String> response = createQuery(queryLogicName, queryParameters); asyncResponse.resume(response); } catch (Throwable t) { asyncResponse.resume(t); } }
Example #7
Source File: QueryExecutorBean.java From datawave with Apache License 2.0 | 6 votes |
@POST @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff"}) @Path("/{logicName}/async/createAndNext") @GZIP @GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/") @EnrichQueryMetrics(methodType = MethodType.CREATE_AND_NEXT) @Interceptors({ResponseInterceptor.class, RequiredInterceptor.class}) @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Asynchronous @Timed(name = "dw.query.createAndNextAsync", absolute = true) public void createQueryAndNextAsync(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters, @Suspended AsyncResponse asyncResponse) { try { BaseQueryResponse response = createQueryAndNext(logicName, queryParameters); asyncResponse.resume(response); } catch (Throwable t) { asyncResponse.resume(t); } }
Example #8
Source File: QueryExecutorBean.java From datawave with Apache License 2.0 | 6 votes |
@GET @Path("/{id}/async/next") @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff"}) @GZIP @EnrichQueryMetrics(methodType = MethodType.NEXT) @Interceptors({ResponseInterceptor.class, RequiredInterceptor.class}) @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Asynchronous @Timed(name = "dw.query.nextAsync", absolute = true) public void nextAsync(@Required("id") @PathParam("id") String id, @Suspended AsyncResponse asyncResponse) { try { BaseQueryResponse response = next(id); asyncResponse.resume(response); } catch (Throwable t) { asyncResponse.resume(t); } }
Example #9
Source File: QueryExecutorBean.java From datawave with Apache License 2.0 | 6 votes |
@POST @Produces("*/*") @Path("/{logicName}/async/execute") @GZIP @Interceptors({ResponseInterceptor.class, RequiredInterceptor.class}) @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @Asynchronous @Timed(name = "dw.query.executeQueryAsync", absolute = true) public void executeAsync(@PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters, @Context HttpHeaders httpHeaders, @Suspended AsyncResponse asyncResponse) { try { StreamingOutput output = execute(logicName, queryParameters, httpHeaders); asyncResponse.resume(output); } catch (Throwable t) { asyncResponse.resume(t); } }
Example #10
Source File: OrderService.java From qcon-microservices with Apache License 2.0 | 6 votes |
/** * Perform a "Long-Poll" styled get. This method will attempt to get the value for the passed key * blocking until the key is available or passed timeout is reached. Non-blocking IO is used to * implement this, but the API will block the calling thread if no data is available * * @param id - the key of the value to retrieve * @param timeout - the timeout for the long-poll * @param asyncResponse - async response used to trigger the poll early should the appropriate * value become available */ @GET @ManagedAsync @Path("/orders/{id}") @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN}) public void getWithTimeout(@PathParam("id") final String id, @QueryParam("timeout") @DefaultValue(CALL_TIMEOUT) Long timeout, @Suspended final AsyncResponse asyncResponse) { setTimeout(timeout, asyncResponse); log.info("running GET on this node"); try { Order order = ordersStore().get(id); if (order == null) { log.info("Delaying get as order not present for id " + id); outstandingRequests.put(id, new FilteredResponse<>(asyncResponse, (k, v) -> true)); } else { asyncResponse.resume(order); } } catch (InvalidStateStoreException e) { //Store not ready so delay log.info("Delaying request for " + id + " because state store is not ready."); outstandingRequests.put(id, new FilteredResponse<>(asyncResponse, (k, v) -> true)); } }
Example #11
Source File: TestResource.java From Sentinel with Apache License 2.0 | 6 votes |
@Path("/async-hello") @GET @Produces({ MediaType.APPLICATION_JSON }) public void asyncSayHello(@Suspended final AsyncResponse asyncResponse) { executor.submit(new Runnable() { @Override public void run() { try { TimeUnit.MILLISECONDS.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } asyncResponse.resume("Hello!"); } }); }
Example #12
Source File: Resources.java From linstor-server with GNU General Public License v3.0 | 6 votes |
@PUT @Path("{nodeName}/toggle-disk/diskless/{disklessPool}") public void toggleDiskDiskless( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("nodeName") String nodeName, @PathParam("rscName") String rscName, @PathParam("disklessPool") String disklessPool ) { Flux<ApiCallRc> flux = ctrlRscToggleDiskApiCallHandler.resourceToggleDisk( nodeName, rscName, disklessPool, null, true) .subscriberContext(requestHelper.createContext(ApiConsts.API_TOGGLE_DISK, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux)); }
Example #13
Source File: Resources.java From linstor-server with GNU General Public License v3.0 | 6 votes |
@PUT @Path("{nodeName}/migrate-disk/{fromNode}/{storagePool}") public void migrateDisk( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("nodeName") String nodeName, @PathParam("fromNode") String fromNode, @PathParam("rscName") String rscName, @PathParam("storagePool") String storagePool ) { Flux<ApiCallRc> flux = ctrlRscToggleDiskApiCallHandler.resourceToggleDisk( nodeName, rscName, storagePool, fromNode, false) .subscriberContext(requestHelper.createContext(ApiConsts.API_TOGGLE_DISK, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux)); }
Example #14
Source File: View.java From linstor-server with GNU General Public License v3.0 | 6 votes |
@GET @Path("storage-pools") public void viewStoragePools( @Context Request request, @Suspended AsyncResponse asyncResponse, @QueryParam("nodes") List<String> nodes, @QueryParam("storage_pools") List<String> storagePools, @QueryParam("props") List<String> propFilters, @DefaultValue("0") @QueryParam("limit") int limit, @DefaultValue("0") @QueryParam("offset") int offset ) { List<String> nodesFilter = nodes != null ? nodes : Collections.emptyList(); List<String> storagePoolsFilter = storagePools != null ? storagePools : Collections.emptyList(); RequestHelper.safeAsyncResponse(asyncResponse, () -> { Flux<List<StorPoolApi>> flux = ctrlStorPoolListApiCallHandler .listStorPools(nodesFilter, storagePoolsFilter, propFilters) .subscriberContext(requestHelper.createContext(ApiConsts.API_LST_STOR_POOL, request)); requestHelper.doFlux(asyncResponse, storPoolListToResponse(flux, limit, offset)); }); }
Example #15
Source File: DrbdProxy.java From linstor-server with GNU General Public License v3.0 | 6 votes |
@POST @Path("disable/{nodeA}/{nodeB}") public void disableProxy( @Context Request request, @Suspended AsyncResponse asyncResponse, @PathParam("rscName") String rscName, @PathParam("nodeA") String nodeA, @PathParam("nodeB") String nodeB ) { Flux<ApiCallRc> flux = ctrlDrbdProxyDisableApiCallHandler.disableProxy( null, nodeA, nodeB, rscName ).subscriberContext(requestHelper.createContext(ApiConsts.API_DISABLE_DRBD_PROXY, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux)); }
Example #16
Source File: Resources.java From linstor-server with GNU General Public License v3.0 | 6 votes |
@POST @Consumes(MediaType.APPLICATION_JSON) @Path("{nodeName}") public void createResource( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("rscName") String rscName, @PathParam("nodeName") String nodeName, String jsonData ) { try { // stuff single resource in a array and forward to the multiple resource creator JsonGenTypes.ResourceCreate rscData = objectMapper.readValue(jsonData, JsonGenTypes.ResourceCreate.class); rscData.resource.node_name = nodeName; ArrayList<JsonGenTypes.ResourceCreate> rscDatas = new ArrayList<>(); rscDatas.add(rscData); createResource(request, asyncResponse, rscName, objectMapper.writeValueAsString(rscDatas)); } catch (IOException ioExc) { ApiCallRcRestUtils.handleJsonParseException(ioExc, asyncResponse); } }
Example #17
Source File: CachedResultsBean.java From datawave with Apache License 2.0 | 6 votes |
@GET @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml"}) @javax.ws.rs.Path("/async/load") @GenerateQuerySessionId(cookieBasePath = "/DataWave/CachedResults/") @Interceptors({RequiredInterceptor.class, ResponseInterceptor.class}) @Asynchronous public void loadAsync(@QueryParam("queryId") @Required("queryId") String queryId, @QueryParam("alias") String alias, @Suspended AsyncResponse asyncResponse) { String nameBase = UUID.randomUUID().toString().replaceAll("-", ""); CreateQuerySessionIDFilter.QUERY_ID.set(queryId); try { GenericResponse<String> response = load(queryId, alias, nameBase); asyncResponse.resume(response); } catch (Throwable t) { asyncResponse.resume(t); } }
Example #18
Source File: Controller.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@PUT @Path("config") public void setConfig( @Context Request request, @Suspended final AsyncResponse asyncResponse, String jsonData ) { Flux<ApiCallRc> flux = Flux.empty(); try { JsonGenTypes.ControllerConfig config = objectMapper .readValue(jsonData, JsonGenTypes.ControllerConfig.class); ControllerConfigPojo conf = new ControllerConfigPojo(config); flux = ctrlApiCallHandler.setConfig(conf) .subscriberContext(requestHelper.createContext(InternalApiConsts.API_MOD_CONFIG, request)); } catch (IOException ioExc) { ApiCallRcRestUtils.handleJsonParseException(ioExc, asyncResponse); } catch (AccessDeniedException exc) { ApiCallRc rc = ApiCallRcImpl.singleApiCallRc( ApiConsts.MODIFIED | ApiConsts.MASK_CTRL_CONF, exc.toString() ); requestHelper .doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(Flux.just(rc), Response.Status.UNAUTHORIZED)); } requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK)); }
Example #19
Source File: QueuedStatementResource.java From presto with Apache License 2.0 | 5 votes |
@ResourceSecurity(PUBLIC) @GET @Path("queued/{queryId}/{slug}/{token}") @Produces(APPLICATION_JSON) public void getStatus( @PathParam("queryId") QueryId queryId, @PathParam("slug") String slug, @PathParam("token") long token, @QueryParam("maxWait") Duration maxWait, @Context UriInfo uriInfo, @Suspended AsyncResponse asyncResponse) { Query query = getQuery(queryId, slug, token); // wait for query to be dispatched, up to the wait timeout ListenableFuture<?> futureStateChange = addTimeout( query.waitForDispatched(), () -> null, WAIT_ORDERING.min(MAX_WAIT_TIME, maxWait), timeoutExecutor); // when state changes, fetch the next result ListenableFuture<QueryResults> queryResultsFuture = Futures.transform( futureStateChange, ignored -> query.getQueryResults(token, uriInfo), responseExecutor); // transform to Response ListenableFuture<Response> response = Futures.transform( queryResultsFuture, queryResults -> Response.ok(queryResults).build(), directExecutor()); bindAsyncResponse(asyncResponse, response, responseExecutor); }
Example #20
Source File: View.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@GET @Path("resources") public void viewResources( @Context Request request, @Suspended AsyncResponse asyncResponse, @QueryParam("nodes") List<String> nodes, @QueryParam("resources") List<String> resources, @QueryParam("storage_pools") List<String> storagePools, @QueryParam("props") List<String> propFilters, @DefaultValue("0") @QueryParam("limit") int limit, @DefaultValue("0") @QueryParam("offset") int offset ) { List<String> nodesFilter = nodes != null ? nodes : Collections.emptyList(); List<String> storagePoolsFilter = storagePools != null ? storagePools : Collections.emptyList(); List<String> resourcesFilter = resources != null ? resources : Collections.emptyList(); RequestHelper.safeAsyncResponse(asyncResponse, () -> { Flux<ResourceList> flux = ctrlVlmListApiCallHandler.listVlms( nodesFilter, storagePoolsFilter, resourcesFilter, propFilters) .subscriberContext(requestHelper.createContext(ApiConsts.API_LST_VLM, request)); requestHelper.doFlux( asyncResponse, listVolumesApiCallRcWithToResponse(flux, limit, offset) ); }); }
Example #21
Source File: ResourceConnections.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@PUT @Path("{nodeA}/{nodeB}") public void modifyResourceConnection( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("rscName") String rscName, @PathParam("nodeA") String nodeA, @PathParam("nodeB") String nodeB, String jsonData ) throws IOException { JsonGenTypes.ResourceConnectionModify rscConnModify = objectMapper.readValue( jsonData, JsonGenTypes.ResourceConnectionModify.class ); Flux<ApiCallRc> flux = ctrlApiCallHandler.modifyRscConn( null, nodeA, nodeB, rscName, rscConnModify.override_props, new HashSet<>(rscConnModify.delete_props), new HashSet<>(rscConnModify.delete_namespaces) ) .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_RSC_CONN, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK)); }
Example #22
Source File: ResourceGroups.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@PUT @Consumes(MediaType.APPLICATION_JSON) @Path("{rscGrpName}") public void modifyResourceGroup( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("rscGrpName") String rscGrpName, String jsonData ) throws IOException { JsonGenTypes.ResourceGroupModify modifyData = objectMapper.readValue( jsonData, JsonGenTypes.ResourceGroupModify.class ); AutoSelectFilterApi modifyAutoSelectFilter = selectFilterToApi(modifyData.select_filter); Flux<ApiCallRc> flux = ctrlRscGrpApiCallHandler.modify( rscGrpName, modifyData.description, modifyData.override_props, new HashSet<>(modifyData.delete_props), new HashSet<>(modifyData.delete_namespaces), modifyAutoSelectFilter ) .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_RSC_GRP, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK)); }
Example #23
Source File: Volumes.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@PUT @Path("{vlmNr}") public void modifyVolume( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("nodeName") String nodeName, @PathParam("rscName") String rscName, @PathParam("vlmNr") Integer vlmNr, String jsonData ) throws IOException { JsonGenTypes.VolumeModify modifyData = objectMapper .readValue(jsonData, JsonGenTypes.VolumeModify.class); Flux<ApiCallRc> flux = ctrlApiCallHandler.modifyVlm( null, nodeName, rscName, vlmNr, modifyData.override_props, new HashSet<>(modifyData.delete_props), new HashSet<>(modifyData.delete_namespaces) ) .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_VLM, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK)); }
Example #24
Source File: TaskResource.java From presto with Apache License 2.0 | 5 votes |
@ResourceSecurity(INTERNAL_ONLY) @GET @Path("{taskId}") @Produces(MediaType.APPLICATION_JSON) public void getTaskInfo( @PathParam("taskId") final TaskId taskId, @HeaderParam(PRESTO_CURRENT_STATE) TaskState currentState, @HeaderParam(PRESTO_MAX_WAIT) Duration maxWait, @Context UriInfo uriInfo, @Suspended AsyncResponse asyncResponse) { requireNonNull(taskId, "taskId is null"); if (currentState == null || maxWait == null) { TaskInfo taskInfo = taskManager.getTaskInfo(taskId); if (shouldSummarize(uriInfo)) { taskInfo = taskInfo.summarize(); } asyncResponse.resume(taskInfo); return; } Duration waitTime = randomizeWaitTime(maxWait); ListenableFuture<TaskInfo> futureTaskInfo = addTimeout( taskManager.getTaskInfo(taskId, currentState), () -> taskManager.getTaskInfo(taskId), waitTime, timeoutExecutor); if (shouldSummarize(uriInfo)) { futureTaskInfo = Futures.transform(futureTaskInfo, TaskInfo::summarize, directExecutor()); } // For hard timeout, add an additional time to max wait for thread scheduling contention and GC Duration timeout = new Duration(waitTime.toMillis() + ADDITIONAL_WAIT_TIME.toMillis(), MILLISECONDS); bindAsyncResponse(asyncResponse, futureTaskInfo, responseExecutor) .withTimeout(timeout); }
Example #25
Source File: GreetingResource.java From Sentinel with Apache License 2.0 | 5 votes |
@Path("/async") @GET @Produces({ MediaType.APPLICATION_JSON }) public void asyncHello(@Suspended final AsyncResponse asyncResponse) { executor.submit(() -> { try { TimeUnit.MILLISECONDS.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } asyncResponse.resume("Hello!"); }); }
Example #26
Source File: Nodes.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@POST @Consumes(MediaType.APPLICATION_JSON) public void createNode( @Context Request request, @Suspended final AsyncResponse asyncResponse, String jsonData ) { try { JsonGenTypes.Node data = objectMapper.readValue(jsonData, JsonGenTypes.Node.class); Flux<ApiCallRc> flux = ctrlNodeCrtApiCallHandler .createNode( data.name, data.type, data.net_interfaces.stream().map(Json::netInterfacetoApi).collect(Collectors.toList()), data.props ) .subscriberContext(requestHelper.createContext(ApiConsts.API_CRT_NODE, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.CREATED)); } catch (IOException ioExc) { ApiCallRcRestUtils.handleJsonParseException(ioExc, asyncResponse); } }
Example #27
Source File: Nodes.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@PUT @Consumes(MediaType.APPLICATION_JSON) @Path("{nodeName}") public void modifyNode( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("nodeName") String nodeName, String jsonData ) { try { JsonGenTypes.NodeModify modifyData = objectMapper.readValue(jsonData, JsonGenTypes.NodeModify.class); Flux<ApiCallRc> flux = ctrlApiCallHandler.modifyNode( null, nodeName, modifyData.node_type, modifyData.override_props, new HashSet<>(modifyData.delete_props), new HashSet<>(modifyData.delete_namespaces) ) .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_NODE, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK)); } catch (IOException ioExc) { ApiCallRcRestUtils.handleJsonParseException(ioExc, asyncResponse); } }
Example #28
Source File: Nodes.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@DELETE @Path("{nodeName}") public void deleteNode( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("nodeName") String nodeName ) { Flux<ApiCallRc> flux = ctrlNodeDeleteApiCallHandler .deleteNode(nodeName) .subscriberContext(requestHelper.createContext(ApiConsts.API_DEL_NODE, request)); requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux)); }
Example #29
Source File: Resources.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@PUT @Path("{nodeName}/migrate-disk/{fromNode}") public void migrateDisk( @Context Request request, @Suspended final AsyncResponse asyncResponse, @PathParam("nodeName") String nodeName, @PathParam("fromNode") String fromNode, @PathParam("rscName") String rscName ) { migrateDisk(request, asyncResponse, nodeName, fromNode, rscName, null); }
Example #30
Source File: Volumes.java From linstor-server with GNU General Public License v3.0 | 5 votes |
@GET @Path("{vlmNr}") public void listVolumes( @Context Request request, @Suspended AsyncResponse asyncResponse, @PathParam("rscName") String rscName, @PathParam("nodeName") String nodeName, @PathParam("vlmNr") Integer vlmNr, @DefaultValue("0") @QueryParam("limit") int limit, @DefaultValue("0") @QueryParam("offset") int offset ) { List<String> nodes = Collections.singletonList(nodeName); List<String> rscNames = Collections.singletonList(rscName); RequestHelper.safeAsyncResponse(asyncResponse, () -> { Flux<ResourceList> flux = ctrlVlmListApiCallHandler.listVlms( nodes, Collections.emptyList(), rscNames, Collections.emptyList()) .subscriberContext(requestHelper.createContext(ApiConsts.API_LST_VLM, request)); requestHelper.doFlux( asyncResponse, listVolumesApiCallRcWithToResponse(flux, rscName, nodeName, vlmNr, limit, offset) ); }); }