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
23 changes: 23 additions & 0 deletions src/main/java/net/spy/memcached/collection/ByteArrayBKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@

public class ByteArrayBKey implements Comparable<ByteArrayBKey> {

/**
* @deprecated Replaced by {@link ByteArrayBKey#getMin()}
*/
@Deprecated
public static final byte[] MIN = new byte[]{(byte) 0};

/**
* @deprecated Replaced by {@link ByteArrayBKey#getMax()}
*/
@Deprecated
public static final byte[] MAX = new byte[]{(byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255,
Expand All @@ -34,6 +42,21 @@ public class ByteArrayBKey implements Comparable<ByteArrayBKey> {
(byte) 255, (byte) 255, (byte) 255, (byte) 255
};

public static byte[] getMin() {
return new byte[]{(byte) 0};
}

public static byte[] getMax() {
return new byte[]{(byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255,
(byte) 255, (byte) 255, (byte) 255, (byte) 255
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uhm0311 @oliviarla @brido4125
맀번 객체λ₯Ό μƒμ„±ν•˜μ—¬ μ‚¬μš©ν•˜κ³  GC ν•˜λŠ” 것 보닀, κΈ°μ‘΄ μ½”λ“œκ°€ λ‚˜μ•„ λ³΄μž…λ‹ˆλ‹€.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맀번 객체λ₯Ό μƒμ„±ν•˜μ§€ μ•ŠλŠ” 점이 λ¬Έμ œκ°€ λ˜λŠ” μ½”λ“œμž…λ‹ˆλ‹€.

AS-IS

ByteArrayBKey.MIN[0] = 10;
System.out.println(ByteArrayBKey.MIN[0]); // 10

TO-BE

ByteArrayBKey.getMin()[0] = 10;
System.out.println(ByteArrayBKey.getMin()[0]); // 0


private final byte[] bkey;

public ByteArrayBKey(byte[] bkey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ void testGetBulkLongBkeyGetAll() {
ElementFlagFilter filter = ElementFlagFilter.DO_NOT_FILTER;

CollectionGetBulkFuture<Map<String, BTreeGetResult<ByteArrayBKey, Object>>> f = mc
.asyncBopGetBulk(keyList, ByteArrayBKey.MIN,
ByteArrayBKey.MAX, filter, 0, 10);
.asyncBopGetBulk(keyList, ByteArrayBKey.getMin(),
ByteArrayBKey.getMax(), filter, 0, 10);

Map<String, BTreeGetResult<ByteArrayBKey, Object>> results = f.get(
1000L, TimeUnit.MILLISECONDS);
Expand Down Expand Up @@ -158,8 +158,8 @@ void testGetBulkNotFoundAll() {
ElementFlagFilter filter = ElementFlagFilter.DO_NOT_FILTER;

CollectionGetBulkFuture<Map<String, BTreeGetResult<ByteArrayBKey, Object>>> f = mc
.asyncBopGetBulk(keyList, ByteArrayBKey.MIN,
ByteArrayBKey.MAX, filter, 0, 10);
.asyncBopGetBulk(keyList, ByteArrayBKey.getMin(),
ByteArrayBKey.getMax(), filter, 0, 10);

Map<String, BTreeGetResult<ByteArrayBKey, Object>> results = f.get(
1000L, TimeUnit.MILLISECONDS);
Expand Down Expand Up @@ -210,8 +210,8 @@ void testGetBulkNotFoundMixed() {
ElementFlagFilter filter = ElementFlagFilter.DO_NOT_FILTER;

CollectionGetBulkFuture<Map<String, BTreeGetResult<ByteArrayBKey, Object>>> f = mc
.asyncBopGetBulk(keyList, ByteArrayBKey.MIN,
ByteArrayBKey.MAX, filter, 0, 10);
.asyncBopGetBulk(keyList, ByteArrayBKey.getMin(),
ByteArrayBKey.getMax(), filter, 0, 10);

Map<String, BTreeGetResult<ByteArrayBKey, Object>> results = f.get(
1000L, TimeUnit.MILLISECONDS);
Expand Down