org.openide.util.Mutex.doWrapperAccess()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(90)

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

Mutex.doWrapperAccess介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Run an action with read access, returning no result.
* It may be run asynchronously.
*
* @param action the action to perform
* @see #readAccess(Mutex.Action)
*/
public void readAccess(final Runnable action) {
  if (this == EVENT) {
    doEvent(action);
    return;
  }
  if (wrapper != null) {
    try {
      doWrapperAccess(null, action, true);
      return;
    } catch (MutexException ex) {
      throw new IllegalStateException(ex);
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Run an action with write access and return no result.
* It may be run asynchronously.
*
* @param action the action to perform
* @see #writeAccess(Mutex.Action)
* @see #readAccess(Runnable)
*/
public void writeAccess(final Runnable action) {
  if (this == EVENT) {
    doEvent(action);
    return;
  }
  if (wrapper != null) {
    try {
      doWrapperAccess(null, action, false);
    } catch (MutexException ex) {
      throw new IllegalStateException(ex);
    }
    return;
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Run an action with write access.
* The same thread may meanwhile reenter the mutex; see the class description for details.
*
* @param action the action to perform
* @return the result of {@link Mutex.Action#run}
*/
public <T> T writeAccess(Action<T> action) {
  if (this == EVENT) {
    try {
      return doEventAccess(action);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  if (wrapper != null) {
    try {
      return doWrapperAccess(action, null, false);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util

/** Run an action only with read access.
* See class description re. entering for write access within the dynamic scope.
* @param action the action to perform
* @return the object returned from {@link Mutex.Action#run}
*/
public <T> T readAccess(final Action<T> action) {
  if (this == EVENT) {
    try {
      return doEventAccess(action);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  if (wrapper != null) {
    try {
      return doWrapperAccess(action, null, true);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util

return doWrapperAccess(action, null, false);

代码示例来源:origin: org.netbeans.api/org-openide-util

return doWrapperAccess(action, null, true);

代码示例来源:origin: in.jlibs/org-openide-util

/** Run an action with write access and return no result.
* It may be run asynchronously.
*
* @param action the action to perform
* @see #writeAccess(Mutex.Action)
* @see #readAccess(Runnable)
*/
public void writeAccess(final Runnable action) {
  if (this == EVENT) {
    doEvent(action);
    return;
  }
  if (wrapper != null) {
    try {
      doWrapperAccess(null, action, false);
    } catch (MutexException ex) {
      throw (IllegalStateException)new IllegalStateException().initCause(ex);
    }
    return;
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: in.jlibs/org-openide-util

/** Run an action with read access, returning no result.
* It may be run asynchronously.
*
* @param action the action to perform
* @see #readAccess(Mutex.Action)
*/
public void readAccess(final Runnable action) {
  if (this == EVENT) {
    doEvent(action);
    return;
  }
  if (wrapper != null) {
    try {
      doWrapperAccess(null, action, true);
      return;
    } catch (MutexException ex) {
      throw (IllegalStateException)new IllegalStateException().initCause(ex);
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

/** Run an action with read access, returning no result.
* It may be run asynchronously.
*
* @param action the action to perform
* @see #readAccess(Mutex.Action)
*/
public void readAccess(final Runnable action) {
  if (this == EVENT) {
    doEvent(action);
    return;
  }
  if (wrapper != null) {
    try {
      doWrapperAccess(null, action, true);
      return;
    } catch (MutexException ex) {
      throw new IllegalStateException(ex);
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

/** Run an action with write access and return no result.
* It may be run asynchronously.
*
* @param action the action to perform
* @see #writeAccess(Mutex.Action)
* @see #readAccess(Runnable)
*/
public void writeAccess(final Runnable action) {
  if (this == EVENT) {
    doEvent(action);
    return;
  }
  if (wrapper != null) {
    try {
      doWrapperAccess(null, action, false);
    } catch (MutexException ex) {
      throw new IllegalStateException(ex);
    }
    return;
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

/** Run an action only with read access.
* See class description re. entering for write access within the dynamic scope.
* @param action the action to perform
* @return the object returned from {@link Mutex.Action#run}
*/
public <T> T readAccess(final Action<T> action) {
  if (this == EVENT) {
    try {
      return doEventAccess(action);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  if (wrapper != null) {
    try {
      return doWrapperAccess(action, null, true);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: in.jlibs/org-openide-util

/** Run an action only with read access.
* See class description re. entering for write access within the dynamic scope.
* @param action the action to perform
* @return the object returned from {@link Mutex.Action#run}
*/
public <T> T readAccess(final Action<T> action) {
  if (this == EVENT) {
    try {
      return doEventAccess(action);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  if (wrapper != null) {
    try {
      return doWrapperAccess(action, null, true);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: in.jlibs/org-openide-util

/** Run an action with write access.
* The same thread may meanwhile reenter the mutex; see the class description for details.
*
* @param action the action to perform
* @return the result of {@link Mutex.Action#run}
*/
public <T> T writeAccess(Action<T> action) {
  if (this == EVENT) {
    try {
      return doEventAccess(action);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  if (wrapper != null) {
    try {
      return doWrapperAccess(action, null, false);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

/** Run an action with write access.
* The same thread may meanwhile reenter the mutex; see the class description for details.
*
* @param action the action to perform
* @return the result of {@link Mutex.Action#run}
*/
public <T> T writeAccess(Action<T> action) {
  if (this == EVENT) {
    try {
      return doEventAccess(action);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  if (wrapper != null) {
    try {
      return doWrapperAccess(action, null, false);
    } catch (MutexException e) {
      throw (InternalError) new InternalError("Exception from non-Exception Action").initCause(e.getException()); // NOI18N
    }
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

return doWrapperAccess(action, null, false);

代码示例来源:origin: in.jlibs/org-openide-util

return doWrapperAccess(action, null, false);

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

return doWrapperAccess(action, null, true);

代码示例来源:origin: in.jlibs/org-openide-util

return doWrapperAccess(action, null, true);

相关文章