refactor this code wrote with java 8:     @Override
    @GET
    @RESTDescription("Импорт из Jaeger")
    @Path("jaegerImport")
    public Response getInfoFromJaeger(@Context HttpServletRequest req,
                                      @Context HttpServletResponse response,
                                      @QueryParam("name") String datasetName,
                                      @QueryParam("endTime") Long endTime,
                                      @QueryParam("lookback") String lookback,
                                      @QueryParam("maxDuration") String maxDuration,
                                      @QueryParam("minDuration") String minDuration,
                                      @QueryParam("startTime") Long startTime,
                                      @QueryParam("operation") String operation) {
        String sessionId;
        Cookie cookie = null;
        String responseMessage = null;
        try {
            if (restResourcesUtil.getSessionIdFromCookie(req) == null) {
                cookie = promCookie.create();
                sessionId = cookie.getValue();
            } else {
                sessionId = restResourcesUtil.getSessionIdFromCookie(req);
        }

        runDataProcessingPipeline(
                jaegerConverter.jaegerTraceFormatter(
                        endTime.toString(),
                        lookback, maxDuration,
                        minDuration, startTime.toString(), operation),
                sessionId);

        String datasetId = singleThreadFabricator.createDataset(sessionId, datasetName);

        multiThreadFabricator.allDataClearPipeline(sessionId);

        updateCookieLifeTime(req);

        doFilter(response);

        if (cookie != null) {
            response.addCookie(cookie);
        }

        if (datasetId != null) {
            responseMessage = singleThreadFabricator.restResponsePipeline(true, datasetName + " created");
        }

        } catch (Exception e) {
            responseMessage = singleThreadFabricator.restResponsePipeline(false,
                    F.ormat(Messages.getString("ru.fisgroup.platform.processmining.model.JaegerImport.0"), e));
        }

        return Response
                .ok()
                .type(MediaType.TEXT_HTML)
                .entity(responseMessage)
                .build();
    }
    @Override
    @POST
    @RESTDescription("Импорт XES для Process Mining")
    @Path("importXESForMining")
    public Response importXESForMining (@Context HttpServletRequest req,
                                        @Context HttpServletResponse response,
                                        @QueryParam("name") String datasetName) {

        File uploadedFile = RestResourcesUtil.uploadFile(req, datasetManager.getPathFolder(false));
        if (uploadedFile == null) {
            return errResponse(F.ormat(Messages.getString("Не удалось загрузить файл"))); //$NON-NLS-1$
        }
        String filePath = uploadedFile.getAbsolutePath();
        if (!uploadedFile.exists()) {
            return errResponse(F.ormat(Messages.getString("Файл не найден"), filePath)); //$NON-NLS-1$
        }

        String sessionId;
        Cookie cookie = null;
        String responseMessage = null;
        try {
            if (restResourcesUtil.getSessionIdFromCookie(req) == null) {
                cookie = promCookie.create();
                sessionId = cookie.getValue();
            } else {
                sessionId = restResourcesUtil.getSessionIdFromCookie(req);
            }

            runDataProcessingPipeline(
                    singleThreadFabricator.XEStoTB(filePath),
                    sessionId);

            String datasetId = singleThreadFabricator.createDataset(sessionId, datasetName);

            multiThreadFabricator.allDataClearPipeline(sessionId);

            uploadedFile.delete();

            updateCookieLifeTime(req);

            doFilter(response);

            if (cookie != null) {
                response.addCookie(cookie);
            }
            if (datasetId != null) {
                responseMessage = singleThreadFabricator.restResponsePipeline(true, datasetName + " created");
            }
        } catch (Exception e) {
            responseMessage = singleThreadFabricator.restResponsePipeline(false,
                    F.ormat(Messages.getString("ru.fisgroup.platform.processmining.model.XESImport.0"), e));
        }

        return Response
                .ok()
                .type(MediaType.TEXT_HTML)
                .entity(responseMessage)
                .build();
    }