Polishing
This commit is contained in:
parent
35067790f3
commit
98d6f7b443
|
@ -85,8 +85,8 @@ import org.springframework.util.CollectionUtils;
|
|||
* @see org.quartz.impl.StdSchedulerFactory
|
||||
* @see org.springframework.transaction.interceptor.TransactionProxyFactoryBean
|
||||
*/
|
||||
public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBean<Scheduler>, BeanNameAware,
|
||||
ApplicationContextAware, InitializingBean, DisposableBean, SmartLifecycle {
|
||||
public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBean<Scheduler>,
|
||||
BeanNameAware, ApplicationContextAware, InitializingBean, DisposableBean, SmartLifecycle {
|
||||
|
||||
public static final String PROP_THREAD_COUNT = "org.quartz.threadPool.threadCount";
|
||||
|
||||
|
@ -706,7 +706,7 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe
|
|||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Implementation of Lifecycle interface
|
||||
// Implementation of SmartLifecycle interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,6 +47,7 @@ public class SettableListenableFuture<T> implements ListenableFuture<T> {
|
|||
this.listenableFuture = new ListenableFutureTask<T>(this.settableTask);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value of this future. This method will return {@code true} if
|
||||
* the value was set successfully, or {@code false} if the future has already
|
||||
|
@ -135,7 +136,6 @@ public class SettableListenableFuture<T> implements ListenableFuture<T> {
|
|||
* Subclasses can override this method to implement interruption of the future's
|
||||
* computation. The method is invoked automatically by a successful call to
|
||||
* {@link #cancel(boolean) cancel(true)}.
|
||||
*
|
||||
* <p>The default implementation does nothing.
|
||||
*/
|
||||
protected void interruptTask() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -58,7 +58,7 @@ import org.springframework.util.ClassUtils;
|
|||
* @see #doShutdown()
|
||||
*/
|
||||
public abstract class AbstractJmsListeningContainer extends JmsDestinationAccessor
|
||||
implements SmartLifecycle, BeanNameAware, DisposableBean {
|
||||
implements BeanNameAware, DisposableBean, SmartLifecycle {
|
||||
|
||||
private String clientId;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -37,7 +37,7 @@ import org.springframework.util.concurrent.ListenableFuture;
|
|||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.0
|
||||
* @see org.springframework.http.client.SimpleClientHttpRequestFactory#createRequest(java.net.URI, org.springframework.http.HttpMethod)
|
||||
* @see org.springframework.http.client.SimpleClientHttpRequestFactory#createRequest
|
||||
*/
|
||||
final class SimpleBufferingAsyncClientHttpRequest extends AbstractBufferingAsyncClientHttpRequest {
|
||||
|
||||
|
@ -47,13 +47,16 @@ final class SimpleBufferingAsyncClientHttpRequest extends AbstractBufferingAsync
|
|||
|
||||
private final AsyncListenableTaskExecutor taskExecutor;
|
||||
|
||||
|
||||
SimpleBufferingAsyncClientHttpRequest(HttpURLConnection connection,
|
||||
boolean outputStreaming, AsyncListenableTaskExecutor taskExecutor) {
|
||||
|
||||
this.connection = connection;
|
||||
this.outputStreaming = outputStreaming;
|
||||
this.taskExecutor = taskExecutor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HttpMethod getMethod() {
|
||||
return HttpMethod.valueOf(this.connection.getRequestMethod());
|
||||
|
@ -72,7 +75,8 @@ final class SimpleBufferingAsyncClientHttpRequest extends AbstractBufferingAsync
|
|||
@Override
|
||||
protected ListenableFuture<ClientHttpResponse> executeInternal(
|
||||
final HttpHeaders headers, final byte[] bufferedOutput) throws IOException {
|
||||
return taskExecutor.submitListenable(new Callable<ClientHttpResponse>() {
|
||||
|
||||
return this.taskExecutor.submitListenable(new Callable<ClientHttpResponse>() {
|
||||
@Override
|
||||
public ClientHttpResponse call() throws Exception {
|
||||
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
|
@ -81,11 +85,9 @@ final class SimpleBufferingAsyncClientHttpRequest extends AbstractBufferingAsync
|
|||
connection.addRequestProperty(headerName, headerValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (connection.getDoOutput() && outputStreaming) {
|
||||
connection.setFixedLengthStreamingMode(bufferedOutput.length);
|
||||
}
|
||||
|
||||
connection.connect();
|
||||
if (connection.getDoOutput()) {
|
||||
FileCopyUtils.copy(bufferedOutput, connection.getOutputStream());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -33,13 +33,12 @@ import org.springframework.util.concurrent.ListenableFuture;
|
|||
|
||||
/**
|
||||
* {@link org.springframework.http.client.ClientHttpRequest} implementation that uses
|
||||
* standard J2SE facilities to execute streaming requests. Created via the {@link
|
||||
* standard Java facilities to execute streaming requests. Created via the {@link
|
||||
* org.springframework.http.client.SimpleClientHttpRequestFactory}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see org.springframework.http.client.SimpleClientHttpRequestFactory#createRequest(java.net.URI,
|
||||
* org.springframework.http.HttpMethod)
|
||||
* @since 3.0
|
||||
* @see org.springframework.http.client.SimpleClientHttpRequestFactory#createRequest
|
||||
*/
|
||||
final class SimpleStreamingAsyncClientHttpRequest extends AbstractAsyncClientHttpRequest {
|
||||
|
||||
|
@ -53,14 +52,17 @@ final class SimpleStreamingAsyncClientHttpRequest extends AbstractAsyncClientHtt
|
|||
|
||||
private final AsyncListenableTaskExecutor taskExecutor;
|
||||
|
||||
|
||||
SimpleStreamingAsyncClientHttpRequest(HttpURLConnection connection, int chunkSize,
|
||||
boolean outputStreaming, AsyncListenableTaskExecutor taskExecutor) {
|
||||
|
||||
this.connection = connection;
|
||||
this.chunkSize = chunkSize;
|
||||
this.outputStreaming = outputStreaming;
|
||||
this.taskExecutor = taskExecutor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HttpMethod getMethod() {
|
||||
return HttpMethod.valueOf(this.connection.getRequestMethod());
|
||||
|
@ -106,8 +108,7 @@ final class SimpleStreamingAsyncClientHttpRequest extends AbstractAsyncClientHtt
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ListenableFuture<ClientHttpResponse> executeInternal(final HttpHeaders headers)
|
||||
throws IOException {
|
||||
protected ListenableFuture<ClientHttpResponse> executeInternal(final HttpHeaders headers) throws IOException {
|
||||
return taskExecutor.submitListenable(new Callable<ClientHttpResponse>() {
|
||||
@Override
|
||||
public ClientHttpResponse call() throws Exception {
|
||||
|
|
|
@ -266,13 +266,11 @@ import java.util.concurrent.Callable;
|
|||
@Mapping
|
||||
public @interface RequestMapping {
|
||||
|
||||
|
||||
/**
|
||||
* Assign a name to this mapping.
|
||||
* <p><b>Supported at the method and also at type level!</b>
|
||||
* When used on both levels, a combined name is derived by
|
||||
* concatenation with "#" as separator.
|
||||
*
|
||||
* <p><b>Supported at the type level as well as at the method level!</b>
|
||||
* When used on both levels, a combined name is derived by concatenation
|
||||
* with "#" as separator.
|
||||
* @see org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder
|
||||
* @see org.springframework.web.servlet.handler.HandlerMethodMappingNamingStrategy
|
||||
*/
|
||||
|
|
|
@ -116,16 +116,16 @@ public class StandardWebSocketClient extends AbstractWebSocketClient {
|
|||
final StandardWebSocketSession session = new StandardWebSocketSession(headers,
|
||||
attributes, localAddress, remoteAddress);
|
||||
|
||||
final ClientEndpointConfig.Builder configBuidler = ClientEndpointConfig.Builder.create();
|
||||
configBuidler.configurator(new StandardWebSocketClientConfigurator(headers));
|
||||
configBuidler.preferredSubprotocols(protocols);
|
||||
configBuidler.extensions(adaptExtensions(extensions));
|
||||
final ClientEndpointConfig.Builder configBuilder = ClientEndpointConfig.Builder.create();
|
||||
configBuilder.configurator(new StandardWebSocketClientConfigurator(headers));
|
||||
configBuilder.preferredSubprotocols(protocols);
|
||||
configBuilder.extensions(adaptExtensions(extensions));
|
||||
final Endpoint endpoint = new StandardWebSocketHandlerAdapter(webSocketHandler, session);
|
||||
|
||||
Callable<WebSocketSession> connectTask = new Callable<WebSocketSession>() {
|
||||
@Override
|
||||
public WebSocketSession call() throws Exception {
|
||||
webSocketContainer.connectToServer(endpoint, configBuidler.build(), uri);
|
||||
webSocketContainer.connectToServer(endpoint, configBuilder.build(), uri);
|
||||
return session;
|
||||
}
|
||||
};
|
||||
|
@ -142,8 +142,8 @@ public class StandardWebSocketClient extends AbstractWebSocketClient {
|
|||
|
||||
private static List<Extension> adaptExtensions(List<WebSocketExtension> extensions) {
|
||||
List<Extension> result = new ArrayList<Extension>();
|
||||
for (WebSocketExtension e : extensions) {
|
||||
result.add(new WebSocketToStandardExtensionAdapter(e));
|
||||
for (WebSocketExtension extension : extensions) {
|
||||
result.add(new WebSocketToStandardExtensionAdapter(extension));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue