Cleanup PlatformDependent* code

Motivation:

PlatformDependent* contains some methods that are not used and some other things that can be cleaned-up.

Modifications:

- Remove unused methods
- cleanup

Result:

Code cleanup.
This commit is contained in:
Norman Maurer 2017-01-17 21:11:01 +01:00
parent 876818a7d2
commit 01d747ab83
2 changed files with 5 additions and 16 deletions

View File

@ -50,10 +50,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -418,10 +415,6 @@ public final class PlatformDependent {
return PlatformDependent0.getLong(data, index);
}
public static void putOrderedObject(Object object, long address, Object value) {
PlatformDependent0.putOrderedObject(object, address, value);
}
public static void putByte(long address, byte value) {
PlatformDependent0.putByte(address, value);
}

View File

@ -84,7 +84,7 @@ final class PlatformDependent0 {
addressField = (Field) maybeAddressField;
logger.debug("java.nio.Buffer.address: available");
} else {
logger.debug("java.nio.Buffer.address: unavailable", (Exception) maybeAddressField);
logger.debug("java.nio.Buffer.address: unavailable", (Throwable) maybeAddressField);
addressField = null;
}
}
@ -147,7 +147,7 @@ final class PlatformDependent0 {
} else {
// Unsafe.copyMemory(Object, long, Object, long, long) unavailable.
unsafe = null;
logger.debug("sun.misc.Unsafe.copyMemory: unavailable", (Exception) maybeException);
logger.debug("sun.misc.Unsafe.copyMemory: unavailable", (Throwable) maybeException);
}
}
} else {
@ -172,7 +172,7 @@ final class PlatformDependent0 {
@Override
public Object run() {
try {
final Constructor constructor =
final Constructor<?> constructor =
direct.getClass().getDeclaredConstructor(long.class, int.class);
constructor.setAccessible(true);
return constructor;
@ -188,7 +188,7 @@ final class PlatformDependent0 {
address = UNSAFE.allocateMemory(1);
// try to use the constructor now
try {
((Constructor) maybeDirectBufferConstructor).newInstance(address, 1);
((Constructor<?>) maybeDirectBufferConstructor).newInstance(address, 1);
directBufferConstructor = (Constructor<?>) maybeDirectBufferConstructor;
logger.debug("direct buffer constructor: available");
} catch (InstantiationException e) {
@ -201,7 +201,7 @@ final class PlatformDependent0 {
} else {
logger.debug(
"direct buffer constructor: unavailable",
(Exception) maybeDirectBufferConstructor);
(Throwable) maybeDirectBufferConstructor);
directBufferConstructor = null;
}
} finally {
@ -357,10 +357,6 @@ final class PlatformDependent0 {
return UNSAFE.getLong(data, BYTE_ARRAY_BASE_OFFSET + index);
}
static void putOrderedObject(Object object, long address, Object value) {
UNSAFE.putOrderedObject(object, address, value);
}
static void putByte(long address, byte value) {
UNSAFE.putByte(address, value);
}