YARN-4457. Cleanup unchecked types for EventHandler (templedf via rkanter)

This commit is contained in:
Robert Kanter 2016-12-09 17:28:25 -08:00
parent a6410a542e
commit 4b149a1e77
39 changed files with 89 additions and 68 deletions

View File

@ -31,6 +31,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.JobId;
import org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils;
import org.apache.hadoop.service.CompositeService;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
@ -43,12 +44,12 @@ public class JobHistoryCopyService extends CompositeService implements HistoryEv
private static final Log LOG = LogFactory.getLog(JobHistoryCopyService.class);
private final ApplicationAttemptId applicationAttemptId;
private final EventHandler handler;
private final EventHandler<Event> handler;
private final JobId jobId;
public JobHistoryCopyService(ApplicationAttemptId applicationAttemptId,
EventHandler handler) {
EventHandler<Event> handler) {
super("JobHistoryCopyService");
this.applicationAttemptId = applicationAttemptId;
this.jobId = TypeConverter.toYarn(

View File

@ -26,6 +26,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.JobId;
import org.apache.hadoop.mapreduce.v2.app.job.Job;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.security.client.ClientToAMTokenSecretManager;
import org.apache.hadoop.yarn.util.Clock;
@ -51,8 +52,7 @@ public interface AppContext {
Map<JobId, Job> getAllJobs();
@SuppressWarnings("rawtypes")
EventHandler getEventHandler();
EventHandler<Event> getEventHandler();
Clock getClock();

View File

@ -1120,7 +1120,7 @@ public class MRAppMaster extends CompositeService {
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return dispatcher.getEventHandler();
}

View File

@ -52,6 +52,7 @@ import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.util.Clock;
import com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.yarn.event.Event;
public class DefaultSpeculator extends AbstractService implements
Speculator {
@ -106,7 +107,7 @@ public class DefaultSpeculator extends AbstractService implements
private final Clock clock;
private final EventHandler<TaskEvent> eventHandler;
private final EventHandler<Event> eventHandler;
public DefaultSpeculator(Configuration conf, AppContext context) {
this(conf, context, context.getClock());

View File

@ -103,7 +103,7 @@ public class TestLocalContainerLauncher {
AppContext context = mock(AppContext.class);
// a simple event handler solely to detect the container cleaned event
final CountDownLatch isDone = new CountDownLatch(1);
EventHandler handler = new EventHandler() {
EventHandler<Event> handler = new EventHandler<Event>() {
@Override
public void handle(Event event) {
LOG.info("handling event " + event.getClass() +

View File

@ -91,7 +91,7 @@ public class TestTaskAttemptFinishingMonitor {
}
public static class MockEventHandler implements EventHandler {
public static class MockEventHandler implements EventHandler<Event> {
public boolean timedOut = false;
@Override

View File

@ -17,7 +17,6 @@
*/
package org.apache.hadoop.mapred;
import org.apache.hadoop.mapred.Counters;
import org.apache.hadoop.mapred.Counters.Counter;
import org.apache.hadoop.mapreduce.checkpoint.EnumCounter;
@ -48,6 +47,7 @@ import org.apache.hadoop.mapreduce.v2.app.rm.preemption.CheckpointAMPreemptionPo
import org.apache.hadoop.mapreduce.v2.app.rm.RMHeartbeatHandler;
import org.apache.hadoop.mapreduce.v2.util.MRBuilderUtils;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@ -102,7 +102,8 @@ public class TestTaskAttemptListenerImpl {
mock(RMHeartbeatHandler.class);
TaskHeartbeatHandler hbHandler = mock(TaskHeartbeatHandler.class);
Dispatcher dispatcher = mock(Dispatcher.class);
EventHandler ea = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> ea = mock(EventHandler.class);
when(dispatcher.getEventHandler()).thenReturn(ea);
when(appCtx.getEventHandler()).thenReturn(ea);
@ -212,7 +213,8 @@ public class TestTaskAttemptListenerImpl {
mock(RMHeartbeatHandler.class);
final TaskHeartbeatHandler hbHandler = mock(TaskHeartbeatHandler.class);
Dispatcher dispatcher = mock(Dispatcher.class);
EventHandler ea = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> ea = mock(EventHandler.class);
when(dispatcher.getEventHandler()).thenReturn(ea);
when(appCtx.getEventHandler()).thenReturn(ea);
CheckpointAMPreemptionPolicy policy = new CheckpointAMPreemptionPolicy();
@ -273,7 +275,8 @@ public class TestTaskAttemptListenerImpl {
mock(RMHeartbeatHandler.class);
final TaskHeartbeatHandler hbHandler = mock(TaskHeartbeatHandler.class);
Dispatcher dispatcher = mock(Dispatcher.class);
EventHandler ea = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> ea = mock(EventHandler.class);
when(dispatcher.getEventHandler()).thenReturn(ea);
when(appCtx.getEventHandler()).thenReturn(ea);
CheckpointAMPreemptionPolicy policy = new CheckpointAMPreemptionPolicy();
@ -318,7 +321,8 @@ public class TestTaskAttemptListenerImpl {
when(mockJob.getTask(any(TaskId.class))).thenReturn(mockTask);
Dispatcher dispatcher = mock(Dispatcher.class);
EventHandler ea = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> ea = mock(EventHandler.class);
when(dispatcher.getEventHandler()).thenReturn(ea);
RMHeartbeatHandler rmHeartbeatHandler =
@ -398,7 +402,8 @@ public class TestTaskAttemptListenerImpl {
mock(RMHeartbeatHandler.class);
TaskHeartbeatHandler hbHandler = mock(TaskHeartbeatHandler.class);
Dispatcher dispatcher = mock(Dispatcher.class);
EventHandler ea = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> ea = mock(EventHandler.class);
when(dispatcher.getEventHandler()).thenReturn(ea);
when(appCtx.getEventHandler()).thenReturn(ea);

View File

@ -26,6 +26,7 @@ import org.apache.hadoop.mapreduce.v2.api.records.JobId;
import org.apache.hadoop.mapreduce.v2.app.job.Job;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.security.client.ClientToAMTokenSecretManager;
import org.apache.hadoop.yarn.util.Clock;
@ -92,9 +93,8 @@ public class MockAppContext implements AppContext {
return jobs; // OK
}
@SuppressWarnings("rawtypes")
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return new MockEventHandler();
}

View File

@ -18,11 +18,11 @@
package org.apache.hadoop.mapreduce.v2.app;
import org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptEvent;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
public class MockEventHandler implements EventHandler<TaskAttemptEvent> {
public class MockEventHandler implements EventHandler<Event> {
@Override
public void handle(TaskAttemptEvent event) {
public void handle(Event event) {
}
}

View File

@ -53,6 +53,7 @@ import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@ -85,7 +86,8 @@ public class TestCheckpointPreemptionPolicy {
jid = MRBuilderUtils.newJobId(appId, 1);
mActxt = mock(RunningAppContext.class);
EventHandler ea = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> ea = mock(EventHandler.class);
when(mActxt.getEventHandler()).thenReturn(ea);
for (int i = 0; i < 40; ++i) {
ContainerId cId = ContainerId.newContainerId(appAttemptId, i);

View File

@ -43,6 +43,7 @@ import org.apache.hadoop.yarn.api.records.PreemptionContainer;
import org.apache.hadoop.yarn.api.records.PreemptionContract;
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
import org.apache.hadoop.yarn.api.records.StrictPreemptionContract;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@ -112,7 +113,8 @@ public class TestKillAMPreemptionPolicy {
private RunningAppContext getRunningAppContext() {
RunningAppContext mActxt = mock(RunningAppContext.class);
EventHandler<?> eventHandler = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> eventHandler = mock(EventHandler.class);
when(mActxt.getEventHandler()).thenReturn(eventHandler);
return mActxt;
}

View File

@ -71,6 +71,7 @@ import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.event.AsyncDispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.factories.RecordFactory;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@ -835,7 +836,7 @@ public class TestRuntimeEstimators {
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return dispatcher.getEventHandler();
}

View File

@ -73,7 +73,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class TestCommitterEventHandler {
public static class WaitForItHandler implements EventHandler {
public static class WaitForItHandler implements EventHandler<Event> {
private Event event = null;

View File

@ -167,8 +167,8 @@ public class TestContainerLauncherImpl {
public void testHandle() throws Exception {
LOG.info("STARTING testHandle");
AppContext mockContext = mock(AppContext.class);
@SuppressWarnings("rawtypes")
EventHandler mockEventHandler = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> mockEventHandler = mock(EventHandler.class);
when(mockContext.getEventHandler()).thenReturn(mockEventHandler);
String cmAddress = "127.0.0.1:8000";
ContainerManagementProtocolClient mockCM =
@ -228,8 +228,8 @@ public class TestContainerLauncherImpl {
public void testOutOfOrder() throws Exception {
LOG.info("STARTING testOutOfOrder");
AppContext mockContext = mock(AppContext.class);
@SuppressWarnings("rawtypes")
EventHandler mockEventHandler = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> mockEventHandler = mock(EventHandler.class);
when(mockContext.getEventHandler()).thenReturn(mockEventHandler);
ContainerManagementProtocolClient mockCM =
@ -290,8 +290,8 @@ public class TestContainerLauncherImpl {
LOG.info("in test Shutdown");
AppContext mockContext = mock(AppContext.class);
@SuppressWarnings("rawtypes")
EventHandler mockEventHandler = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> mockEventHandler = mock(EventHandler.class);
when(mockContext.getEventHandler()).thenReturn(mockEventHandler);
ContainerManagementProtocolClient mockCM =

View File

@ -247,8 +247,8 @@ public class TestLocalContainerAllocator {
ApplicationAttemptId attemptId =
ApplicationAttemptId.newInstance(appId, 1);
Job job = mock(Job.class);
@SuppressWarnings("rawtypes")
EventHandler eventHandler = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> eventHandler = mock(EventHandler.class);
AppContext ctx = mock(AppContext.class);
when(ctx.getApplicationID()).thenReturn(appId);
when(ctx.getApplicationAttemptId()).thenReturn(attemptId);

View File

@ -47,6 +47,7 @@ import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.util.concurrent.HadoopScheduledThreadPoolExecutor;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@ -344,7 +345,7 @@ public class JobHistory extends AbstractService implements HistoryContext {
// TODO AppContext - Not Required
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
// TODO Auto-generated method stub
return null;
}

View File

@ -1570,6 +1570,7 @@
<target>${javac.version}</target>
<compilerArguments>
<Xlint/>
<Xlint:-unchecked/>
<Xmaxwarns>9999</Xmaxwarns>
</compilerArguments>
</configuration>

View File

@ -68,7 +68,7 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
// For drainEventsOnStop enabled only, block newly coming events into the
// queue while stopping.
private volatile boolean blockNewEvents = false;
private final EventHandler handlerInstance = new GenericEventHandler();
private final EventHandler<Event> handlerInstance = new GenericEventHandler();
private Thread eventHandlingThread;
protected final Map<Class<? extends Enum>, EventHandler> eventDispatchers;
@ -228,7 +228,7 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher {
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return handlerInstance;
}

View File

@ -40,7 +40,7 @@ public interface Dispatcher {
public static final boolean DEFAULT_DISPATCHER_EXIT_ON_ERROR = false;
EventHandler getEventHandler();
EventHandler<Event> getEventHandler();
void register(Class<? extends Enum> eventType, EventHandler handler);

View File

@ -89,9 +89,9 @@ public class DrainDispatcher extends AsyncDispatcher {
@SuppressWarnings("unchecked")
@Override
public EventHandler getEventHandler() {
final EventHandler actual = super.getEventHandler();
return new EventHandler() {
public EventHandler<Event> getEventHandler() {
final EventHandler<Event> actual = super.getEventHandler();
return new EventHandler<Event>() {
@Override
public void handle(Event event) {
synchronized (mutex) {

View File

@ -45,7 +45,7 @@ public class InlineDispatcher extends AsyncDispatcher {
}
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return new TestEventHandler();
}

View File

@ -77,6 +77,7 @@ import org.apache.hadoop.yarn.client.RMProxy;
import org.apache.hadoop.yarn.conf.HAUtil;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
@ -223,7 +224,8 @@ public class TestNodeStatusUpdater {
LOG.info("Got heartbeat number " + heartBeatID);
NodeManagerMetrics mockMetrics = mock(NodeManagerMetrics.class);
Dispatcher mockDispatcher = mock(Dispatcher.class);
EventHandler mockEventHandler = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> mockEventHandler = mock(EventHandler.class);
when(mockDispatcher.getEventHandler()).thenReturn(mockEventHandler);
NMStateStoreService stateStore = new NMNullStateStoreService();
nodeStatus.setResponseId(heartBeatID++);

View File

@ -438,7 +438,7 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
when(container.getLaunchContext()).thenReturn(containerLaunchContext);
when(container.getLocalizedResources()).thenReturn(null);
Dispatcher dispatcher = mock(Dispatcher.class);
EventHandler eventHandler = new EventHandler() {
EventHandler<Event> eventHandler = new EventHandler<Event>() {
public void handle(Event event) {
Assert.assertTrue(event instanceof ContainerExitEvent);
ContainerExitEvent exitEvent = (ContainerExitEvent) event;
@ -602,8 +602,7 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
eventHandler.isContainerExitEventOccured());
}
private static class ContainerExitHandler
implements EventHandler<ContainerEvent> {
private static class ContainerExitHandler implements EventHandler<Event> {
private boolean testForMultiFile;
ContainerExitHandler(boolean testForMultiFile) {
@ -616,7 +615,7 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
return containerExitEventOccured;
}
public void handle(ContainerEvent event) {
public void handle(Event event) {
if (event instanceof ContainerExitEvent) {
containerExitEventOccured = true;
ContainerExitEvent exitEvent = (ContainerExitEvent) event;
@ -1064,7 +1063,8 @@ public class TestContainerLaunch extends BaseContainerManagerTest {
when(container.getLaunchContext()).thenReturn(clc);
when(container.getLocalizedResources()).thenReturn(null);
Dispatcher dispatcher = mock(Dispatcher.class);
EventHandler eventHandler = new EventHandler() {
EventHandler<Event> eventHandler = new EventHandler<Event>() {
@Override
public void handle(Event event) {
Assert.assertTrue(event instanceof ContainerExitEvent);
ContainerExitEvent exitEvent = (ContainerExitEvent) event;

View File

@ -343,8 +343,8 @@ public class TestAppLogAggregatorImpl {
private static Dispatcher createNullDispatcher() {
return new Dispatcher() {
@Override
public EventHandler getEventHandler() {
return new EventHandler() {
public EventHandler<Event> getEventHandler() {
return new EventHandler<Event>() {
@Override
public void handle(Event event) {
// do nothing

View File

@ -157,7 +157,7 @@ public class TestLogAggregationService extends BaseContainerManagerTest {
}
DrainDispatcher dispatcher;
EventHandler<ApplicationEvent> appEventHandler;
EventHandler<Event> appEventHandler;
@Override
@SuppressWarnings("unchecked")

View File

@ -22,6 +22,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEvent;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
@ -29,7 +30,7 @@ import org.apache.hadoop.yarn.util.AbstractLivelinessMonitor;
public class NMLivelinessMonitor extends AbstractLivelinessMonitor<NodeId> {
private EventHandler dispatcher;
private EventHandler<Event> dispatcher;
public NMLivelinessMonitor(Dispatcher d) {
super("NMLivelinessMonitor");

View File

@ -323,7 +323,7 @@ public class RMApplicationHistoryWriter extends CompositeService {
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return new CompositEventHandler();
}

View File

@ -79,7 +79,7 @@ public abstract class AbstractSystemMetricsPublisher extends CompositeService
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return new CompositEventHandler();
}

View File

@ -22,13 +22,14 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.util.AbstractLivelinessMonitor;
import org.apache.hadoop.yarn.util.Clock;
public class AMLivelinessMonitor extends AbstractLivelinessMonitor<ApplicationAttemptId> {
private EventHandler dispatcher;
private EventHandler<Event> dispatcher;
public AMLivelinessMonitor(Dispatcher d) {
super("AMLivelinessMonitor");

View File

@ -892,8 +892,7 @@ public class TestClientRMService {
final CyclicBarrier startBarrier = new CyclicBarrier(2);
final CyclicBarrier endBarrier = new CyclicBarrier(2);
@SuppressWarnings("rawtypes")
EventHandler eventHandler = new EventHandler() {
EventHandler<Event> eventHandler = new EventHandler<Event>() {
@Override
public void handle(Event rawEvent) {
if (rawEvent instanceof RMAppEvent) {
@ -980,7 +979,8 @@ public class TestClientRMService {
throws IOException {
Dispatcher dispatcher = mock(Dispatcher.class);
when(rmContext.getDispatcher()).thenReturn(dispatcher);
EventHandler eventHandler = mock(EventHandler.class);
@SuppressWarnings("unchecked")
EventHandler<Event> eventHandler = mock(EventHandler.class);
when(dispatcher.getEventHandler()).thenReturn(eventHandler);
QueueInfo queInfo = recordFactory.newRecordInstance(QueueInfo.class);
queInfo.setQueueName("testqueue");

View File

@ -58,6 +58,7 @@ import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.AbstractEvent;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent;
@ -561,7 +562,7 @@ public class TestRM extends ParameterizedSchedulerTestBase {
final Dispatcher dispatcher = new DrainDispatcher() {
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
class EventArgMatcher extends ArgumentMatcher<AbstractEvent> {
@Override
@ -642,7 +643,7 @@ public class TestRM extends ParameterizedSchedulerTestBase {
// this dispatcher ignores RMAppAttemptEventType.KILL event
final Dispatcher dispatcher = new DrainDispatcher() {
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
class EventArgMatcher extends ArgumentMatcher<AbstractEvent> {
@Override
@ -696,7 +697,7 @@ public class TestRM extends ParameterizedSchedulerTestBase {
// this dispatcher ignores RMAppAttemptEventType.KILL event
final Dispatcher dispatcher = new DrainDispatcher() {
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
class EventArgMatcher extends ArgumentMatcher<AbstractEvent> {
@Override

View File

@ -761,7 +761,7 @@ public class TestRMHA {
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return null;
}

View File

@ -48,7 +48,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.preempti
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.ContainerPreemptEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy.OrderingPolicy;
import org.apache.hadoop.yarn.util.Clock;
import org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator;
@ -68,9 +67,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.apache.hadoop.yarn.event.Event;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
@ -95,7 +94,7 @@ public class ProportionalCapacityPreemptionPolicyMockFramework {
Clock mClock = null;
CapacitySchedulerConfiguration conf = null;
CapacityScheduler cs = null;
EventHandler<SchedulerEvent> mDisp = null;
EventHandler<Event> mDisp = null;
ProportionalCapacityPreemptionPolicy policy = null;
Resource clusterResource = null;

View File

@ -28,6 +28,7 @@ import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.server.resourcemanager.MockRM;
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
@ -106,7 +107,7 @@ public class TestProportionalCapacityPreemptionPolicy {
CapacityScheduler mCS = null;
RMContext rmContext = null;
RMNodeLabelsManager lm = null;
EventHandler<SchedulerEvent> mDisp = null;
EventHandler<Event> mDisp = null;
ResourceCalculator rc = new DefaultResourceCalculator();
Resource clusterResources = null;
final ApplicationAttemptId appA = ApplicationAttemptId.newInstance(

View File

@ -117,7 +117,7 @@ public class RMStateStoreTestBase {
@SuppressWarnings("rawtypes")
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return this;
}

View File

@ -31,6 +31,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.event.AbstractEvent;
import org.apache.hadoop.yarn.event.Dispatcher;
import org.apache.hadoop.yarn.event.DrainDispatcher;
import org.apache.hadoop.yarn.event.Event;
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.server.resourcemanager.MockAM;
import org.apache.hadoop.yarn.server.resourcemanager.MockNM;
@ -238,7 +239,7 @@ public class TestNodesListManager {
Dispatcher dispatcher = new DrainDispatcher() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
class EventArgMatcher extends ArgumentMatcher<AbstractEvent> {
@Override

View File

@ -3348,7 +3348,7 @@ public class TestCapacityScheduler {
// to have 0 available resource
RMContext spyContext = Mockito.spy(resourceManager.getRMContext());
Dispatcher mockDispatcher = mock(AsyncDispatcher.class);
when(mockDispatcher.getEventHandler()).thenReturn(new EventHandler() {
when(mockDispatcher.getEventHandler()).thenReturn(new EventHandler<Event>() {
@Override
public void handle(Event event) {
if (event instanceof RMNodeResourceUpdateEvent) {

View File

@ -67,6 +67,7 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import com.google.common.collect.Sets;
import org.apache.hadoop.yarn.event.Event;
public class TestUtils {
private static final Log LOG = LogFactory.getLog(TestUtils.class);
@ -90,7 +91,7 @@ public class TestUtils {
EventHandler handler) {
}
@Override
public EventHandler getEventHandler() {
public EventHandler<Event> getEventHandler() {
return handler;
}
};

View File

@ -1180,7 +1180,7 @@ public class TestFifoScheduler {
// to have 0 available resource
RMContext spyContext = Mockito.spy(resourceManager.getRMContext());
Dispatcher mockDispatcher = mock(AsyncDispatcher.class);
when(mockDispatcher.getEventHandler()).thenReturn(new EventHandler() {
when(mockDispatcher.getEventHandler()).thenReturn(new EventHandler<Event>() {
@Override
public void handle(Event event) {
if (event instanceof RMNodeResourceUpdateEvent) {