本文整理了Java中sun.misc.Unsafe.putOrderedInt()
方法的一些代码示例,展示了Unsafe.putOrderedInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unsafe.putOrderedInt()
方法的具体详情如下:
包路径:sun.misc.Unsafe
类名称:Unsafe
方法名:putOrderedInt
[英]Lazy set an int field.
[中]设置一个整型字段。
代码示例来源:origin: LMAX-Exchange/disruptor
private void setAvailableBufferValue(int index, int flag)
{
long bufferAddress = (index * SCALE) + BASE;
UNSAFE.putOrderedInt(availableBuffer, bufferAddress, flag);
}
代码示例来源:origin: ben-manes/caffeine
void lazySetDrainStatus(int drainStatus) {
UnsafeAccess.UNSAFE.putOrderedInt(this, DRAIN_STATUS_OFFSET, drainStatus);
}
代码示例来源:origin: alibaba/jstorm
private void setAvailableBufferValue(int index, int flag) {
long bufferAddress = (index * SCALE) + BASE;
UNSAFE.putOrderedInt(availableBuffer, bufferAddress, flag);
}
代码示例来源:origin: reactor/reactor-core
private void setAvailableBufferValue(int index, int flag)
{
long bufferAddress = (index * SCALE) + BASE;
UNSAFE.putOrderedInt(availableBuffer, bufferAddress, flag);
}
代码示例来源:origin: JCTools/JCTools
@Override
protected final void writeRelease(long offset, int callTypeId) {
assert callTypeId != 0;
UNSAFE.putOrderedInt(null, offset, callTypeId);
}
代码示例来源:origin: JCTools/JCTools
@Override
protected final void writeRelease(long offset, int type) {
assert type != 0;
UNSAFE.putOrderedInt(null, offset, type);
}
代码示例来源:origin: robovm/robovm
/**
* Eventually sets to the given value.
*
* @param newValue the new value
* @since 1.6
*/
public final void lazySet(boolean newValue) {
int v = newValue ? 1 : 0;
unsafe.putOrderedInt(this, valueOffset, v);
}
代码示例来源:origin: robovm/robovm
/**
* Eventually sets to the given value.
*
* @param newValue the new value
* @since 1.6
*/
public final void lazySet(int newValue) {
unsafe.putOrderedInt(this, valueOffset, newValue);
}
代码示例来源:origin: JCTools/JCTools
@Override
protected final void writeRelease(long offset, int callTypeId) {
UNSAFE.putOrderedInt(null, offset, callTypeId);
}
代码示例来源:origin: JCTools/JCTools
protected final void writeReleaseState(long offset) {
UNSAFE.putOrderedInt(null, offset, WRITE_RELEASE_INDICATOR);
}
代码示例来源:origin: JCTools/JCTools
protected final void writeAcquireState(long offset) {
UNSAFE.putOrderedInt(null, offset, WRITE_ACQUIRE_INDICATOR);
}
代码示例来源:origin: JCTools/JCTools
protected final void readAcquireState(long offset) {
UNSAFE.putOrderedInt(null, offset, READ_ACQUIRE_INDICATOR);
}
代码示例来源:origin: ben-manes/caffeine
void setRelaxedInt(int value) {
UnsafeAccess.UNSAFE.putOrderedInt(this, RelaxedFields.IVALUE_OFFSET, value);
}
代码示例来源:origin: robovm/robovm
/**
* Eventually sets the element at position {@code i} to the given value.
*
* @param i the index
* @param newValue the new value
* @since 1.6
*/
public final void lazySet(int i, int newValue) {
unsafe.putOrderedInt(array, checkedByteOffset(i), newValue);
}
代码示例来源:origin: real-logic/agrona
public void putIntOrdered(final long index, final int value)
{
if (SHOULD_BOUNDS_CHECK)
{
boundsCheck0(index, SIZE_OF_INT);
}
UNSAFE.putOrderedInt(null, addressOffset + index, value);
}
代码示例来源:origin: real-logic/agrona
public int addIntOrdered(final int index, final int increment)
{
if (SHOULD_BOUNDS_CHECK)
{
boundsCheck0(index, SIZE_OF_INT);
}
final long offset = addressOffset + index;
final byte[] byteArray = this.byteArray;
final int value = UNSAFE.getInt(byteArray, offset);
UNSAFE.putOrderedInt(byteArray, offset, value + increment);
return value;
}
代码示例来源:origin: real-logic/agrona
public int addIntOrdered(final long index, final int increment)
{
if (SHOULD_BOUNDS_CHECK)
{
boundsCheck0(index, SIZE_OF_INT);
}
final long offset = addressOffset + index;
final int value = UNSAFE.getInt(null, offset);
UNSAFE.putOrderedInt(null, offset, value + increment);
return value;
}
代码示例来源:origin: real-logic/agrona
public void putIntOrdered(final int index, final int value)
{
if (SHOULD_BOUNDS_CHECK)
{
boundsCheck0(index, SIZE_OF_INT);
}
UNSAFE.putOrderedInt(byteArray, addressOffset + index, value);
}
代码示例来源:origin: robovm/robovm
public void lazySet(T obj, int newValue) {
if (obj == null || obj.getClass() != tclass || cclass != null) fullCheck(obj);
unsafe.putOrderedInt(obj, offset, newValue);
}
代码示例来源:origin: fengjiachun/Jupiter
protected void setException(Throwable t) {
if (UNSAFE.compareAndSwapInt(this, stateOffset, NEW, COMPLETING)) {
outcome = t;
// putOrderedInt在JIT后会通过intrinsic优化掉StoreLoad屏障, 不保证可见性
UNSAFE.putOrderedInt(this, stateOffset, EXCEPTIONAL); // final state
finishCompletion(t);
}
}
内容来源于网络,如有侵权,请联系作者删除!