use of io.datarouter.storage.config.properties.ServerName in project datarouter by hotpads.
the class JobHandler method list.
@Handler
Mav list(OptionalString category, OptionalString keyword, OptionalBoolean enabled, OptionalBoolean disabled) {
Optional<String> message = params.optional("jobTriggerResponseMessage");
Mav mav = new Mav(files.jsp.admin.datarouter.job.triggersJsp);
if (message.isPresent()) {
mav.put("message", message.get());
}
Optional<String> jobCategoryName = category.getOptional();
boolean hideEnabled = enabled.orElse(false);
boolean hideDisabled = disabled.orElse(false);
mav.put("serverName", serverName.get());
mav.put("categoryRows", getJobCategoryDtos(jobCategoryName));
LongRunningTaskSummaryDto longRunningTaskSummary = longRunningTaskService.getSummary();
AtomicInteger rowId = new AtomicInteger();
List<TriggerJspDto> triggerRows = jobPackageFilter.streamMatches(jobCategoryName.orElse(""), keyword.orElse(""), hideEnabled, hideDisabled).map(jobClass -> jobToTriggerJspDto(rowId.incrementAndGet(), jobClass, longRunningTaskSummary)).collect(Collectors.toList());
mav.put("triggerRows", triggerRows);
mav.put("legend", LongRunningTasksHandler.legend().renderFormatted());
return mav;
}
use of io.datarouter.storage.config.properties.ServerName in project datarouter by hotpads.
the class JobStopperService method requestStop.
/**
* generates requests to stop a job running on the specified servers in the cluster. the requests are not processed
* until {@link JobStopperService#stopRequestedLocalJobs} is called (see {@link DatarouterJobStopperJob})
* @param jobName the name of the job (class) to stop
* @param serverNames the servers on which to attempt to stop the job
* @param username the username that requested the stop
*/
public void requestStop(String jobName, List<String> serverNames, String username) {
Instant jobTriggerDeadline = Instant.now();
Instant requestExpiration = jobTriggerDeadline.plus(3L, ChronoUnit.MINUTES);
Scanner.of(serverNames).map(serverName -> new StopJobRequest(serverName, requestExpiration, jobTriggerDeadline, jobName, username)).flush(stopJobRequestDao::putMulti);
}
use of io.datarouter.storage.config.properties.ServerName in project datarouter by hotpads.
the class TraceFilter method init.
@Override
public void init(FilterConfig filterConfig) {
DatarouterInjector injector = getInjector(filterConfig.getServletContext());
serverName = injector.getInstance(ServerName.class);
trace2BufferForLocal = injector.getInstance(Trace2ForLocalFilterToMemoryBuffer.class);
trace2BufferForPublisher = injector.getInstance(Trace2ForPublisherFilterToMemoryBuffer.class);
traceSettings = injector.getInstance(DatarouterTraceFilterSettingRoot.class);
urlBuilder = injector.getInstance(TraceUrlBuilder.class);
currentSessionInfo = injector.getInstance(CurrentSessionInfo.class);
handlerMetrics = injector.getInstance(HandlerMetrics.class);
serviceName = injector.getInstance(ServiceName.class);
}
Aggregations