Permalink
Browse files

fixed formatting

  • Loading branch information...
1 parent bcc0d08 commit 694a5d0d5c0f2946c0ee99ac19cf65c6716931c7 Josh Devins committed May 10, 2010
@@ -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,15 +26,15 @@
<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"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<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"/>
@@ -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;
}
@@ -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,28 +106,28 @@ 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());
}
keepOnInvoking = retryStrategy.shouldRetry(lastException, numOperationInvocations, connectionLatch);
}
}
- 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());
}
}
@@ -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,35 +136,35 @@ 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");
}
}
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,15 +280,15 @@ 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());
}
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);
}
Oops, something went wrong.

0 comments on commit 694a5d0

Please sign in to comment.