com.eclipsesource.v8.V8.checkReleased()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.eclipsesource.v8.V8.checkReleased()方法的一些代码示例,展示了V8.checkReleased()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。V8.checkReleased()方法的具体详情如下:
包路径:com.eclipsesource.v8.V8
类名称:V8
方法名:checkReleased

V8.checkReleased介绍

暂无

代码示例

代码示例来源:origin: eclipsesource/J2V8

/**
 * If {@link V8Value#setWeak()} has been called on this Object, this method
 * will return true. Otherwise it will return false.
 *
 * @return Returns true if this object has been set 'Weak', return false otherwise.
 */
public boolean isWeak() {
  v8.checkThread();
  v8.checkReleased();
  return v8.isWeak(v8.getV8RuntimePtr(), getHandle());
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Clears any weak reference set on this V8Value and makes this a strong
 * reference. Strong references will not be garbage collected and this
 * Object must be explicitly released.
 *
 * Calling clearWeak does nothing if the object is not currently set
 * to weak.
 *
 * @return The receiver.
 */
public V8Value clearWeak() {
  v8.checkThread();
  v8.checkReleased();
  v8.v8WeakReferences.remove(getHandle());
  v8.clearWeak(v8.getV8RuntimePtr(), getHandle());
  return this;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the 'type' of this V8Value. The available types are defined
 * as constants in {@link V8Value}. Only types that inherit from
 * {@link V8Value} can be returned here.
 *
 * @return The 'type of this V8Value.
 */
public int getV8Type() {
  if (isUndefined()) {
    return UNDEFINED;
  }
  v8.checkThread();
  v8.checkReleased();
  return v8.getType(v8.getV8RuntimePtr(), objectHandle);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the V8Value as weak reference. A weak reference will eventually
 * be closed when no more references exist to this object. Once setWeak
 * is called, you should check if {@link V8Value#isReleased()} is true
 * before invoking any methods on this object.
 *
 * If any other references exist to this object, the object will not be
 * reclaimed. Even if no reference exist, V8 does not give any guarantee
 * the object will be closed, so this should only be used if there is no
 * other way to track object usage.
 *
 * @return The receiver.
 */
public V8Value setWeak() {
  v8.checkThread();
  v8.checkReleased();
  v8.v8WeakReferences.put(getHandle(), this);
  v8.setWeak(v8.getV8RuntimePtr(), getHandle());
  return this;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Creates a new Java object pointing at the same V8 Value
 * as this. If the value is mutated (by adding new members or
 * changing existing ones) then both the original and twin
 * will be updated. Twins are .equal and .strict equals, but
 * not == in Java.
 *
 * Twins must be closed separately since they have their own
 * native resources.
 *
 * @return A new Java object pointing at the same V8 Value
 * as this.
 */
public V8Value twin() {
  if (isUndefined()) {
    return this;
  }
  v8.checkThread();
  v8.checkReleased();
  V8Value twin = createTwin();
  v8.createTwin(this, twin);
  return twin;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * If {@link V8Value#setWeak()} has been called on this Object, this method
 * will return true. Otherwise it will return false.
 *
 * @return Returns true if this object has been set 'Weak', return false otherwise.
 */
public boolean isWeak() {
  v8.checkThread();
  v8.checkReleased();
  return v8.isWeak(v8.getV8RuntimePtr(), getHandle());
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Clears any weak reference set on this V8Value and makes this a strong
 * reference. Strong references will not be garbage collected and this
 * Object must be explicitly released.
 *
 * Calling clearWeak does nothing if the object is not currently set
 * to weak.
 *
 * @return The receiver.
 */
public V8Value clearWeak() {
  v8.checkThread();
  v8.checkReleased();
  v8.v8WeakReferences.remove(getHandle());
  v8.clearWeak(v8.getV8RuntimePtr(), getHandle());
  return this;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Returns the 'type' of this V8Value. The available types are defined
 * as constants in {@link V8Value}. Only types that inherit from
 * {@link V8Value} can be returned here.
 *
 * @return The 'type of this V8Value.
 */
public int getV8Type() {
  if (isUndefined()) {
    return UNDEFINED;
  }
  v8.checkThread();
  v8.checkReleased();
  return v8.getType(v8.getV8RuntimePtr(), objectHandle);
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Sets the V8Value as weak reference. A weak reference will eventually
 * be closed when no more references exist to this object. Once setWeak
 * is called, you should check if {@link V8Value#isReleased()} is true
 * before invoking any methods on this object.
 *
 * If any other references exist to this object, the object will not be
 * reclaimed. Even if no reference exist, V8 does not give any guarantee
 * the object will be closed, so this should only be used if there is no
 * other way to track object usage.
 *
 * @return The receiver.
 */
public V8Value setWeak() {
  v8.checkThread();
  v8.checkReleased();
  v8.v8WeakReferences.put(getHandle(), this);
  v8.setWeak(v8.getV8RuntimePtr(), getHandle());
  return this;
}

代码示例来源:origin: eclipsesource/J2V8

/**
 * Creates a new Java object pointing at the same V8 Value
 * as this. If the value is mutated (by adding new members or
 * changing existing ones) then both the original and twin
 * will be updated. Twins are .equal and .strict equals, but
 * not == in Java.
 *
 * Twins must be closed separately since they have their own
 * native resources.
 *
 * @return A new Java object pointing at the same V8 Value
 * as this.
 */
public V8Value twin() {
  if (isUndefined()) {
    return this;
  }
  v8.checkThread();
  v8.checkReleased();
  V8Value twin = createTwin();
  v8.createTwin(this, twin);
  return twin;
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_win32_x86_64

/**
 * Returns the backing store used for this ArrayBuffer.
 *
 * @return The backing store used for this ArrayBuffer.
 */
public ByteBuffer getBackingStore() {
  v8.checkReleased();
  v8.checkThread();
  return byteBuffer;
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_macosx_x86_64

/**
 * Returns the backing store used for this ArrayBuffer.
 *
 * @return The backing store used for this ArrayBuffer.
 */
public ByteBuffer getBackingStore() {
  v8.checkReleased();
  v8.checkThread();
  return byteBuffer;
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_win32_x86_64

/**
 * Creates a new Java object pointing at the same V8 Value
 * as this. If the value is mutated (by adding new members or
 * changing existing ones) then both the original and twin
 * will be updated. Twins are .equal and .strict equals, but
 * not == in Java.
 *
 * Twins must be released separately since they have their own
 * native resources.
 *
 * @return A new Java object pointing at the same V8 Value
 * as this.
 */
public V8Value twin() {
  if (isUndefined()) {
    return this;
  }
  v8.checkThread();
  v8.checkReleased();
  V8Value twin = createTwin();
  v8.createTwin(this, twin);
  return twin;
}

代码示例来源:origin: com.eclipsesource.j2v8/j2v8_macosx_x86_64

/**
 * Creates a new Java object pointing at the same V8 Value
 * as this. If the value is mutated (by adding new members or
 * changing existing ones) then both the original and twin
 * will be updated. Twins are .equal and .strict equals, but
 * not == in Java.
 *
 * Twins must be released separately since they have their own
 * native resources.
 *
 * @return A new Java object pointing at the same V8 Value
 * as this.
 */
public V8Value twin() {
  if (isUndefined()) {
    return this;
  }
  v8.checkThread();
  v8.checkReleased();
  V8Value twin = createTwin();
  v8.createTwin(this, twin);
  return twin;
}

相关文章

V8类方法