小编Abd*_*DMA的帖子

如何在Google Cloud中获得更多磁盘性能?

其中一个(Ubuntu 16.04)谷歌云虚拟机的其中一个卷的磁盘利用率几乎一直是100% - 这是从系统中随机抽取的10秒样本:

iostat -x 10

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sdd               0.60    17.20 5450.50 2468.00 148923.60 25490.00    44.05    11.81    1.49    1.13    2.29   0.13  99.60
Run Code Online (Sandbox Code Playgroud)

这是目前的2.5T持久SSD.

我的理解是,通过添加虚拟"主轴"然后在它们之间分配工作负载,我无法获得更好的性能.

这是一个数据库卷,所以我也不能真正使用易失性SSD.

我目前在XFS上有这些挂载选项:

type xfs (rw,noatime,nodiratime,attr2,nobarrier,inode64,noquota)
Run Code Online (Sandbox Code Playgroud)

有什么建议?

storage xfs google-compute-engine google-cloud-platform

6
推荐指数
1
解决办法
645
查看次数

根据javafx中listview中的选定项调用类

我有一个ListView,每次更改选择时,我想调用具有该名称的类.例如,如果该项称为"文本字符串",则应调用类TextString.我现在的代码给了我一个错误说The method insert(ArrayList<Element>) is undefined for the type Object... Eclipse给了我一个建议将对象强制转换为Element,但这没有做任何事情.Element类是一个超类,TextString将实现该类.

这是我到目前为止的代码:

   elementList.itemsProperty().bind(listProperty);
        listProperty.set(FXCollections.observableArrayList(elementListItems));
        elementList.setOnMouseClicked(new EventHandler<MouseEvent>() {

            public String selectedElement = "Text String";
            @Override
            public void handle(MouseEvent event) {
                selectedElement  = (String)elementList.getSelectionModel().getSelectedItem();
                selectedElement = selectedElement.replace(" ", "");
                Class<?> clazz;
                try {
                    clazz = Class.forName("elements."+selectedElement);
                    Constructor<?> ctor = clazz.getConstructor();
                    Object object = ctor.newInstance();
                    Method meth = clazz.getClass().getMethod("insert", new Class<?>[] { Canvas.class, ArrayList.class, GraphicsContext.class });
                    meth.invoke(object, canvas, objects, gc);
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace(); …
Run Code Online (Sandbox Code Playgroud)

java javafx-8

5
推荐指数
1
解决办法
453
查看次数

无法在春季数据休息中启动 bean 'documentationPluginsBootstrapper'

我正在为我的应用程序使用 spring 数据休息。

当我在存储库中添加此方法时,出现以下错误并且应用程序无法启动:-

方法:-

@Modifying
@Transactional
@Query("from employee as ft where ft.company.id = ?1")
void deleteAllEmployeeCompany(
        @Param("companyId") @RequestParam("companyId") int companyId);
Run Code Online (Sandbox Code Playgroud)

错误:-

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:874) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题?

更新:-

所有依赖项的列表:-

[INFO] com.test:test-service:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile
[INFO] |  | …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc spring-data springfox

4
推荐指数
13
解决办法
2万
查看次数

我的@Cacheable似乎被忽略了(Spring)

我必须缓存以下public方法的结果:

    @Cacheable(value = "tasks", key = "#user.username")
    public Set<MyPojo> retrieveCurrentUserTailingTasks(UserInformation user) {
        Set<MyPojo> resultSet;
        try {
            nodeInformationList = taskService.getTaskList(user);
        } catch (Exception e) {
            throw new ApiException("Error while retrieving tailing tasks", e);
        }
        return resultSet;
    }
Run Code Online (Sandbox Code Playgroud)

我还在这里配置了缓存:

@Configuration
@EnableCaching(mode = AdviceMode.PROXY)
public class CacheConfig  {

@Bean
public CacheManager cacheManager() {
    final SimpleCacheManager cacheManager = new SimpleCacheManager();
    cacheManager.setCaches(Arrays.asList(new ConcurrentMapCache("tasks"),new ConcurrentMapCache("templates")));
    return cacheManager;
}

@Bean
public CacheResolver cacheResolver() {
    final SimpleCacheResolver cacheResolver = new SimpleCacheResolver(cacheManager());
    return cacheResolver;
}

}
Run Code Online (Sandbox Code Playgroud)

我断言如下: …

java spring caching spring-mvc

2
推荐指数
1
解决办法
3165
查看次数

如何访问建议方法的返回Object实例

我正在使用spring AOP来建议我的服务方法,尤其是返回一个对象的方法,我想在建议处理过程中访问该对象.

我的配置工作正常,没有问题.

这是adviced方法的签名,方法根据方法参数中的数据返回一个新实例,因此参数不可用

@Traceable(ETraceableMessages.SAUVER_APPORTEUR)
public ElementNiveauUn save(ElementNiveauUn apporteur) throws ATPBusinessException {
    String identifiant = instanceService.sauverInstance(null, apporteur);
    List<String> extensions = new ArrayList<String>();
    extensions.add(ELEMENTSCONTENUS);
    extensions.add(TYPEELEMENT);
    extensions.add(VERSIONING);
    extensions.add(PARAMETRAGES);
    extensions.add(PARAMETRAGES + "." + PARAMETRES);
    return (ElementNiveauUn ) instanceService.lireInstanceParId(identifiant, extensions.toArray(new String[]{}));
}
Run Code Online (Sandbox Code Playgroud)

这就是我想要做的事情

@Around(value = "execution(elementNiveauUn fr.generali.nova.atp.service.metier.impl.*.*(..)) && @annotation(traceable) && args(element)", argNames = "element,traceable")
public void serviceLayerTraceAdviceBasedElementInstanceAfter2(final ProceedingJoinPoint pjp,
                final ElementNiveauUn element, final Traceable traceable) throws SecurityException,
                NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {

    // current user
    String currentUserId = findCurrentUserId();

    // wether user is found …
Run Code Online (Sandbox Code Playgroud)

java aop spring aspectj

1
推荐指数
1
解决办法
7691
查看次数

在Spring Controller上$ .ajax POST后收到错误的请求错误(400)

你好StackOverFlow(s)

我正在运行这个问题,因为现在超过2个小时这很简单

我正在尝试使用$ .ajax POST调用将JSON对象发送到Spring Controller

我正在使用AngularJS,但这一点很有用

这是服务器和客户端的代码以及弹簧配置

提前致谢

JQuery:

    $scope.push = function() {
    $.ajax({
        type: "PUT",
        url:"rest/todo/greeting/",
        data : {id:"1",title:"ajax",description:"ajax"},
        dataType: "json",
        contentType : "application/json",
        success : function(data) {
            $log.info(data)
        }
    })
}
Run Code Online (Sandbox Code Playgroud)

弹簧控制器:

@Controller
@RequestMapping("/todo")
public class TodoController {
@RequestMapping(value = "/greeting", method = RequestMethod.PUT,consumes="application/json",produces="text/html")
public @ResponseBody String push(@RequestBody Todo todo) {
    System.out.println(todo.getTitle());
    return "test";
}
Run Code Online (Sandbox Code Playgroud)

}

弹簧配置:

<mvc:annotation-driven />
<context:component-scan base-package="org.lab.todo.controller" />
<bean id="defaultViews" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" />
Run Code Online (Sandbox Code Playgroud)

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<listener> …
Run Code Online (Sandbox Code Playgroud)

java ajax jquery spring request-mapping

0
推荐指数
1
解决办法
2万
查看次数