Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed formatting

  • Loading branch information...
commit 694a5d0d5c0f2946c0ee99ac19cf65c6716931c7 1 parent bcc0d08
Josh Devins authored
View
16 config/eclipse/formatter.xml
@@ -7,7 +7,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
@@ -26,7 +26,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
@@ -34,7 +34,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
@@ -72,7 +72,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
@@ -105,12 +105,12 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
@@ -224,7 +224,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
@@ -251,7 +251,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
View
4 src/main/java/net/joshdevins/rabbitmq/client/ha/BooleanReentrantLatch.java
@@ -57,7 +57,7 @@ protected boolean isOpen() {
protected int tryAcquireShared(final int acquires) {
// if acquires is 0, this is a test only not an acquisition attempt
- if(acquires == 0) {
+ if (acquires == 0) {
// if open, thread can proceed right away
// if closed, thread needs to wait
@@ -93,7 +93,7 @@ public void close() {
@Override
public boolean equals(final Object obj) {
- if(!(obj instanceof BooleanReentrantLatch)) {
+ if (!(obj instanceof BooleanReentrantLatch)) {
return false;
}
View
28 src/main/java/net/joshdevins/rabbitmq/client/ha/HaChannelProxy.java
@@ -64,18 +64,18 @@ public void closeConnectionLatch() {
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Invoke: " + method.getName());
}
// TODO: Rethink this assumption!
// close is special since we can ignore failures safely
- if(method.getName().equals("close")) {
+ if (method.getName().equals("close")) {
try {
target.close();
- } catch(Exception e) {
+ } catch (Exception e) {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Failed to close underlying channel, not a problem: " + e.getMessage());
}
}
@@ -94,10 +94,10 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg
// don't check for open state, just let it fail
// this will ensure that after a connection has been made, setup can
// proceed before letting operations retry
- for(int numOperationInvocations = 1; keepOnInvoking && shutdownRecoverable; numOperationInvocations++) {
+ for (int numOperationInvocations = 1; keepOnInvoking && shutdownRecoverable; numOperationInvocations++) {
// sych on target Channel to make sure it's not being replaced
- synchronized(target) {
+ synchronized (target) {
// delegate all other method invocations
try {
@@ -106,20 +106,20 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg
// deal with exceptions outside the synchronized block so
// that if a reconnection does occur, it can replace the
// target
- } catch(IOException ioe) {
+ } catch (IOException ioe) {
lastException = ioe;
shutdownRecoverable = HaUtils.isShutdownRecoverable(ioe);
- } catch(AlreadyClosedException ace) {
+ } catch (AlreadyClosedException ace) {
lastException = ace;
shutdownRecoverable = HaUtils.isShutdownRecoverable(ace);
}
}
// only keep on invoking if error is recoverable
- if(shutdownRecoverable) {
+ if (shutdownRecoverable) {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Invocation failed, calling retry strategy: " + lastException.getMessage());
}
@@ -127,7 +127,7 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg
}
}
- if(shutdownRecoverable) {
+ if (shutdownRecoverable) {
LOG.warn("Operation invocation failed after retry strategy gave up", lastException);
} else {
LOG.warn("Operation invocation failed with unrecoverable shutdown signal", lastException);
@@ -152,15 +152,15 @@ protected void setTargetChannel(final Channel target) {
assert target != null;
- if(LOG.isDebugEnabled() && this.target != null) {
+ if (LOG.isDebugEnabled() && this.target != null) {
LOG.debug("Replacing channel: channel=" + this.target.toString());
}
- synchronized(this.target) {
+ synchronized (this.target) {
this.target = target;
- if(LOG.isDebugEnabled() && this.target != null) {
+ if (LOG.isDebugEnabled() && this.target != null) {
LOG.debug("Replaced channel: channel=" + this.target.toString());
}
}
View
50 src/main/java/net/joshdevins/rabbitmq/client/ha/HaConnectionFactory.java
@@ -88,22 +88,22 @@ public HaShutdownListener(final HaConnectionProxy connectionProxy) {
public void shutdownCompleted(final ShutdownSignalException shutdownSignalException) {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Shutdown signal caught: " + shutdownSignalException.getMessage());
}
- for(HaConnectionListener listener : listeners) {
+ for (HaConnectionListener listener : listeners) {
listener.onDisconnect(connectionProxy, shutdownSignalException);
}
// only try to reconnect if it was a problem with the broker
- if(!shutdownSignalException.isInitiatedByApplication()) {
+ if (!shutdownSignalException.isInitiatedByApplication()) {
// start an async reconnection
executorService.submit(new ReconnectionTask(true, this, connectionProxy));
} else {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Ignoring shutdown signal, application initiated");
}
}
@@ -136,20 +136,20 @@ public void run() {
String addressesAsString = getAddressesAsString();
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.info("Reconnection starting, sleeping: addresses=" + addressesAsString + ", wait="
+ reconnectionWaitMillis);
}
// TODO: Add max reconnection attempts
boolean connected = false;
- while(!connected) {
+ while (!connected) {
try {
Thread.sleep(reconnectionWaitMillis);
- } catch(InterruptedException ie) {
+ } catch (InterruptedException ie) {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Reconnection timer thread was interrupted, ignoring and reconnecting now");
}
}
@@ -157,14 +157,14 @@ public void run() {
Exception exception = null;
try {
Connection connection;
- if(connectionProxy.getMaxRedirects() == null) {
+ if (connectionProxy.getMaxRedirects() == null) {
connection = newTargetConnection(connectionProxy.getAddresses(), 0);
} else {
connection = newTargetConnection(connectionProxy.getAddresses(), connectionProxy
.getMaxRedirects());
}
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.info("Reconnection complete: addresses=" + addressesAsString);
}
@@ -176,39 +176,39 @@ public void run() {
connected = true;
- if(reconnection) {
- for(HaConnectionListener listener : listeners) {
+ if (reconnection) {
+ for (HaConnectionListener listener : listeners) {
listener.onReconnection(connectionProxy);
}
} else {
- for(HaConnectionListener listener : listeners) {
+ for (HaConnectionListener listener : listeners) {
listener.onConnection(connectionProxy);
}
}
connectionProxy.markAsOpen();
- } catch(ConnectException ce) {
+ } catch (ConnectException ce) {
// connection refused
exception = ce;
- } catch(IOException ioe) {
+ } catch (IOException ioe) {
// some other connection problem
exception = ioe;
}
- if(exception != null) {
+ if (exception != null) {
LOG.warn("Failed to reconnect, retrying: addresses=" + addressesAsString + ", message="
+ exception.getMessage());
- if(reconnection) {
- for(HaConnectionListener listener : listeners) {
+ if (reconnection) {
+ for (HaConnectionListener listener : listeners) {
listener.onReconnectFailure(connectionProxy, exception);
}
} else {
- for(HaConnectionListener listener : listeners) {
+ for (HaConnectionListener listener : listeners) {
listener.onConnectFailure(connectionProxy, exception);
}
}
@@ -221,9 +221,9 @@ private String getAddressesAsString() {
StringBuilder sb = new StringBuilder();
sb.append('[');
- for(int i = 0; i < connectionProxy.getAddresses().length; i++) {
+ for (int i = 0; i < connectionProxy.getAddresses().length; i++) {
- if(i > 0) {
+ if (i > 0) {
sb.append(',');
}
@@ -280,7 +280,7 @@ public Connection newConnection(final Address[] addrs, final int maxRedirects) t
try {
target = super.newConnection(addrs, maxRedirects);
- } catch(IOException ioe) {
+ } catch (IOException ioe) {
LOG.warn("Initial connection failed, wrapping anyways and letting reconnector go to work: "
+ ioe.getMessage());
}
@@ -288,7 +288,7 @@ public Connection newConnection(final Address[] addrs, final int maxRedirects) t
ConnectionSet connectionPair = createConnectionProxy(addrs, maxRedirects, target);
// connection success
- if(target != null) {
+ if (target != null) {
return connectionPair.wrapped;
}
@@ -337,7 +337,7 @@ protected ConnectionSet createConnectionProxy(final Address[] addrs, final Integ
HaConnectionProxy proxy = new HaConnectionProxy(addrs, maxRedirects, targetConnection, retryStrategy);
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG
.debug("Creating connection proxy: "
+ (targetConnection == null ? "none" : targetConnection.toString()));
@@ -347,7 +347,7 @@ protected ConnectionSet createConnectionProxy(final Address[] addrs, final Integ
HaShutdownListener listener = new HaShutdownListener(proxy);
// failed initial connections will have this set later upon successful connection
- if(targetConnection != null) {
+ if (targetConnection != null) {
target.addShutdownListener(listener);
}
View
20 src/main/java/net/joshdevins/rabbitmq/client/ha/HaConnectionProxy.java
@@ -73,7 +73,7 @@ public HaConnectionProxy(final Address[] addrs, final Integer maxRedirects, fina
}
public void closeConnectionLatch() {
- for(HaChannelProxy proxy : channelProxies) {
+ for (HaChannelProxy proxy : channelProxies) {
proxy.closeConnectionLatch();
}
}
@@ -93,7 +93,7 @@ public Connection getTargetConnection() {
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
// intercept calls to create a channel
- if(method.equals(CREATE_CHANNEL_METHOD) || method.equals(CREATE_CHANNEL_INT_METHOD)) {
+ if (method.equals(CREATE_CHANNEL_METHOD) || method.equals(CREATE_CHANNEL_INT_METHOD)) {
return createChannelAndWrapWithProxy(method, args);
}
@@ -104,9 +104,9 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg
public void markAsOpen() {
- synchronized(channelProxies) {
+ synchronized (channelProxies) {
- for(HaChannelProxy proxy : channelProxies) {
+ for (HaChannelProxy proxy : channelProxies) {
proxy.markAsOpen();
}
}
@@ -123,12 +123,12 @@ protected Channel createChannelAndWrapWithProxy(final Method method, final Objec
// create the proxy and add to the set of channels we have created
HaChannelProxy proxy = new HaChannelProxy(this, targetChannel, retryStrategy);
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Creating channel proxy: " + targetChannel.toString());
}
// save the channel number-to-proxy relationship to be replaced later
- synchronized(channelProxies) {
+ synchronized (channelProxies) {
channelProxies.add(proxy);
}
@@ -136,16 +136,16 @@ protected Channel createChannelAndWrapWithProxy(final Method method, final Objec
}
protected void removeClosedChannel(final HaChannelProxy channelProxy) {
- synchronized(channelProxies) {
+ synchronized (channelProxies) {
channelProxies.remove(channelProxy);
}
}
protected void replaceChannelsInProxies() throws IOException {
- synchronized(channelProxies) {
+ synchronized (channelProxies) {
- for(HaChannelProxy proxy : channelProxies) {
+ for (HaChannelProxy proxy : channelProxies) {
// replace dead channel with a new one using the same ID
int channelNumber = proxy.getTargetChannel().getChannelNumber();
@@ -167,7 +167,7 @@ protected void setTargetConnection(final Connection target) {
CREATE_CHANNEL_METHOD = Connection.class.getMethod("createChannel");
CREATE_CHANNEL_INT_METHOD = Connection.class.getMethod("createChannel", int.class);
- } catch(Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
View
8 src/main/java/net/joshdevins/rabbitmq/client/ha/HaUtils.java
@@ -41,7 +41,7 @@ private HaUtils() {
*/
public static boolean isShutdownRecoverable(final IOException ioe) {
- if(ioe.getCause() instanceof ShutdownSignalException) {
+ if (ioe.getCause() instanceof ShutdownSignalException) {
return isShutdownRecoverable((ShutdownSignalException) ioe.getCause());
}
@@ -63,14 +63,14 @@ public static boolean isShutdownRecoverable(final IOException ioe) {
*/
public static boolean isShutdownRecoverable(final ShutdownSignalException s) {
- if(s != null) {
+ if (s != null) {
int replyCode = 0;
- if(s.getReason() instanceof AMQImpl.Connection.Close) {
+ if (s.getReason() instanceof AMQImpl.Connection.Close) {
replyCode = ((AMQImpl.Connection.Close) s.getReason()).getReplyCode();
}
- if(s.isInitiatedByApplication()) {
+ if (s.isInitiatedByApplication()) {
return replyCode == AMQP.CONNECTION_FORCED || replyCode == AMQP.INTERNAL_ERROR
|| s.getCause() instanceof EOFException || s instanceof AlreadyClosedException;
View
2  src/main/java/net/joshdevins/rabbitmq/client/ha/InvocationHandlerUtils.java
@@ -40,7 +40,7 @@ public static Object delegateMethodInvocation(final Method method, final Object[
try {
return method.invoke(target, args);
- } catch(InvocationTargetException ite) {
+ } catch (InvocationTargetException ite) {
throw ite.getTargetException();
}
}
View
6 src/main/java/net/joshdevins/rabbitmq/client/ha/retry/BlockingRetryStrategy.java
@@ -35,16 +35,16 @@ public boolean shouldRetry(final Exception e, final int numOperationInvocations,
try {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Waiting for connection gate to open: no timeout - " + e.getMessage());
}
connectionGate.waitUntilOpen();
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Waited for connection gate to open: connected=" + connectionGate.isOpen());
}
- } catch(InterruptedException e1) {
+ } catch (InterruptedException e1) {
LOG
.warn("Interrupted during timeout waiting for next operation invocation to occurr. Retrying invocation now.");
View
14 src/main/java/net/joshdevins/rabbitmq/client/ha/retry/SimpleRetryStrategy.java
@@ -64,35 +64,35 @@ public void setOperationRetryTimeoutMillis(final long timeout) {
public boolean shouldRetry(final Exception e, final int numOperationInvocations,
final BooleanReentrantLatch connectionGate) {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Operation invocation failed on IOException: numOperationInvocations=" + numOperationInvocations
+ ", maxOperationInvocations=" + maxOperationInvocations + ", message=" + e.getMessage());
}
- if(numOperationInvocations == maxOperationInvocations) {
+ if (numOperationInvocations == maxOperationInvocations) {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Max number of operation invocations reached, not retrying: " + maxOperationInvocations);
}
return false;
}
- if(operationRetryTimeoutMillis > 0) {
+ if (operationRetryTimeoutMillis > 0) {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("Sleeping before next operation invocation (millis): " + operationRetryTimeoutMillis);
}
try {
Thread.sleep(operationRetryTimeoutMillis);
- } catch(InterruptedException ie) {
+ } catch (InterruptedException ie) {
LOG.warn("Interrupted during timeout waiting for next operation invocation to occurr. "
+ "Retrying invocation now.");
}
} else {
- if(LOG.isDebugEnabled()) {
+ if (LOG.isDebugEnabled()) {
LOG.debug("No timeout set, retrying immediately");
}
}
View
18 src/test/java/net/joshdevins/rabbitmq/client/ha/BooleanReentrantLatchTest.java
@@ -42,7 +42,7 @@ public Long call() throws Exception {
latch.waitUntilOpen();
return new Date().getTime() - startTime;
- } catch(InterruptedException ie) {
+ } catch (InterruptedException ie) {
return new Long(-1);
}
}
@@ -83,7 +83,7 @@ public void basicRepeatedCloseTest() {
latch = new BooleanReentrantLatch(false);
Assert.assertTrue(latch.isClosed());
- for(int i = 0; i < NUM_REPETITIONS; i++) {
+ for (int i = 0; i < NUM_REPETITIONS; i++) {
latch.close();
Assert.assertTrue(latch.isClosed());
}
@@ -92,7 +92,7 @@ public void basicRepeatedCloseTest() {
@Test
public void basicRepeatedCloseThenOpenTest() {
- for(int i = 0; i < NUM_REPETITIONS; i++) {
+ for (int i = 0; i < NUM_REPETITIONS; i++) {
Assert.assertTrue(latch.isOpen());
@@ -108,7 +108,7 @@ public void basicRepeatedOpenTest() {
Assert.assertTrue(latch.isOpen());
- for(int i = 0; i < NUM_REPETITIONS; i++) {
+ for (int i = 0; i < NUM_REPETITIONS; i++) {
latch.open();
Assert.assertTrue(latch.isOpen());
}
@@ -145,22 +145,22 @@ public void concurrentRepeatedWaitOnClosedLatchTest() throws InterruptedExceptio
int numTestCallables = 10;
TestCallable[] testCallables = new TestCallable[numTestCallables];
- for(int i = 0; i < numTestCallables; i++) {
+ for (int i = 0; i < numTestCallables; i++) {
testCallables[i] = new TestCallable();
}
ExecutorService service = Executors.newFixedThreadPool(numTestCallables);
- for(int i = 0; i < NUM_REPETITIONS; i++) {
+ for (int i = 0; i < NUM_REPETITIONS; i++) {
latch.close();
List<Future<Long>> futures = new LinkedList<Future<Long>>();
- for(int j = 0; j < numTestCallables; j++) {
+ for (int j = 0; j < numTestCallables; j++) {
futures.add(service.submit(testCallables[j]));
}
- for(Future<Long> future : futures) {
+ for (Future<Long> future : futures) {
// threads are not finished
Assert.assertFalse(future.isDone());
@@ -173,7 +173,7 @@ public void concurrentRepeatedWaitOnClosedLatchTest() throws InterruptedExceptio
// wait a sec before testing the state
Thread.sleep(100);
- for(Future<Long> future : futures) {
+ for (Future<Long> future : futures) {
// threads are finished
Assert.assertTrue(future.isDone());
View
8 src/test/java/net/joshdevins/rabbitmq/client/ha/RabbitTemplateConsumerIntegrationTest.java
@@ -83,7 +83,7 @@ public void onReconnection(final HaConnectionProxy connectionProxy) {
channel.close();
connection.close();
- } catch(Exception e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -114,14 +114,14 @@ public void testSyncConsume() throws UnsupportedEncodingException, InterruptedEx
Assert.assertNotNull(bindOk);
// empty out queue
- while(template.receive("testQueue") != null) {
+ while (template.receive("testQueue") != null) {
receiveMessage(1, template.receive("testQueue"));
}
receiveMessage(1, template.receive("testQueue"));
// empty out queue
- while(true) {
+ while (true) {
Thread.sleep(1000);
receiveMessage(1, template.receive("testQueue"));
}
@@ -129,7 +129,7 @@ public void testSyncConsume() throws UnsupportedEncodingException, InterruptedEx
private void receiveMessage(final int expected, final Message message) throws UnsupportedEncodingException {
- if(message == null) {
+ if (message == null) {
LOG.info("no message");
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.