Browse Source

Polishing

pull/543/merge
Juergen Hoeller 11 years ago
parent
commit
98d6f7b443
  1. 6
      spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java
  2. 2
      spring-core/src/main/java/org/springframework/util/concurrent/SettableListenableFuture.java
  3. 4
      spring-jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java
  4. 12
      spring-web/src/main/java/org/springframework/http/client/SimpleBufferingAsyncClientHttpRequest.java
  5. 13
      spring-web/src/main/java/org/springframework/http/client/SimpleStreamingAsyncClientHttpRequest.java
  6. 8
      spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java
  7. 14
      spring-websocket/src/main/java/org/springframework/web/socket/client/standard/StandardWebSocketClient.java

6
spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java

@ -85,8 +85,8 @@ import org.springframework.util.CollectionUtils; @@ -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 @@ -706,7 +706,7 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe
//---------------------------------------------------------------------
// Implementation of Lifecycle interface
// Implementation of SmartLifecycle interface
//---------------------------------------------------------------------
@Override

2
spring-core/src/main/java/org/springframework/util/concurrent/SettableListenableFuture.java

@ -47,6 +47,7 @@ public class SettableListenableFuture<T> implements ListenableFuture<T> { @@ -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> { @@ -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() {

4
spring-jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java

@ -1,5 +1,5 @@ @@ -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; @@ -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;

12
spring-web/src/main/java/org/springframework/http/client/SimpleBufferingAsyncClientHttpRequest.java

@ -1,5 +1,5 @@ @@ -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; @@ -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 @@ -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 @@ -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 @@ -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());

13
spring-web/src/main/java/org/springframework/http/client/SimpleStreamingAsyncClientHttpRequest.java

@ -1,5 +1,5 @@ @@ -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; @@ -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 @@ -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 @@ -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 {

8
spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMapping.java

@ -266,13 +266,11 @@ import java.util.concurrent.Callable; @@ -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
*/

14
spring-websocket/src/main/java/org/springframework/web/socket/client/standard/StandardWebSocketClient.java

@ -116,16 +116,16 @@ public class StandardWebSocketClient extends AbstractWebSocketClient { @@ -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 { @@ -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…
Cancel
Save