Search in sources :

Example 1 with DiskSpaceOperationResult

use of com.thoughtworks.go.server.service.result.DiskSpaceOperationResult in project gocd by gocd.

the class GoDiskSpaceMonitor method onTimer.

//Note: This method is called from a Spring timer task
public void onTimer() {
    OperationResult result = new DiskSpaceOperationResult(serverHealthService);
    try {
        boolean outOfDisk = false;
        for (DiskSpaceChecker checker : checkers) {
            OperationResult callResult = checker.resultFor(result);
            checker.check(callResult);
            outOfDisk = outOfDisk || !result.canContinue();
        }
        lowOnDisk = outOfDisk;
    } catch (Exception e) {
        LOG.error("Error occured during checking filesystems low disk space", e);
    }
}
Also used : DiskSpaceOperationResult(com.thoughtworks.go.server.service.result.DiskSpaceOperationResult) OperationResult(com.thoughtworks.go.server.service.result.OperationResult) DiskSpaceOperationResult(com.thoughtworks.go.server.service.result.DiskSpaceOperationResult) DiskSpaceChecker(com.thoughtworks.go.server.service.DiskSpaceChecker) SystemDiskSpaceChecker(com.thoughtworks.go.server.service.SystemDiskSpaceChecker)

Example 2 with DiskSpaceOperationResult

use of com.thoughtworks.go.server.service.result.DiskSpaceOperationResult in project gocd by gocd.

the class ArtifactsDiskCleanerTest method shouldUseA_NonServerHealthAware_result.

@Test
public void shouldUseA_NonServerHealthAware_result() {
    serverHealthService = mock(ServerHealthService.class);
    OperationResult operationResult = artifactsDiskCleaner.resultFor(new DiskSpaceOperationResult(serverHealthService));
    assertThat(operationResult, is(instanceOf(ServerHealthStateOperationResult.class)));
}
Also used : DiskSpaceOperationResult(com.thoughtworks.go.server.service.result.DiskSpaceOperationResult) ServerHealthService(com.thoughtworks.go.serverhealth.ServerHealthService) HttpOperationResult(com.thoughtworks.go.server.service.result.HttpOperationResult) OperationResult(com.thoughtworks.go.server.service.result.OperationResult) ServerHealthStateOperationResult(com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult) DiskSpaceOperationResult(com.thoughtworks.go.server.service.result.DiskSpaceOperationResult) Test(org.junit.Test)

Aggregations

DiskSpaceOperationResult (com.thoughtworks.go.server.service.result.DiskSpaceOperationResult)2 OperationResult (com.thoughtworks.go.server.service.result.OperationResult)2 DiskSpaceChecker (com.thoughtworks.go.server.service.DiskSpaceChecker)1 SystemDiskSpaceChecker (com.thoughtworks.go.server.service.SystemDiskSpaceChecker)1 HttpOperationResult (com.thoughtworks.go.server.service.result.HttpOperationResult)1 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)1 ServerHealthService (com.thoughtworks.go.serverhealth.ServerHealthService)1 Test (org.junit.Test)1