Skip to content

Commit

Permalink
Merge pull request #150 from Netflix/dynomiteManagerFix
Browse files Browse the repository at this point in the history
Removes JMX and changes interfaces to implementation as parameters
  • Loading branch information
akashdeepgoel authored May 1, 2023
2 parents a89aa18 + 2f94c65 commit 02916fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@
*/
package com.netflix.nfsidecar.scheduler;

import com.google.common.base.Throwables;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.management.MBeanServer;
import javax.management.ObjectName;
import java.lang.management.ManagementFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
Expand All @@ -49,24 +43,8 @@ public static enum STATE

protected Task()
{
this(ManagementFactory.getPlatformMBeanServer());
}

protected Task(MBeanServer mBeanServer) {
// TODO: don't do mbean registration here
String mbeanName = "com.netflix.florida.scheduler:type=" + this.getClass().getName();
try
{
mBeanServer.registerMBean(this, new ObjectName(mbeanName));
initialize();
}
catch (Exception e)
{
throw Throwables.propagate(e);
}
}


/**
* This method has to be implemented and cannot thow any exception.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.netflix.dynomitemanager.config.FloridaConfig;
import com.netflix.dynomitemanager.config.InstanceState;
import com.netflix.dynomitemanager.storage.JedisUtils;
import com.netflix.nfsidecar.identity.IInstanceState;
import com.netflix.nfsidecar.scheduler.SimpleTimer;
Expand Down Expand Up @@ -37,17 +38,14 @@ public class DynomiteProcessManager extends Task implements IDynomiteProcess, He
private static final int SCRIPT_EXECUTE_WAIT_TIME_MS = 5000;
private final FloridaConfig config;
private final Sleeper sleeper;
private final IInstanceState instanceState;
private final IDynomiteProcess dynProcess;
private final InstanceState instanceState;
private boolean dynomiteHealth = false;

@Inject
public DynomiteProcessManager(FloridaConfig config, Sleeper sleeper, IInstanceState instanceState,
IDynomiteProcess dynProcess) {
public DynomiteProcessManager(FloridaConfig config, Sleeper sleeper, InstanceState instanceState) {
this.config = config;
this.sleeper = sleeper;
this.instanceState = instanceState;
this.dynProcess = dynProcess;
}

public static TaskTimer getTimer() {
Expand Down Expand Up @@ -213,7 +211,7 @@ public boolean dynomiteCheck() {
if (!dynomiteRedisCheck()) {
try {
logger.error("Dynomite was down");
this.dynProcess.stop();
this.stop();
sleeper.sleepQuietly(1000);
return false;
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.netflix.dynomitemanager.config.FloridaConfig;
import com.netflix.dynomitemanager.config.InstanceState;
import com.netflix.dynomitemanager.storage.StorageProxy;
import com.netflix.nfsidecar.config.CommonConfig;
import com.netflix.nfsidecar.identity.IInstanceState;
Expand Down Expand Up @@ -32,15 +33,15 @@ public class DynomiteStandardTuner implements ProcessTuner {
protected final CommonConfig commonConfig;
protected final InstanceIdentity ii;
protected final StorageProxy storageProxy;
protected final IInstanceState instanceState;
protected final InstanceState instanceState;
protected final IEnvVariables envVariables;
protected final InstanceDataRetriever instanceDataRetriever;

public static final Pattern MEMINFO_PATTERN = Pattern.compile("MemTotal:\\s*([0-9]*)");

@Inject
public DynomiteStandardTuner(FloridaConfig floridaConfig, CommonConfig commonConfig, InstanceIdentity ii,
IInstanceState instanceState, StorageProxy storageProxy, IEnvVariables envVariables,
InstanceState instanceState, StorageProxy storageProxy, IEnvVariables envVariables,
InstanceDataRetriever instanceDataRetriever) {
this.floridaConfig = floridaConfig;
this.commonConfig = commonConfig;
Expand Down

0 comments on commit 02916fe

Please sign in to comment.