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

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

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

Mutex.postReadRequest介绍

[英]Posts a read request. This request runs immediately iff this Mutex is in the shared mode or this Mutex is not contended at all. This request is delayed if this Mutex is in the exclusive mode and is held by this thread, until the exclusive is left. Finally, this request blocks, if this Mutex is in the exclusive mode and is held by another thread.

Warning: this method blocks.
[中]发布读取请求。如果此互斥体处于共享模式或根本没有竞争,则此请求立即运行。如果此互斥锁处于独占模式并由该线程持有,则此请求将被延迟,直到独占状态消失。最后,如果这个互斥锁处于独占模式并且由另一个线程持有,那么这个请求将被阻止。
警告:此方法会阻止。

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-util

public static final void invoke(Runnable r) {
  Mutex.EVENT.postReadRequest(r);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-projectapi-nb

@Override
public void postReadRequest(Runnable run) {
  owner.MUTEX.postReadRequest(run);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

@Override
public void propertyChange(PropertyChangeEvent evt) {
  String prop = evt.getPropertyName();
  if (prop != null && !propertyNames.contains(evt.getPropertyName())) {
    // Not interesting to us.
    return;
  }
  // Coalesce changes; can come in fast after huge CP changes (#47910):
  if (!dirty.getAndSet(true)) {
    ProjectManager.mutex().postReadRequest(this);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

private void runDeferred(final Runnable r) {
  ProjectManager.mutex().postReadRequest(new Runnable() {
    @Override
    public void run() {                
      ProjectManager.mutex().postWriteRequest(r);
    }
  });
}

代码示例来源:origin: dcaoyuan/nbscala

public boolean canUpdate () {
  if (TRANSPARENT_UPDATE) {
    return true;
  }
  //Ask just once under a single write access
  if (alreadyAskedInWriteAccess) {
    return false;
  }
  else {
    boolean canUpdate = showUpdateDialog();
    if (!canUpdate) {
      alreadyAskedInWriteAccess = true;
      ProjectManager.mutex().postReadRequest(new Runnable() {
        public void run() {
          alreadyAskedInWriteAccess = false;
        }
      });
    }
    return canUpdate;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-ejbjarproject

public boolean canUpdate() {
  //Ask just once under a single write access
  if (alreadyAskedInWriteAccess) {
    return false;
  }
  else {
    boolean canUpdate = showUpdateDialog();
    if (!canUpdate) {
      alreadyAskedInWriteAccess = true;
      ProjectManager.mutex().postReadRequest(new Runnable() {
        public void run() {
          alreadyAskedInWriteAccess = false;
        }
      });
    }
    return canUpdate;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-clientproject

public boolean canUpdate() {
  if (TRANSPARENT_UPDATE) {
    return true;
  }
  //Ask just once under a single write access
  if (alreadyAskedInWriteAccess) {
    return false;
  }
  else {
    boolean canUpdate = showUpdateDialog();
    if (!canUpdate) {
      alreadyAskedInWriteAccess = true;
      ProjectManager.mutex().postReadRequest(new Runnable() {
        public void run() {
          alreadyAskedInWriteAccess = false;
        }
      });
    }
    return canUpdate;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project

public boolean canUpdate () {
  if (TRANSPARENT_UPDATE) {
    return true;
  }
  //Ask just once under a single write access
  if (alreadyAskedInWriteAccess) {
    return false;
  }
  else {
    boolean canUpdate = showUpdateDialog();
    if (!canUpdate) {
      alreadyAskedInWriteAccess = true;
      ProjectManager.mutex().postReadRequest(new Runnable() {
        public void run() {
          alreadyAskedInWriteAccess = false;
        }
      });
    }
    return canUpdate;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-project

private boolean canUpdate () {
  if (TRANSPARENT_UPDATE) {
    return true;
  }
  //Ask just once under a single write access
  if (alreadyAskedInWriteAccess) {
    return false;
  }
  else {
    boolean canUpdate = this.notifier.canUpdate();
    if (!canUpdate) {
      alreadyAskedInWriteAccess = true;
      ProjectManager.mutex().postReadRequest(new Runnable() {
        public void run() {
          alreadyAskedInWriteAccess = false;
        }
      });
    }
    return canUpdate;
  }
}

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

public void valueChanged(TreeSelectionEvent ev) {
  
  TreePath[] paths = tree.getSelectionPaths ();
  storeSelectedPaths = Arrays.asList (paths == null ? new TreePath[0] : paths);
  
  if (paths == null) {
    // part of bugfix #37279, if DnD is active then is useless select a nearby node
    if (ExplorerDnDManager.getDefault().isDnDActive()) {
      return ;
    }
    callSelectionChanged (new Node[0]);
  } else {
    // we need to force no changes to nodes hierarchy =>
    // we are requesting read request, but it is not necessary
    // to execute the next action immediatelly, so postReadRequest
    // should be enough
    readAccessPaths = paths;
    Children.MUTEX.postReadRequest(this);
  }
}

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

public void valueChanged(TreeSelectionEvent ev) {
  
  TreePath[] paths = tree.getSelectionPaths ();
  storeSelectedPaths = Arrays.asList (paths == null ? new TreePath[0] : paths);
  
  if (paths == null) {
    // part of bugfix #37279, if DnD is active then is useless select a nearby node
    if (ExplorerDnDManager.getDefault().isDnDActive()) {
      return ;
    }
    callSelectionChanged (new Node[0]);
  } else {
    // we need to force no changes to nodes hierarchy =>
    // we are requesting read request, but it is not necessary
    // to execute the next action immediatelly, so postReadRequest
    // should be enough
    readAccessPaths = paths;
    Children.MUTEX.postReadRequest(this);
  }
}

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

@Override
public void valueChanged(TreeSelectionEvent ev) {
  TreePath[] paths = tree.getSelectionPaths();
  if (paths == null) {
    // part of bugfix #37279, if DnD is active then is useless select a nearby node
    if (ExplorerDnDManager.getDefault().isDnDActive()) {
      return;
    }
    callSelectionChanged(new Node[0]);
  } else {
    // we need to force no changes to nodes hierarchy =>
    // we are requesting read request, but it is not necessary
    // to execute the next action immediatelly, so postReadRequest
    // should be enough
    readAccessPaths = paths;
    Children.MUTEX.postReadRequest(this);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf

ProjectManager.mutex().postReadRequest(new Runnable() {
  public void run() {
    try{
  } else {
    ProjectManager.mutex().postReadRequest(new Runnable() {
      public void run() {
        try {

相关文章