Skip to content

com.griddynamics.jagger.agent.impl.MonitoringInfoServiceImpl#getSystemInfo needs to be refactored #201

Open
@akelepko

Description

@akelepko
  1. use EnumMap instead of HashMap for sysInfoStringMap.
  2. split com.griddynamics.jagger.agent.model.SystemInfoCollector#getMemInfo into corresponding methods. Currently the workflow is as follows: org.hyperic.sigar.Mem gathers statistics; statistics are converted to Strings and put to a map; MonitoringInfoServiceImpl reads the map and parses the Strings into doubles, and puts into sysInfoStringMap. The intermediate conversion steps seem to be redundant.
  3. you don't need to create a Thread each tome here:
    final SettableFuture<Map<String, SystemUnderTestInfo>> future = SettableFuture.create();
    jmxThreadPoolExecutor.submit(new Thread() {
    @OverRide
    public void run() {
    future.set(systemUnderTestService.getInfo());
    }
    });
    You need Callable instead.
  4. why would you want to TimeUtils.sleepMillis(JMX_TIMEOUT) after timeout?
  5. SystemUnderTestService statistics are collected effectively synchronously. Consider submitting the task in the beginning of the method
  6. update guava dependency
  7. on ExecutionException you'd rather propagate it's cause. Otherwise, there's little benefit in calling Throwables.propagate(e) as e is always checked

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions