Java Code Examples for org.springframework.scheduling.SchedulingAwareRunnable

The following examples show how to use org.springframework.scheduling.SchedulingAwareRunnable. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: ConcurrentTaskExecutor.java    License: MIT License 5 votes vote down vote up
public static Runnable buildManagedTask(Runnable task, String identityName) {
	Map<String, String> properties;
	if (task instanceof SchedulingAwareRunnable) {
		properties = new HashMap<>(4);
		properties.put(ManagedTask.LONGRUNNING_HINT,
				Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
	}
	else {
		properties = new HashMap<>(2);
	}
	properties.put(ManagedTask.IDENTITY_NAME, identityName);
	return ManagedExecutors.managedTask(task, properties, null);
}
 
Example 2
Source Project: java-technology-stack   Source File: ConcurrentTaskExecutor.java    License: MIT License 5 votes vote down vote up
public static Runnable buildManagedTask(Runnable task, String identityName) {
	Map<String, String> properties;
	if (task instanceof SchedulingAwareRunnable) {
		properties = new HashMap<>(4);
		properties.put(ManagedTask.LONGRUNNING_HINT,
				Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
	}
	else {
		properties = new HashMap<>(2);
	}
	properties.put(ManagedTask.IDENTITY_NAME, identityName);
	return ManagedExecutors.managedTask(task, properties, null);
}
 
Example 3
Source Project: lams   Source File: ConcurrentTaskExecutor.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static Runnable buildManagedTask(Runnable task, String identityName) {
	Map<String, String> properties = new HashMap<String, String>(2);
	if (task instanceof SchedulingAwareRunnable) {
		properties.put(ManagedTask.LONGRUNNING_HINT,
				Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
	}
	properties.put(ManagedTask.IDENTITY_NAME, identityName);
	return ManagedExecutors.managedTask(task, properties, null);
}
 
Example 4
public static Runnable buildManagedTask(Runnable task, String identityName) {
	Map<String, String> properties = new HashMap<String, String>(2);
	if (task instanceof SchedulingAwareRunnable) {
		properties.put(ManagedTask.LONGRUNNING_HINT,
				Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
	}
	properties.put(ManagedTask.IDENTITY_NAME, identityName);
	return ManagedExecutors.managedTask(task, properties, null);
}
 
Example 5
Source Project: spring-analysis-note   Source File: DelegatingWork.java    License: MIT License 4 votes vote down vote up
/**
 * This implementation delegates to
 * {@link org.springframework.scheduling.SchedulingAwareRunnable#isLongLived()},
 * if available.
 */
@Override
public boolean isDaemon() {
	return (this.delegate instanceof SchedulingAwareRunnable &&
			((SchedulingAwareRunnable) this.delegate).isLongLived());
}
 
Example 6
Source Project: java-technology-stack   Source File: DelegatingWork.java    License: MIT License 4 votes vote down vote up
/**
 * This implementation delegates to
 * {@link org.springframework.scheduling.SchedulingAwareRunnable#isLongLived()},
 * if available.
 */
@Override
public boolean isDaemon() {
	return (this.delegate instanceof SchedulingAwareRunnable &&
			((SchedulingAwareRunnable) this.delegate).isLongLived());
}
 
Example 7
Source Project: lams   Source File: DelegatingWork.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * This implementation delegates to
 * {@link org.springframework.scheduling.SchedulingAwareRunnable#isLongLived()},
 * if available.
 */
@Override
public boolean isDaemon() {
	return (this.delegate instanceof SchedulingAwareRunnable &&
			((SchedulingAwareRunnable) this.delegate).isLongLived());
}
 
Example 8
Source Project: spring4-understanding   Source File: DelegatingWork.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * This implementation delegates to
 * {@link org.springframework.scheduling.SchedulingAwareRunnable#isLongLived()},
 * if available.
 */
@Override
public boolean isDaemon() {
	return (this.delegate instanceof SchedulingAwareRunnable &&
			((SchedulingAwareRunnable) this.delegate).isLongLived());
}
 
Example 9
@Test
void overrideSessionTaskExecutors() {
	verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
	verify(this.springSessionRedisTaskExecutor, never()).execute(any(Runnable.class));
}
 
Example 10
@Test
void overrideSessionTaskExecutor() {
	verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
}