Skip to content

Commit 4419751

Browse files
committed
Format all Java sources with Intellij default settings.
1 parent 1f65ad4 commit 4419751

283 files changed

Lines changed: 6287 additions & 6490 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

driver-core/src/main/java/com/datastax/driver/core/AbstractGettableData.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
*/
1616
package com.datastax.driver.core;
1717

18+
import com.datastax.driver.core.exceptions.InvalidTypeException;
19+
1820
import java.math.BigDecimal;
1921
import java.math.BigInteger;
2022
import java.net.InetAddress;
2123
import java.nio.ByteBuffer;
2224
import java.util.*;
2325

24-
import com.google.common.collect.Lists;
25-
26-
import com.datastax.driver.core.exceptions.InvalidTypeException;
27-
2826
abstract class AbstractGettableData implements GettableData {
2927

3028
protected final ColumnDefinitions metadata;
@@ -153,16 +151,16 @@ public ByteBuffer getBytes(String name) {
153151

154152
public String getString(int i) {
155153
DataType.Name type = metadata.checkType(i, DataType.Name.VARCHAR,
156-
DataType.Name.TEXT,
157-
DataType.Name.ASCII);
154+
DataType.Name.TEXT,
155+
DataType.Name.ASCII);
158156

159157
ByteBuffer value = getValue(i);
160158
if (value == null)
161159
return null;
162160

163161
return type == DataType.Name.ASCII
164-
? TypeCodec.StringCodec.asciiInstance.deserialize(value)
165-
: TypeCodec.StringCodec.utf8Instance.deserialize(value);
162+
? TypeCodec.StringCodec.asciiInstance.deserialize(value)
163+
: TypeCodec.StringCodec.utf8Instance.deserialize(value);
166164
}
167165

168166
public String getString(String name) {
@@ -205,8 +203,8 @@ public UUID getUUID(int i) {
205203
return null;
206204

207205
return type == DataType.Name.UUID
208-
? TypeCodec.UUIDCodec.instance.deserialize(value)
209-
: TypeCodec.TimeUUIDCodec.instance.deserialize(value);
206+
? TypeCodec.UUIDCodec.instance.deserialize(value)
207+
: TypeCodec.TimeUUIDCodec.instance.deserialize(value);
210208
}
211209

212210
public UUID getUUID(String name) {
@@ -241,7 +239,7 @@ public <T> List<T> getList(int i, Class<T> elementsClass) {
241239
if (value == null)
242240
return Collections.<T>emptyList();
243241

244-
return Collections.unmodifiableList((List<T>)type.codec().deserialize(value));
242+
return Collections.unmodifiableList((List<T>) type.codec().deserialize(value));
245243
}
246244

247245
public <T> List<T> getList(String name, Class<T> elementsClass) {
@@ -262,7 +260,7 @@ public <T> Set<T> getSet(int i, Class<T> elementsClass) {
262260
if (value == null)
263261
return Collections.<T>emptySet();
264262

265-
return Collections.unmodifiableSet((Set<T>)type.codec().deserialize(value));
263+
return Collections.unmodifiableSet((Set<T>) type.codec().deserialize(value));
266264
}
267265

268266
public <T> Set<T> getSet(String name, Class<T> elementsClass) {
@@ -284,7 +282,7 @@ public <K, V> Map<K, V> getMap(int i, Class<K> keysClass, Class<V> valuesClass)
284282
if (value == null)
285283
return Collections.<K, V>emptyMap();
286284

287-
return Collections.unmodifiableMap((Map<K, V>)type.codec().deserialize(value));
285+
return Collections.unmodifiableMap((Map<K, V>) type.codec().deserialize(value));
288286
}
289287

290288
public <K, V> Map<K, V> getMap(String name, Class<K> keysClass, Class<V> valuesClass) {

driver-core/src/main/java/com/datastax/driver/core/AbstractReconnectionHandler.java

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,24 @@
1515
*/
1616
package com.datastax.driver.core;
1717

18-
import java.util.concurrent.*;
19-
import java.util.concurrent.atomic.AtomicReference;
20-
18+
import com.datastax.driver.core.exceptions.AuthenticationException;
19+
import com.datastax.driver.core.policies.ReconnectionPolicy;
2120
import com.google.common.annotations.VisibleForTesting;
22-
import com.google.common.util.concurrent.ListenableFuture;
2321
import com.google.common.util.concurrent.AbstractFuture;
22+
import com.google.common.util.concurrent.ListenableFuture;
2423
import org.slf4j.Logger;
2524
import org.slf4j.LoggerFactory;
2625

27-
import com.datastax.driver.core.exceptions.AuthenticationException;
28-
import com.datastax.driver.core.policies.ReconnectionPolicy;
26+
import java.util.concurrent.*;
27+
import java.util.concurrent.atomic.AtomicReference;
2928

3029
/**
3130
* Manages periodic reconnection attempts after a host has been marked down.
32-
* <p>
31+
* <p/>
3332
* Concurrent attempts are handled via the {@link #currentAttempt} reference passed to the constructor.
3433
* For a given reference, only one handler will run at a given time. Additional handlers will cancel
3534
* themselves if they find a previous handler running.
36-
* <p>
35+
* <p/>
3736
* This class is designed for concurrency, but instances must not be shared: each thread creates and
3837
* starts its own private handler, all interactions happen through {@link #currentAttempt}.
3938
*/
@@ -68,18 +67,31 @@ public AbstractReconnectionHandler(String name, ScheduledExecutorService executo
6867
}
6968

7069
protected abstract Connection tryReconnect() throws ConnectionException, InterruptedException, UnsupportedProtocolVersionException, ClusterNameMismatchException;
70+
7171
protected abstract void onReconnection(Connection connection);
7272

73-
protected boolean onConnectionException(ConnectionException e, long nextDelayMs) { return true; }
74-
protected boolean onUnknownException(Exception e, long nextDelayMs) { return true; }
73+
protected boolean onConnectionException(ConnectionException e, long nextDelayMs) {
74+
return true;
75+
}
76+
77+
protected boolean onUnknownException(Exception e, long nextDelayMs) {
78+
return true;
79+
}
7580

7681
// Retrying on authentication errors makes sense for applications that can update the credentials at runtime, we don't want to force them
7782
// to restart.
78-
protected boolean onAuthenticationException(AuthenticationException e, long nextDelayMs) { return true; }
83+
protected boolean onAuthenticationException(AuthenticationException e, long nextDelayMs) {
84+
return true;
85+
}
7986

8087
// Retrying on these errors is unlikely to work
81-
protected boolean onUnsupportedProtocolVersionException(UnsupportedProtocolVersionException e, long nextDelayMs) { return false; }
82-
protected boolean onClusterNameMismatchException(ClusterNameMismatchException e, long nextDelayMs) { return false; }
88+
protected boolean onUnsupportedProtocolVersionException(UnsupportedProtocolVersionException e, long nextDelayMs) {
89+
return false;
90+
}
91+
92+
protected boolean onClusterNameMismatchException(ClusterNameMismatchException e, long nextDelayMs) {
93+
return false;
94+
}
8395

8496
public void start() {
8597
long firstDelay = (initialDelayMs >= 0) ? initialDelayMs : schedule.nextDelayMs();

driver-core/src/main/java/com/datastax/driver/core/AbstractSession.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
*/
1616
package com.datastax.driver.core;
1717

18+
import com.google.common.base.Function;
19+
import com.google.common.util.concurrent.Futures;
20+
import com.google.common.util.concurrent.ListenableFuture;
21+
import com.google.common.util.concurrent.Uninterruptibles;
22+
1823
import java.nio.ByteBuffer;
1924
import java.util.concurrent.ExecutionException;
2025

21-
import com.google.common.base.Function;
22-
import com.google.common.util.concurrent.*;
23-
2426
/**
2527
* Abstract implementation of the Session interface.
26-
*
28+
* <p/>
2729
* This is primarly intended to make mocking easier.
2830
*/
2931
public abstract class AbstractSession implements Session, AsyncInitSession {

driver-core/src/main/java/com/datastax/driver/core/ArrayBackedResultSet.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@
1515
*/
1616
package com.datastax.driver.core;
1717

18-
import java.nio.ByteBuffer;
19-
import java.util.*;
20-
import java.util.concurrent.ConcurrentLinkedQueue;
21-
import java.util.concurrent.ExecutionException;
22-
import java.util.concurrent.LinkedBlockingDeque;
23-
18+
import com.datastax.driver.core.exceptions.DriverInternalError;
19+
import com.datastax.driver.core.utils.MoreFutures;
2420
import com.google.common.util.concurrent.ListenableFuture;
2521
import com.google.common.util.concurrent.SettableFuture;
2622
import com.google.common.util.concurrent.Uninterruptibles;
2723
import org.slf4j.Logger;
2824
import org.slf4j.LoggerFactory;
2925

30-
import com.datastax.driver.core.exceptions.DriverInternalError;
31-
import com.datastax.driver.core.utils.MoreFutures;
26+
import java.nio.ByteBuffer;
27+
import java.util.*;
28+
import java.util.concurrent.ConcurrentLinkedQueue;
29+
import java.util.concurrent.ExecutionException;
30+
import java.util.concurrent.LinkedBlockingDeque;
3231

3332
/**
3433
* Default implementation of a result set, backed by an ArrayDeque of ArrayList.
@@ -56,26 +55,26 @@ static ArrayBackedResultSet fromMessage(Responses.Result msg, SessionManager ses
5655
case VOID:
5756
return empty(info);
5857
case ROWS:
59-
Responses.Result.Rows r = (Responses.Result.Rows)msg;
58+
Responses.Result.Rows r = (Responses.Result.Rows) msg;
6059

6160
ColumnDefinitions columnDefs;
6261
if (r.metadata.columns == null) {
6362
assert statement instanceof BoundStatement;
64-
columnDefs = ((BoundStatement)statement).statement.getPreparedId().resultSetMetadata;
63+
columnDefs = ((BoundStatement) statement).statement.getPreparedId().resultSetMetadata;
6564
assert columnDefs != null;
6665
} else {
6766
columnDefs = r.metadata.columns;
6867
}
6968

7069
Token.Factory tokenFactory = (session == null) ? null
71-
: session.getCluster().manager.metadata.tokenFactory();
70+
: session.getCluster().manager.metadata.tokenFactory();
7271

7372
// info can be null only for internal calls, but we don't page those. We assert
7473
// this explicitly because MultiPage implementation don't support info == null.
7574
assert r.metadata.pagingState == null || info != null;
7675
return r.metadata.pagingState == null
77-
? new SinglePage(columnDefs, tokenFactory, r.data, info)
78-
: new MultiPage(columnDefs, tokenFactory, r.data, info, r.metadata.pagingState, session, statement);
76+
? new SinglePage(columnDefs, tokenFactory, r.data, info)
77+
: new MultiPage(columnDefs, tokenFactory, r.data, info, r.metadata.pagingState, session, statement);
7978

8079
case SET_KEYSPACE:
8180
case SCHEMA_CHANGE:
@@ -320,10 +319,10 @@ public void onSet(Connection connection, Message.Response response, ExecutionInf
320319
try {
321320
switch (response.type) {
322321
case RESULT:
323-
Responses.Result rm = (Responses.Result)response;
322+
Responses.Result rm = (Responses.Result) response;
324323
info = update(info, rm, MultiPage.this.session);
325324
if (rm.kind == Responses.Result.Kind.ROWS) {
326-
Responses.Result.Rows rows = (Responses.Result.Rows)rm;
325+
Responses.Result.Rows rows = (Responses.Result.Rows) rm;
327326
if (rows.metadata.pagingState != null)
328327
info = info.withPagingState(rows.metadata.pagingState).withStatement(statement);
329328
MultiPage.this.nextPages.offer(rows.data);
@@ -343,7 +342,7 @@ public void onSet(Connection connection, Message.Response response, ExecutionInf
343342
future.set(null);
344343
break;
345344
case ERROR:
346-
future.setException(((Responses.Error)response).asException(connection.address));
345+
future.setException(((Responses.Error) response).asException(connection.address));
347346
break;
348347
default:
349348
// This mean we have probably have a bad node, so defunct the connection

driver-core/src/main/java/com/datastax/driver/core/ArrayBackedRow.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
*/
1616
package com.datastax.driver.core;
1717

18+
import com.datastax.driver.core.exceptions.DriverInternalError;
19+
1820
import java.nio.ByteBuffer;
1921
import java.util.List;
2022

21-
import com.datastax.driver.core.exceptions.DriverInternalError;
22-
2323
/**
2424
* Implementation of a Row backed by an ArrayList.
2525
*/

driver-core/src/main/java/com/datastax/driver/core/AsyncInitSession.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
/**
2121
* A {@link Session} that can be initialized asynchronously.
22-
*
22+
* <p/>
2323
* This interface exists only for backward compatibility reasons: {@link #initAsync()} should really be
2424
* defined by {@link Session}, but adding it after the fact would break binary compatibility.
25-
*
25+
* <p/>
2626
* By default, all sessions returned by the driver implement this interface. The only way you would get
2727
* sessions that don't is if you use a custom {@link Cluster} subclass.
2828
*/

driver-core/src/main/java/com/datastax/driver/core/AuthProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@
1515
*/
1616
package com.datastax.driver.core;
1717

18-
import java.net.InetSocketAddress;
19-
2018
import com.datastax.driver.core.exceptions.AuthenticationException;
2119

20+
import java.net.InetSocketAddress;
21+
2222
/**
2323
* Provides {@link Authenticator} instances for use when connecting
2424
* to Cassandra nodes.
25-
*
25+
* <p/>
2626
* See {@link PlainTextAuthProvider} for an implementation which uses SASL
2727
* PLAIN mechanism to authenticate using username/password strings
2828
*/
2929
public interface AuthProvider {
3030

3131
/**
3232
* A provider that provides no authentication capability.
33-
* <p>
33+
* <p/>
3434
* This is only useful as a placeholder when no authentication is to be used.
3535
*/
3636
public static final AuthProvider NONE = new AuthProvider() {
3737
public Authenticator newAuthenticator(InetSocketAddress host) {
3838
throw new AuthenticationException(host,
39-
String.format("Host %s requires authentication, but no authenticator found in Cluster configuration", host));
39+
String.format("Host %s requires authentication, but no authenticator found in Cluster configuration", host));
4040
}
4141
};
4242

driver-core/src/main/java/com/datastax/driver/core/Authenticator.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@
1717

1818
/**
1919
* Handles SASL authentication with Cassandra servers.
20-
* <p>
20+
* <p/>
2121
* Each time a new connection is created and the server requires authentication,
2222
* a new instance of this class will be created by the corresponding
2323
* {@link AuthProvider} to handle that authentication. The lifecycle of that
2424
* new {@code Authenticator} will be:
2525
* <ol>
26-
* <li>The {@code initialResponse} method will be called. The initial return
27-
* value will be sent to the server to initiate the handshake.</li>
28-
* <li>The server will respond to each client response by either issuing a
29-
* challenge or indicating that the authentication is complete (successfully or not).
30-
* If a new challenge is issued, the authenticator {@code evaluateChallenge}
31-
* method will be called to produce a response that will be sent to the
32-
* server. This challenge/response negotiation will continue until the server
33-
* responds that authentication is successful (or an {@code AuthenticationException}
34-
* is raised).
35-
* </li>
36-
* <li>When the server indicates that authentication is successful, the
37-
* {@code onAuthenticationSuccess} method will be called with the last information
38-
* that the server may optionally have sent.
39-
* </li>
26+
* <li>The {@code initialResponse} method will be called. The initial return
27+
* value will be sent to the server to initiate the handshake.</li>
28+
* <li>The server will respond to each client response by either issuing a
29+
* challenge or indicating that the authentication is complete (successfully or not).
30+
* If a new challenge is issued, the authenticator {@code evaluateChallenge}
31+
* method will be called to produce a response that will be sent to the
32+
* server. This challenge/response negotiation will continue until the server
33+
* responds that authentication is successful (or an {@code AuthenticationException}
34+
* is raised).
35+
* </li>
36+
* <li>When the server indicates that authentication is successful, the
37+
* {@code onAuthenticationSuccess} method will be called with the last information
38+
* that the server may optionally have sent.
39+
* </li>
4040
* </ol>
4141
* The exact nature of the negotiation between client and server is specific
4242
* to the authentication mechanism configured server side.
@@ -66,8 +66,8 @@ public interface Authenticator {
6666
* optionally sent by the server.
6767
*
6868
* @param token the information sent by the server with the authentication
69-
* successful message. This will be {@code null} if the server sends no
70-
* particular information on authentication success.
69+
* successful message. This will be {@code null} if the server sends no
70+
* particular information on authentication success.
7171
*/
7272
public void onAuthenticationSuccess(byte[] token);
7373
}

0 commit comments

Comments
 (0)