Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Jun 26, 2014
1 parent 3506779 commit 98d6f7b
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
* @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";

Expand Down Expand Up @@ -706,7 +706,7 @@ public boolean isSingleton() {


//---------------------------------------------------------------------
// Implementation of Lifecycle interface
// Implementation of SmartLifecycle interface
//---------------------------------------------------------------------

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public SettableListenableFuture() {
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
Expand Down Expand Up @@ -135,7 +136,6 @@ public T get(long timeout, TimeUnit unit) throws InterruptedException, Execution
* 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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -58,7 +58,7 @@
* @see #doShutdown()
*/
public abstract class AbstractJmsListeningContainer extends JmsDestinationAccessor
implements SmartLifecycle, BeanNameAware, DisposableBean {
implements BeanNameAware, DisposableBean, SmartLifecycle {

private String clientId;

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -37,7 +37,7 @@
*
* @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 {

Expand All @@ -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());
Expand All @@ -72,7 +75,8 @@ public URI getURI() {
@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()) {
Expand All @@ -81,11 +85,9 @@ public ClientHttpResponse call() throws Exception {
connection.addRequestProperty(headerName, headerValue);
}
}

if (connection.getDoOutput() && outputStreaming) {
connection.setFixedLengthStreamingMode(bufferedOutput.length);
}

connection.connect();
if (connection.getDoOutput()) {
FileCopyUtils.copy(bufferedOutput, connection.getOutputStream());
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -33,13 +33,12 @@

/**
* {@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 {

Expand All @@ -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());
Expand Down Expand Up @@ -106,8 +108,7 @@ private void writeHeaders(HttpHeaders headers) {
}

@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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,11 @@
@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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ protected ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandle
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;
}
};
Expand All @@ -142,8 +142,8 @@ public WebSocketSession call() throws Exception {

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;
}
Expand Down

0 comments on commit 98d6f7b

Please sign in to comment.