@@ -123,7 +123,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
/** Resolution strategy for expressions in bean definition values */
|
||||
private BeanExpressionResolver beanExpressionResolver;
|
||||
|
||||
/** Spring 3.0 ConversionService to use instead of PropertyEditors */
|
||||
/** Spring ConversionService to use instead of PropertyEditors */
|
||||
private ConversionService conversionService;
|
||||
|
||||
/** Custom PropertyEditorRegistrars to apply to the beans of this factory */
|
||||
@@ -159,10 +159,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
private final Map<String, RootBeanDefinition> mergedBeanDefinitions =
|
||||
new ConcurrentHashMap<String, RootBeanDefinition>(64);
|
||||
|
||||
/**
|
||||
* Names of beans that have already been created at least once
|
||||
* (using a ConcurrentHashMap as a Set)
|
||||
*/
|
||||
/** Names of beans that have already been created at least once */
|
||||
private final Map<String, Boolean> alreadyCreated = new ConcurrentHashMap<String, Boolean>(64);
|
||||
|
||||
/** Names of beans that are currently in creation */
|
||||
@@ -503,8 +500,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
// Retrieve corresponding bean definition.
|
||||
RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);
|
||||
|
||||
Class[] typesToMatch = (FactoryBean.class.equals(typeToMatch) ?
|
||||
new Class[] {typeToMatch} : new Class[] {FactoryBean.class, typeToMatch});
|
||||
Class<?>[] typesToMatch = (FactoryBean.class.equals(typeToMatch) ?
|
||||
new Class<?>[] {typeToMatch} : new Class<?>[] {FactoryBean.class, typeToMatch});
|
||||
|
||||
// Check decorated bean definition, if any: We assume it'll be easier
|
||||
// to determine the decorated bean's type than the proxy's type.
|
||||
|
||||
@@ -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.
|
||||
@@ -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";
|
||||
|
||||
@@ -698,7 +698,7 @@ public class SchedulerFactoryBean extends SchedulerAccessor implements FactoryBe
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Implementation of Lifecycle interface
|
||||
// Implementation of SmartLifecycle interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public void start() throws SchedulingException {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2009 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.
|
||||
@@ -13,45 +13,47 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Iterator that combines multiple other iterators.
|
||||
* This implementation maintains a list of iterators which are invoked in sequence until all iterators are exhausted.
|
||||
* Composite iterator that combines multiple other iterators,
|
||||
* as registered via {@link #add(Iterator)}.
|
||||
*
|
||||
* <p>This implementation maintains a linked set of iterators
|
||||
* which are invoked in sequence until all iterators are exhausted.
|
||||
*
|
||||
* @author Erwin Vervaet
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.0
|
||||
*/
|
||||
public class CompositeIterator<E> implements Iterator<E> {
|
||||
|
||||
private List<Iterator<E>> iterators = new LinkedList<Iterator<E>>();
|
||||
private final Set<Iterator<E>> iterators = new LinkedHashSet<Iterator<E>>();
|
||||
|
||||
private boolean inUse = false;
|
||||
|
||||
/**
|
||||
* Create a new composite iterator. Add iterators using the {@link #add(Iterator)} method.
|
||||
*/
|
||||
public CompositeIterator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add given iterator to this composite.
|
||||
*/
|
||||
public void add(Iterator<E> iterator) {
|
||||
Assert.state(!inUse, "You can no longer add iterator to a composite iterator that's already in use");
|
||||
if (iterators.contains(iterator)) {
|
||||
Assert.state(!this.inUse, "You can no longer add iterators to a composite iterator that's already in use");
|
||||
if (this.iterators.contains(iterator)) {
|
||||
throw new IllegalArgumentException("You cannot add the same iterator twice");
|
||||
}
|
||||
iterators.add(iterator);
|
||||
this.iterators.add(iterator);
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
inUse = true;
|
||||
for (Iterator<Iterator<E>> it = iterators.iterator(); it.hasNext();) {
|
||||
if (it.next().hasNext()) {
|
||||
this.inUse = true;
|
||||
for (Iterator<E> iterator : this.iterators) {
|
||||
if (iterator.hasNext()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -59,17 +61,17 @@ public class CompositeIterator<E> implements Iterator<E> {
|
||||
}
|
||||
|
||||
public E next() {
|
||||
inUse = true;
|
||||
for (Iterator<Iterator<E>> it = iterators.iterator(); it.hasNext();) {
|
||||
Iterator<E> iterator = it.next();
|
||||
this.inUse = true;
|
||||
for (Iterator<E> iterator : this.iterators) {
|
||||
if (iterator.hasNext()) {
|
||||
return iterator.next();
|
||||
}
|
||||
}
|
||||
throw new NoSuchElementException("Exhaused all iterators");
|
||||
throw new NoSuchElementException("All iterators exhausted");
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Remove is not supported");
|
||||
throw new UnsupportedOperationException("CompositeIterator does not support remove()");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -224,23 +224,23 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
@Override
|
||||
public V get(Object key) {
|
||||
Reference<K, V> reference = getReference(key, Restructure.WHEN_NECESSARY);
|
||||
Entry<K, V> entry = (reference == null ? null : reference.get());
|
||||
Entry<K, V> entry = (reference != null ? reference.get() : null);
|
||||
return (entry != null ? entry.getValue() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
Reference<K, V> reference = getReference(key, Restructure.WHEN_NECESSARY);
|
||||
Entry<K, V> entry = (reference == null ? null : reference.get());
|
||||
Entry<K, V> entry = (reference != null ? reference.get() : null);
|
||||
return (entry != null && ObjectUtils.nullSafeEquals(entry.getKey(), key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Reference} to the {@link Entry} for the specified {@code key} or
|
||||
* {@code null} if not found.
|
||||
* Return a {@link Reference} to the {@link Entry} for the specified {@code key},
|
||||
* or {@code null} if not found.
|
||||
* @param key the key (can be {@code null})
|
||||
* @param restructure types of restructure allowed during this call
|
||||
* @return the reference or {@code null}
|
||||
* @return the reference, or {@code null} if not found
|
||||
*/
|
||||
protected final Reference<K, V> getReference(Object key, Restructure restructure) {
|
||||
int hash = getHash(key);
|
||||
@@ -396,14 +396,10 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
*/
|
||||
public static enum ReferenceType {
|
||||
|
||||
/**
|
||||
* Use {@link SoftReference}s.
|
||||
*/
|
||||
/** Use {@link SoftReference}s */
|
||||
SOFT,
|
||||
|
||||
/**
|
||||
* Use {@link WeakReference}s.
|
||||
*/
|
||||
/** Use {@link WeakReference}s */
|
||||
WEAK
|
||||
}
|
||||
|
||||
@@ -458,8 +454,8 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply an update operation to this segment. The segment will be locked
|
||||
* during update.
|
||||
* Apply an update operation to this segment.
|
||||
* The segment will be locked during the update.
|
||||
* @param hash the hash of the key
|
||||
* @param key the key
|
||||
* @param task the update operation
|
||||
@@ -470,7 +466,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
if (task.hasOption(TaskOption.RESTRUCTURE_BEFORE)) {
|
||||
restructureIfNecessary(resize);
|
||||
}
|
||||
if (task.hasOption(TaskOption.SKIP_IF_EMPTY) && (this.count == 0)) {
|
||||
if (task.hasOption(TaskOption.SKIP_IF_EMPTY) && this.count == 0) {
|
||||
return task.execute(null, null, null);
|
||||
}
|
||||
lock();
|
||||
@@ -478,12 +474,12 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
final int index = getIndex(hash, this.references);
|
||||
final Reference<K, V> head = this.references[index];
|
||||
Reference<K, V> reference = findInChain(head, key, hash);
|
||||
Entry<K, V> entry = (reference == null ? null : reference.get());
|
||||
Entry<K, V> entry = (reference != null ? reference.get() : null);
|
||||
Entries entries = new Entries() {
|
||||
@Override
|
||||
public void add(V value) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Entry<K, V> newEntry = new Entry<K, V>((K)key, value);
|
||||
Entry<K, V> newEntry = new Entry<K, V>((K) key, value);
|
||||
Reference<K, V> newReference = Segment.this.referenceManager.createReference(newEntry, hash, head);
|
||||
Segment.this.references[index] = newReference;
|
||||
Segment.this.count++;
|
||||
@@ -510,7 +506,8 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
try {
|
||||
setReferences(createReferenceArray(this.initialSize));
|
||||
this.count = 0;
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
@@ -541,16 +538,16 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
|
||||
// Recalculate taking into account count inside lock and items that
|
||||
// will be purged
|
||||
needsResize = ((countAfterRestructure > 0) && (countAfterRestructure >= this.resizeThreshold));
|
||||
needsResize = (countAfterRestructure > 0 && countAfterRestructure >= this.resizeThreshold);
|
||||
boolean resizing = false;
|
||||
int restructureSize = this.references.length;
|
||||
if (allowResize && needsResize && (restructureSize < MAXIMUM_SEGMENT_SIZE)) {
|
||||
if (allowResize && needsResize && restructureSize < MAXIMUM_SEGMENT_SIZE) {
|
||||
restructureSize <<= 1;
|
||||
resizing = true;
|
||||
}
|
||||
|
||||
// Either create a new table or reuse the existing one
|
||||
Reference<K, V>[] restructured = (resizing ? createReferenceArray(restructureSize) : this.references);
|
||||
Reference<K, V>[] restructured = (resizing ? createReferenceArray(restructureSize) : this.references);
|
||||
|
||||
// Restructure
|
||||
for (int i = 0; i < this.references.length; i++) {
|
||||
@@ -574,7 +571,8 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
setReferences(restructured);
|
||||
}
|
||||
this.count = Math.max(countAfterRestructure, 0);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
@@ -602,7 +600,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
}
|
||||
|
||||
private int getIndex(int hash, Reference<K, V>[] references) {
|
||||
return hash & (references.length - 1);
|
||||
return (hash & (references.length - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -693,27 +691,26 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.key + "=" + this.value;
|
||||
return (this.key + "=" + this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public final boolean equals(Object o) {
|
||||
if (o == this) {
|
||||
public final boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (o != null && o instanceof Map.Entry) {
|
||||
Map.Entry other = (Map.Entry) o;
|
||||
return ObjectUtils.nullSafeEquals(getKey(), other.getKey())
|
||||
&& ObjectUtils.nullSafeEquals(getValue(), other.getValue());
|
||||
if (!(other instanceof Map.Entry)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
Map.Entry otherEntry = (Map.Entry) other;
|
||||
return (ObjectUtils.nullSafeEquals(getKey(), otherEntry.getKey()) &&
|
||||
ObjectUtils.nullSafeEquals(getValue(), otherEntry.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(this.key)
|
||||
^ ObjectUtils.nullSafeHashCode(this.value);
|
||||
return (ObjectUtils.nullSafeHashCode(this.key) ^ ObjectUtils.nullSafeHashCode(this.value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,7 +792,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
if (o != null && o instanceof Map.Entry<?, ?>) {
|
||||
Map.Entry<?, ?> entry = (java.util.Map.Entry<?, ?>) o;
|
||||
Reference<K, V> reference = ConcurrentReferenceHashMap.this.getReference(entry.getKey(), Restructure.NEVER);
|
||||
Entry<K, V> other = (reference == null ? null : reference.get());
|
||||
Entry<K, V> other = (reference != null ? reference.get() : null);
|
||||
if (other != null) {
|
||||
return ObjectUtils.nullSafeEquals(entry.getValue(), other.getValue());
|
||||
}
|
||||
@@ -847,7 +844,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
|
||||
public boolean hasNext() {
|
||||
getNextIfNecessary();
|
||||
return this.next != null;
|
||||
return (this.next != null);
|
||||
}
|
||||
|
||||
public Entry<K, V> next() {
|
||||
@@ -974,7 +971,6 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
enqueue();
|
||||
clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1005,7 +1001,6 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
enqueue();
|
||||
clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -5,29 +21,36 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
/**
|
||||
* Test case for {@link CompositeIterator}.
|
||||
*
|
||||
* @author Erwin Vervaet
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class CompositeIteratorTests extends TestCase {
|
||||
public class CompositeIteratorTests {
|
||||
|
||||
@Test
|
||||
public void testNoIterators() {
|
||||
CompositeIterator it = new CompositeIterator();
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
}
|
||||
catch (NoSuchElementException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleIterator() {
|
||||
CompositeIterator it = new CompositeIterator();
|
||||
it.add(Arrays.asList(new String[] { "0", "1" }).iterator());
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(Arrays.asList("0", "1").iterator());
|
||||
for (int i = 0; i < 2; i++) {
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(String.valueOf(i), it.next());
|
||||
@@ -36,16 +59,18 @@ public class CompositeIteratorTests extends TestCase {
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
}
|
||||
catch (NoSuchElementException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleIterators() {
|
||||
CompositeIterator it = new CompositeIterator();
|
||||
it.add(Arrays.asList(new String[] { "0", "1" }).iterator());
|
||||
it.add(Arrays.asList(new String[] { "2" }).iterator());
|
||||
it.add(Arrays.asList(new String[] { "3", "4" }).iterator());
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(Arrays.asList("0", "1").iterator());
|
||||
it.add(Arrays.asList("2").iterator());
|
||||
it.add(Arrays.asList("3", "4").iterator());
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(String.valueOf(i), it.next());
|
||||
@@ -54,43 +79,49 @@ public class CompositeIteratorTests extends TestCase {
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
}
|
||||
catch (NoSuchElementException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInUse() {
|
||||
List list = Arrays.asList(new String[] { "0", "1" });
|
||||
CompositeIterator it = new CompositeIterator();
|
||||
List<String> list = Arrays.asList("0", "1");
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(list.iterator());
|
||||
it.hasNext();
|
||||
try {
|
||||
it.add(list.iterator());
|
||||
fail();
|
||||
} catch (IllegalStateException e) {
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
// expected
|
||||
}
|
||||
it = new CompositeIterator();
|
||||
it = new CompositeIterator<String>();
|
||||
it.add(list.iterator());
|
||||
it.next();
|
||||
try {
|
||||
it.add(list.iterator());
|
||||
fail();
|
||||
} catch (IllegalStateException e) {
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDuplicateIterators() {
|
||||
List list = Arrays.asList(new String[] { "0", "1" });
|
||||
Iterator iterator = list.iterator();
|
||||
CompositeIterator it = new CompositeIterator();
|
||||
List<String> list = Arrays.asList("0", "1");
|
||||
Iterator<String> iterator = list.iterator();
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(iterator);
|
||||
it.add(list.iterator());
|
||||
try {
|
||||
it.add(iterator);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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-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.
|
||||
@@ -99,10 +99,10 @@ public class HttpInvokerClientInterceptor extends RemoteInvocationBasedAccessor
|
||||
* Set the HttpInvokerRequestExecutor implementation to use for executing
|
||||
* remote invocations.
|
||||
* <p>Default is {@link SimpleHttpInvokerRequestExecutor}. Alternatively,
|
||||
* consider using {@link CommonsHttpInvokerRequestExecutor} for more
|
||||
* consider using {@link HttpComponentsHttpInvokerRequestExecutor} for more
|
||||
* sophisticated needs.
|
||||
* @see SimpleHttpInvokerRequestExecutor
|
||||
* @see CommonsHttpInvokerRequestExecutor
|
||||
* @see HttpComponentsHttpInvokerRequestExecutor
|
||||
*/
|
||||
public void setHttpInvokerRequestExecutor(HttpInvokerRequestExecutor httpInvokerRequestExecutor) {
|
||||
this.httpInvokerRequestExecutor = httpInvokerRequestExecutor;
|
||||
@@ -137,7 +137,7 @@ public class HttpInvokerClientInterceptor extends RemoteInvocationBasedAccessor
|
||||
}
|
||||
|
||||
RemoteInvocation invocation = createRemoteInvocation(methodInvocation);
|
||||
RemoteInvocationResult result = null;
|
||||
RemoteInvocationResult result;
|
||||
try {
|
||||
result = executeRequest(invocation, methodInvocation);
|
||||
}
|
||||
@@ -200,18 +200,18 @@ public class HttpInvokerClientInterceptor extends RemoteInvocationBasedAccessor
|
||||
*/
|
||||
protected RemoteAccessException convertHttpInvokerAccessException(Throwable ex) {
|
||||
if (ex instanceof ConnectException) {
|
||||
throw new RemoteConnectFailureException(
|
||||
return new RemoteConnectFailureException(
|
||||
"Could not connect to HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
|
||||
}
|
||||
else if (ex instanceof ClassNotFoundException || ex instanceof NoClassDefFoundError ||
|
||||
|
||||
if (ex instanceof ClassNotFoundException || ex instanceof NoClassDefFoundError ||
|
||||
ex instanceof InvalidClassException) {
|
||||
throw new RemoteAccessException(
|
||||
return new RemoteAccessException(
|
||||
"Could not deserialize result from HTTP invoker remote service [" + getServiceUrl() + "]", ex);
|
||||
}
|
||||
else {
|
||||
throw new RemoteAccessException(
|
||||
"Could not access HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
|
||||
}
|
||||
|
||||
return new RemoteAccessException(
|
||||
"Could not access HTTP invoker remote service at [" + getServiceUrl() + "]", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -321,7 +321,7 @@ public @interface RequestMapping {
|
||||
* specified header is <i>not</i> supposed to be present in the request.
|
||||
* <p>Also supports media type wildcards (*), for headers such as Accept
|
||||
* and Content-Type. For instance,
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* @RequestMapping(value = "/something", headers = "content-type=text/*")
|
||||
* </pre>
|
||||
* will match requests with a Content-Type of "text/html", "text/plain", etc.
|
||||
@@ -340,7 +340,7 @@ public @interface RequestMapping {
|
||||
* <p>The format is a single media type or a sequence of media types,
|
||||
* with a request only mapped if the {@code Content-Type} matches one of these media types.
|
||||
* Examples:
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* consumes = "text/plain"
|
||||
* consumes = {"text/plain", "application/*"}
|
||||
* </pre>
|
||||
@@ -359,7 +359,7 @@ public @interface RequestMapping {
|
||||
* <p>The format is a single media type or a sequence of media types,
|
||||
* with a request only mapped if the {@code Accept} matches one of these media types.
|
||||
* Examples:
|
||||
* <pre>
|
||||
* <pre class="code">
|
||||
* produces = "text/plain"
|
||||
* produces = {"text/plain", "application/*"}
|
||||
* </pre>
|
||||
@@ -367,7 +367,7 @@ public @interface RequestMapping {
|
||||
* all requests with a {@code Accept} other than "text/plain".
|
||||
* <p><b>Supported at the type level as well as at the method level!</b>
|
||||
* When used at the type level, all method-level mappings override
|
||||
* this consumes restriction.
|
||||
* this produces restriction.
|
||||
* @see org.springframework.http.MediaType
|
||||
*/
|
||||
String[] produces() default {};
|
||||
|
||||
@@ -214,7 +214,7 @@ public class AnnotationConfigDispatcherServletInitializerTests {
|
||||
|
||||
@Override
|
||||
protected Class<?>[] getServletConfigClasses() {
|
||||
return new Class[]{MyConfiguration.class};
|
||||
return new Class<?>[] {MyConfiguration.class};
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,16 +239,12 @@ public class AnnotationConfigDispatcherServletInitializerTests {
|
||||
}
|
||||
|
||||
|
||||
private static class MyBean {
|
||||
public static class MyBean {
|
||||
}
|
||||
|
||||
|
||||
@Configuration
|
||||
@SuppressWarnings("unused")
|
||||
private static class MyConfiguration {
|
||||
|
||||
public MyConfiguration() {
|
||||
}
|
||||
public static class MyConfiguration {
|
||||
|
||||
@Bean
|
||||
public MyBean bean() {
|
||||
|
||||
Reference in New Issue
Block a user