org.springframework.scheduling.SchedulingAwareRunnable Java Examples

The following examples show how to use org.springframework.scheduling.SchedulingAwareRunnable. 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 File: ConcurrentTaskExecutor.java    From spring-analysis-note with 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 File: ConcurrentTaskExecutor.java    From java-technology-stack with 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 File: ConcurrentTaskExecutor.java    From lams with 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
Source File: ConcurrentTaskExecutor.java    From spring4-understanding with Apache License 2.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 #5
Source File: DelegatingWork.java    From spring-analysis-note with 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 File: DelegatingWork.java    From java-technology-stack with 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 File: DelegatingWork.java    From lams with 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 File: DelegatingWork.java    From spring4-understanding with 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
Source File: RedisHttpSessionConfigurationOverrideSessionTaskExecutors.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@Test
void overrideSessionTaskExecutors() {
	verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
	verify(this.springSessionRedisTaskExecutor, never()).execute(any(Runnable.class));
}
 
Example #10
Source File: RedisHttpSessionConfigurationOverrideSessionTaskExecutor.java    From spring-session with Apache License 2.0 4 votes vote down vote up
@Test
void overrideSessionTaskExecutor() {
	verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
}