Skip to content

Commit fdfe8a8

Browse files
committed
reformat
1 parent 8f762c7 commit fdfe8a8

103 files changed

Lines changed: 9927 additions & 10180 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.

java/client/src/main/java/jp/co/rakuten/rit/roma/client/AbstractRomaClient.java

Lines changed: 69 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -4,77 +4,73 @@
44
import jp.co.rakuten.rit.roma.client.commands.TimeoutFilter;
55
import jp.co.rakuten.rit.roma.client.routing.RoutingTable;
66

7-
/**
8-
*
9-
*/
107
public abstract class AbstractRomaClient implements RomaClient {
11-
12-
protected ConnectionPool connPool;
13-
protected RoutingTable routingTable;
14-
protected CommandFactory commandFact;
15-
protected String hashName;
16-
17-
public final void setConnectionPool(ConnectionPool pool) {
18-
this.connPool = pool;
19-
}
20-
21-
public final ConnectionPool getConnectionPool() {
22-
return connPool;
23-
}
24-
25-
public final void setRoutingTable(RoutingTable routingTable) {
26-
this.routingTable = routingTable;
27-
}
28-
29-
public final RoutingTable getRoutingTable() {
30-
return routingTable;
31-
}
32-
33-
public final void setCommandFactory(CommandFactory commandGenerator) {
34-
this.commandFact = commandGenerator;
35-
}
36-
37-
public final CommandFactory getCommandFactory() {
38-
return commandFact;
39-
}
40-
41-
public final void setTimeout(long timeout) {
42-
TimeoutFilter.timeout = timeout;
43-
}
44-
45-
public final long getTimeout() {
46-
return TimeoutFilter.timeout;
47-
}
48-
49-
public final void setNumOfThreads(int num) {
50-
TimeoutFilter.numOfThreads = num;
51-
}
52-
53-
public final int getNumOfThreads() {
54-
return TimeoutFilter.numOfThreads;
55-
}
56-
57-
public void setRetryCount(int retryCount) {
58-
FailOverFilter.retryThreshold = retryCount;
59-
}
60-
61-
public int getRetryCount() {
62-
return FailOverFilter.retryThreshold;
63-
}
64-
65-
public void setRetrySleepTime(long sleepTime) {
66-
FailOverFilter.sleepPeriod = sleepTime;
67-
}
68-
69-
public long getRetrySleepTime() {
70-
return FailOverFilter.sleepPeriod;
71-
}
72-
73-
public void setHashName(String hashName) {
74-
this.hashName = hashName;
75-
}
76-
77-
public String getHashName() {
78-
return hashName;
79-
}
80-
}
8+
protected ConnectionPool connPool;
9+
protected RoutingTable routingTable;
10+
protected CommandFactory commandFact;
11+
protected String hashName;
12+
13+
public final void setConnectionPool(ConnectionPool pool) {
14+
this.connPool = pool;
15+
}
16+
17+
public final ConnectionPool getConnectionPool() {
18+
return connPool;
19+
}
20+
21+
public final void setRoutingTable(RoutingTable routingTable) {
22+
this.routingTable = routingTable;
23+
}
24+
25+
public final RoutingTable getRoutingTable() {
26+
return routingTable;
27+
}
28+
29+
public final void setCommandFactory(CommandFactory commandGenerator) {
30+
this.commandFact = commandGenerator;
31+
}
32+
33+
public final CommandFactory getCommandFactory() {
34+
return commandFact;
35+
}
36+
37+
public final void setTimeout(long timeout) {
38+
TimeoutFilter.timeout = timeout;
39+
}
40+
41+
public final long getTimeout() {
42+
return TimeoutFilter.timeout;
43+
}
44+
45+
public final void setNumOfThreads(int num) {
46+
TimeoutFilter.numOfThreads = num;
47+
}
48+
49+
public final int getNumOfThreads() {
50+
return TimeoutFilter.numOfThreads;
51+
}
52+
53+
public void setRetryCount(int retryCount) {
54+
FailOverFilter.retryThreshold = retryCount;
55+
}
56+
57+
public int getRetryCount() {
58+
return FailOverFilter.retryThreshold;
59+
}
60+
61+
public void setRetrySleepTime(long sleepTime) {
62+
FailOverFilter.sleepPeriod = sleepTime;
63+
}
64+
65+
public long getRetrySleepTime() {
66+
return FailOverFilter.sleepPeriod;
67+
}
68+
69+
public void setHashName(String hashName) {
70+
this.hashName = hashName;
71+
}
72+
73+
public String getHashName() {
74+
return hashName;
75+
}
76+
}
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package jp.co.rakuten.rit.roma.client;
22

3-
/**
4-
*
5-
*/
63
public class BadRoutingTableFormatException extends ClientException {
4+
public BadRoutingTableFormatException(String reason) {
5+
super(reason);
6+
}
77

8-
public BadRoutingTableFormatException(String reason) {
9-
super(reason);
10-
}
11-
private static final long serialVersionUID = -8186833003353745212L;
12-
}
8+
private static final long serialVersionUID = -8186833003353745212L;
9+
}

java/client/src/main/java/jp/co/rakuten/rit/roma/client/CasResponse.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
* Response codes for a CAS operation.
55
*/
66
public enum CasResponse {
7-
/**
8-
* Status indicating that the CAS was successful and the new value is
9-
* stored in the cache.
10-
*/
11-
OK,
12-
/**
13-
* Status indicating the value was not found in the cache (an add
14-
* operation may be issued to store the value).
15-
*/
16-
NOT_FOUND,
17-
/**
18-
* Status indicating the value was found in the cache, but exists with a
19-
* different CAS value than expected. In this case, the value must be
20-
* refetched and the CAS operation tried again.
21-
*/
22-
EXISTS
7+
/**
8+
* Status indicating that the CAS was successful and the new value is stored
9+
* in the cache.
10+
*/
11+
OK,
12+
/**
13+
* Status indicating the value was not found in the cache (an add operation
14+
* may be issued to store the value).
15+
*/
16+
NOT_FOUND,
17+
/**
18+
* Status indicating the value was found in the cache, but exists with a
19+
* different CAS value than expected. In this case, the value must be
20+
* refetched and the CAS operation tried again.
21+
*/
22+
EXISTS
2323
}

java/client/src/main/java/jp/co/rakuten/rit/roma/client/CasValue.java

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,39 @@
44
* A value with a CAS identifier.
55
*/
66
public class CasValue {
7-
private final long cas;
8-
private final byte[] value;
7+
private final long cas;
8+
private final byte[] value;
99

10-
/**
11-
* Construct a new CASValue with the given identifer and value.
12-
*
13-
* @param c the CAS identifier
14-
* @param v the value
15-
*/
16-
public CasValue(long c, byte[] v) {
17-
super();
18-
cas=c;
19-
value=v;
20-
}
10+
/**
11+
* Construct a new CASValue with the given identifer and value.
12+
*
13+
* @param c
14+
* the CAS identifier
15+
* @param v
16+
* the value
17+
*/
18+
public CasValue(long c, byte[] v) {
19+
super();
20+
cas = c;
21+
value = v;
22+
}
2123

22-
/**
23-
* Get the CAS identifier.
24-
*/
25-
public long getCas() {
26-
return cas;
27-
}
24+
/**
25+
* Get the CAS identifier.
26+
*/
27+
public long getCas() {
28+
return cas;
29+
}
2830

29-
/**
30-
* Get the object value.
31-
*/
32-
public byte[] getValue() {
33-
return value;
34-
}
31+
/**
32+
* Get the object value.
33+
*/
34+
public byte[] getValue() {
35+
return value;
36+
}
3537

36-
@Override
37-
public String toString() {
38-
return "{CasValue " + cas + "/" + value + "}";
39-
}
40-
41-
}
38+
@Override
39+
public String toString() {
40+
return "{CasValue " + cas + "/" + value + "}";
41+
}
42+
}
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
package jp.co.rakuten.rit.roma.client;
22

3-
/**
4-
*
5-
*/
63
public class ClientException extends Exception {
4+
private static final long serialVersionUID = -7032182229500031385L;
75

8-
private static final long serialVersionUID = -7032182229500031385L;
6+
public ClientException() {
7+
super();
8+
}
99

10-
public ClientException() {
11-
super();
12-
}
10+
public ClientException(Throwable cause) {
11+
super(cause);
12+
}
1313

14-
public ClientException(Throwable cause) {
15-
super(cause);
16-
}
14+
public ClientException(String reason) {
15+
super(reason);
16+
}
1717

18-
public ClientException(String reason) {
19-
super(reason);
20-
}
21-
22-
public ClientException(String reason, Throwable cause) {
23-
super(reason, cause);
24-
}
25-
}
18+
public ClientException(String reason, Throwable cause) {
19+
super(reason, cause);
20+
}
21+
}

java/client/src/main/java/jp/co/rakuten/rit/roma/client/CommandFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import jp.co.rakuten.rit.roma.client.commands.Command;
44

55
public interface CommandFactory {
6+
public Command getCommand(int commandID);
67

7-
public Command getCommand(int commandID);
8-
9-
public void createCommand(int commandID, Command command);
10-
}
8+
public void createCommand(int commandID, Command command);
9+
}
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
package jp.co.rakuten.rit.roma.client;
22

3-
/**
4-
*
5-
*/
63
public final class Config {
4+
public static final String CONNECTION_POOL_SIZE = "connection_pool.size";
75

8-
public static final String CONNECTION_POOL_SIZE = "connection_pool.size";
6+
public static final String DEFAULT_CONNECTION_POOL_SIZE = "30";
97

10-
public static final String DEFAULT_CONNECTION_POOL_SIZE = "30";
8+
public static final String TIMEOUT_PERIOD = "timeout.period";
119

12-
public static final String TIMEOUT_PERIOD = "timeout.period";
10+
public static final String DEFAULT_TIMEOUT_PERIOD = "5000";
1311

14-
public static final String DEFAULT_TIMEOUT_PERIOD = "5000";
12+
public static final String NUM_OF_THREADS = "timeout.threads.num";
1513

16-
public static final String NUM_OF_THREADS = "timeout.threads.num";
14+
public static final String DEFAULT_NUM_OF_THREADS = "200";
1715

18-
public static final String DEFAULT_NUM_OF_THREADS = "200";
16+
public static final String DEFAULT_NUM_OF_THREADS2 = "-1";
1917

20-
public static final String DEFAULT_NUM_OF_THREADS2 = "-1";
18+
public static final String RETRY_THRESHOLD = "retry.threshold";
2119

22-
public static final String RETRY_THRESHOLD = "retry.threshold";
20+
public static final String DEFAULT_RETRY_THRESHOLD = "10";
2321

24-
public static final String DEFAULT_RETRY_THRESHOLD = "10";
22+
public static final String RETRY_SLEEP_TIME = "retry.timeout";
2523

26-
public static final String RETRY_SLEEP_TIME = "retry.timeout";
24+
public static final String DEFAULT_RETRY_SLEEP_TIME = "100";
2725

28-
public static final String DEFAULT_RETRY_SLEEP_TIME = "100";
26+
public static final String HASH_NAME = "hash_name";
2927

30-
public static final String HASH_NAME = "hash_name";
31-
32-
public static final String DEFAULT_HASH_NAME = "roma";
33-
}
28+
public static final String DEFAULT_HASH_NAME = "roma";
29+
}

0 commit comments

Comments
 (0)