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

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

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

Mutex.doEventAccess介绍

[英]Methods for access to event queue and waiting for result.
[中]

代码示例

代码示例来源: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

/** 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

return doEventAccess(action);

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

return doEventAccess(action);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** 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 Object readAccess (Action action) {
  if (this == EVENT) {
    try {
      return doEventAccess (action);
    } catch (MutexException e) {
  InternalError err = new InternalError("Exception from non-Exception Action"); // NOI18N
  ErrorManager.getDefault().annotate(err, e.getException());
  throw err;
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

return doEventAccess (action);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** 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 Object readAccess (Action action) {
  if (this == EVENT) {
    try {
      return doEventAccess (action);
    } catch (MutexException e) {
  InternalError err = new InternalError("Exception from non-Exception Action"); // NOI18N
  ErrorManager.getDefault().annotate(err, e.getException());
  throw err;
    }
  }
  Thread t = Thread.currentThread();
  readEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** 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 Object writeAccess (Action action) {
  if (this == EVENT) {
    try {
      return doEventAccess (action);
    } catch (MutexException e) {
  InternalError err = new InternalError("Exception from non-Exception Action"); // NOI18N
  ErrorManager.getDefault().annotate(err, e.getException());
  throw err;
    }
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** 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 Object writeAccess (Action action) {
  if (this == EVENT) {
    try {
      return doEventAccess (action);
    } catch (MutexException e) {
  InternalError err = new InternalError("Exception from non-Exception Action"); // NOI18N
  ErrorManager.getDefault().annotate(err, e.getException());
  throw err;
    }
  }
  Thread t = Thread.currentThread();
  writeEnter(t);
  try {
    return action.run();
  } finally {
    leave(t);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

return doEventAccess (action);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

return doEventAccess (action);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

return doEventAccess (action);

代码示例来源: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: in.jlibs/org-openide-util

return doEventAccess(action);

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

return doEventAccess(action);

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

return doEventAccess(action);

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

return doEventAccess(action);

相关文章