Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public int index(String key, String value) throws IOException {
}

public boolean insert(String key, int index, byte[] value) throws IOException {
return sendCmdS("alist_insert", key, "" + index + " " + value.length, value).isStored();
return sendCmdS("alist_insert", key, index + " " + value.length, value).isStored();
}

public boolean insert(String key, int index, String value) throws IOException {
Expand All @@ -156,7 +156,8 @@ public boolean insert(String key, int index, String value) throws IOException {
public boolean sizedInsert(String key, int size, byte[] value)
throws IOException {
return sendCmdS("alist_sized_insert",
key, "" + size + " " + value.length, value).isStored();
key, size + " " + value.length, value).isStored();

}

public boolean sizedInsert(String key, int size, String value)
Expand All @@ -178,7 +179,7 @@ public boolean swapAndInsert(String key, String value)
public boolean swapAndSizedInsert(String key, int size, byte[] value)
throws IOException {
return sendCmdS("alist_swap_and_sized_insert",
key, "" + size + " " + value.length, value).isStored();
key, size + " " + value.length, value).isStored();
}

public boolean swapAndSizedInsert(String key, int size, String value)
Expand Down Expand Up @@ -211,7 +212,7 @@ public boolean dayExpiredSwapAndInsert(String key, int dexpt, String value)
public boolean expiredSwapAndInsert(String key, int expt, byte[] value)
throws IOException {
return sendCmdS("alist_expired_swap_and_insert",
key, "" + expt + " " + value.length, value).isStored();
key, expt + " " + value.length, value).isStored();
}

public boolean expiredSwapAndInsert(String key, int expt, String value)
Expand Down Expand Up @@ -244,7 +245,7 @@ public boolean dayExpiredSwapAndSizedInsert(
public boolean expiredSwapAndSizedInsert(
String key, int expt, int size, byte[] value) throws IOException {
return sendCmdS("alist_expired_swap_and_sized_insert",
key, "" + expt + " " + size + " " + value.length, value).isStored();
key, expt + " " + size + " " + value.length, value).isStored();
}

public boolean expiredSwapAndSizedInsert(
Expand Down Expand Up @@ -310,7 +311,7 @@ public boolean push(String key, String value) throws IOException {
public boolean sizedPush(String key, int size, byte[] value)
throws IOException {
return sendCmdS("alist_sized_push",
key, "" + size + " " + value.length, value).isStored();
key, size + " " + value.length, value).isStored();
}

public boolean sizedPush(String key, int size, String value)
Expand All @@ -330,7 +331,7 @@ public boolean swapAndPush(String key, String value) throws IOException {
public boolean swapAndSizedPush(String key, int size, byte[] value)
throws IOException {
return sendCmdS("alist_swap_and_sized_push",
key, "" + size + " " + value.length, value).isStored();
key, size + " " + value.length, value).isStored();
}

public boolean swapAndSizedPush(String key, int size, String value)
Expand All @@ -341,7 +342,7 @@ public boolean swapAndSizedPush(String key, int size, String value)
public boolean expiredSwapAndPush(String key, int expt, byte[] value)
throws IOException {
return sendCmdS("alist_expired_swap_and_push",
key, "" + expt + " " + value.length, value).isStored();
key, expt + " " + value.length, value).isStored();
}

public boolean expiredSwapAndPush(String key, int expt, String value)
Expand All @@ -352,7 +353,7 @@ public boolean expiredSwapAndPush(String key, int expt, String value)
public boolean expiredSwapAndSizedPush(
String key, int expt, int size, byte[] value) throws IOException {
return sendCmdS("alist_expired_swap_and_sized_push",
key, "" + expt + " " + size + " " + value.length, value).isStored();
key, expt + " " + size + " " + value.length, value).isStored();
}

public boolean expiredSwapAndSizedPush(
Expand All @@ -362,7 +363,7 @@ public boolean expiredSwapAndSizedPush(

public int updateAt(String key, int index, byte[] value) throws IOException {
String ret = sendCmdS("alist_update_at",
key, "" + index + " " + value.length, value).toString();
key, index + " " + value.length, value).toString();
if(ret.equals("STORED")) return 1;
else if(ret.equals("NOT_STORED")) return 0;
else if(ret.equals("NOT_FOUND")) return -2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;

import com.rakuten.rit.roma.romac4j.connection.RomaSocketPool;
import org.apache.log4j.Logger;

public class RomaClient extends ClientObject {
Expand All @@ -19,6 +19,11 @@ public RomaClient(String nodeId) {
super(nodeId);
}


public void setTimeout(int timeout) {
RomaSocketPool.getInstance().setTimeout(timeout);
}

public byte[] get(String key) throws IOException {
return sendCmdV("get", key).getValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,8 @@ public void returnConnection(Connection con) {
log.info("returnConnection() : close connection");
con.forceClose();
}

public synchronized void setTimeout(int timeout) {
this.timeout = timeout;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ private String getMklHash() {
private RoutingData getRoutingDump() {
Connection con = null;
RoutingData routingData = null;
Receiver rcv = new RoutingReceiver();

Receiver rcv = new RoutingReceiver(null);
try {
con = getConnection();
con.write("routingdump bin");
Expand All @@ -194,7 +195,15 @@ private RoutingData getRoutingDump() {

private class RoutingReceiver extends Receiver {
private byte[] value = null;


RoutingReceiver(){
this.value = null;
}

RoutingReceiver(RoutingReceiver routingReceiver){
this();
}

@Override
public void receive(Connection con) throws TimeoutException, IOException, ParseException {
int len = 0;
Expand Down