YARN-4457. Cleanup unchecked types for EventHandler (templedf via rkanter)
This commit is contained in:
parent
a6410a542e
commit
4b149a1e77
@ -31,6 +31,7 @@
|
||||
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(
|
||||
|
@ -26,6 +26,7 @@
|
||||
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();
|
||||
|
||||
|
@ -1120,7 +1120,7 @@ public Map<JobId, Job> getAllJobs() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return dispatcher.getEventHandler();
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
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());
|
||||
|
@ -103,7 +103,7 @@ public void testKillJob() throws Exception {
|
||||
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() +
|
||||
|
@ -91,7 +91,7 @@ public void testFinshingAttemptTimeout()
|
||||
|
||||
}
|
||||
|
||||
public static class MockEventHandler implements EventHandler {
|
||||
public static class MockEventHandler implements EventHandler<Event> {
|
||||
public boolean timedOut = false;
|
||||
|
||||
@Override
|
||||
|
@ -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.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 void testGetTask() throws IOException {
|
||||
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 void testGetMapCompletionEvents() throws IOException {
|
||||
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 void testCommitWindow() throws IOException {
|
||||
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 void testCheckpointIDTracking()
|
||||
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 void testStatusUpdateProgress()
|
||||
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);
|
||||
|
@ -26,6 +26,7 @@
|
||||
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 Map<JobId, Job> getAllJobs() {
|
||||
return jobs; // OK
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return new MockEventHandler();
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@
|
||||
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 void setup() {
|
||||
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);
|
||||
|
@ -43,6 +43,7 @@
|
||||
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 void testKillAMPreemptPolicy() {
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -71,6 +71,7 @@
|
||||
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 Map<JobId, Job> getAllJobs() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return dispatcher.getEventHandler();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestCommitterEventHandler {
|
||||
public static class WaitForItHandler implements EventHandler {
|
||||
public static class WaitForItHandler implements EventHandler<Event> {
|
||||
|
||||
private Event event = null;
|
||||
|
||||
|
@ -167,8 +167,8 @@ public static TaskAttemptId makeTaskAttemptId(long ts, int appId, int taskId,
|
||||
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 void testHandle() throws Exception {
|
||||
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 void testMyShutdown() throws Exception {
|
||||
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 =
|
||||
|
@ -247,8 +247,8 @@ private static AppContext createAppContext() {
|
||||
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);
|
||||
|
@ -47,6 +47,7 @@
|
||||
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 ApplicationId getApplicationID() {
|
||||
|
||||
// TODO AppContext - Not Required
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
@ -1570,6 +1570,7 @@
|
||||
<target>${javac.version}</target>
|
||||
<compilerArguments>
|
||||
<Xlint/>
|
||||
<Xlint:-unchecked/>
|
||||
<Xmaxwarns>9999</Xmaxwarns>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
|
@ -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 void register(Class<? extends Enum> eventType,
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return handlerInstance;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -89,9 +89,9 @@ public void run() {
|
||||
|
||||
@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) {
|
||||
|
@ -45,7 +45,7 @@ protected void dispatch(Event event) {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return new TestEventHandler();
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,7 @@
|
||||
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 NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
|
||||
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++);
|
||||
|
@ -438,7 +438,7 @@ public void testPrependDistcache() throws Exception {
|
||||
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 @@ private void verifyTailErrorLogOnContainerExit(Configuration conf,
|
||||
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 boolean isContainerExitEventOccured() {
|
||||
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 void testCallFailureWithNullLocalizedResources() {
|
||||
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;
|
||||
|
@ -343,8 +343,8 @@ private static void verifyFilesToDelete(Set<String> files2ToDelete,
|
||||
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
|
||||
|
@ -157,7 +157,7 @@ public TestLogAggregationService() throws UnsupportedFileSystemException {
|
||||
}
|
||||
|
||||
DrainDispatcher dispatcher;
|
||||
EventHandler<ApplicationEvent> appEventHandler;
|
||||
EventHandler<Event> appEventHandler;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -22,6 +22,7 @@
|
||||
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 @@
|
||||
|
||||
public class NMLivelinessMonitor extends AbstractLivelinessMonitor<NodeId> {
|
||||
|
||||
private EventHandler dispatcher;
|
||||
private EventHandler<Event> dispatcher;
|
||||
|
||||
public NMLivelinessMonitor(Dispatcher d) {
|
||||
super("NMLivelinessMonitor");
|
||||
|
@ -323,7 +323,7 @@ public MultiThreadedDispatcher(int num) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return new CompositEventHandler();
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public MultiThreadedDispatcher(int num) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return new CompositEventHandler();
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,14 @@
|
||||
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");
|
||||
|
@ -892,8 +892,7 @@ public void testConcurrentAppSubmit()
|
||||
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 @@ private void mockRMContext(YarnScheduler yarnScheduler, RMContext rmContext)
|
||||
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");
|
||||
|
@ -58,6 +58,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.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 void testApplicationKillAtAcceptedState() throws Exception {
|
||||
|
||||
final Dispatcher dispatcher = new DrainDispatcher() {
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
|
||||
class EventArgMatcher extends ArgumentMatcher<AbstractEvent> {
|
||||
@Override
|
||||
@ -642,7 +643,7 @@ public void testKillFinishingApp() throws Exception{
|
||||
// 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 void testKillFailingApp() throws Exception{
|
||||
// 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
|
||||
|
@ -761,7 +761,7 @@ public MyCountingDispatcher() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@
|
||||
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.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;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
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(
|
||||
|
@ -117,7 +117,7 @@ public void handle(Event event) {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
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 @@ private Dispatcher getDispatcher() {
|
||||
Dispatcher dispatcher = new DrainDispatcher() {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
|
||||
class EventArgMatcher extends ArgumentMatcher<AbstractEvent> {
|
||||
@Override
|
||||
|
@ -3348,7 +3348,7 @@ public void testResourceUpdateDecommissioningNode() throws Exception {
|
||||
// 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) {
|
||||
|
@ -67,6 +67,7 @@
|
||||
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 void register(Class<? extends Enum> eventType,
|
||||
EventHandler handler) {
|
||||
}
|
||||
@Override
|
||||
public EventHandler getEventHandler() {
|
||||
public EventHandler<Event> getEventHandler() {
|
||||
return handler;
|
||||
}
|
||||
};
|
||||
|
@ -1180,7 +1180,7 @@ public void testResourceUpdateDecommissioningNode() throws Exception {
|
||||
// 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user