org.jgroups.util.Util.pickNext()方法的使用及代码示例

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

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

Util.pickNext介绍

[英]Returns the next min(N,list.size()) elements after obj
[中]返回obj之后的下一个min(N,list.size())元素

代码示例

代码示例来源:origin: wildfly/wildfly

  1. protected Address determinePingDest() {
  2. if(pingable_mbrs == null || local_addr == null)
  3. return null;
  4. Address next=Util.pickNext(pingable_mbrs, local_addr);
  5. return Objects.equals(local_addr, next) ? null : next;
  6. }

代码示例来源:origin: wildfly/wildfly

  1. protected void handleView(View view) {
  2. view_size=view.size();
  3. Address tmp=Util.pickNext(view.getMembers(), local_addr);
  4. if(tmp != null && !tmp.equals(local_addr)) {
  5. next=tmp;
  6. if(log.isDebugEnabled())
  7. log.debug("next=" + next);
  8. }
  9. }

代码示例来源:origin: wildfly/wildfly

  1. protected void handleView(View view) {
  2. this.view=view;
  3. if(log.isDebugEnabled())
  4. log.debug("view=" + view);
  5. List<Address> members=view.getMembers();
  6. Address old_coord=coord;
  7. if(!members.isEmpty())
  8. coord=members.get(0);
  9. if(Objects.equals(coord, local_addr)) {
  10. List<Address> old_backups=backup_coords != null? new ArrayList<>(backup_coords) : null;
  11. backup_coords=new CopyOnWriteArrayList<>(Util.pickNext(members, local_addr, num_backups));
  12. // send the current values to all *new* backups
  13. List<Address> new_backups=Util.newElements(old_backups,backup_coords);
  14. for(Address new_backup: new_backups) {
  15. for(Map.Entry<String,VersionedValue> entry: counters.entrySet()) {
  16. UpdateRequest update=new UpdateRequest(entry.getKey(), entry.getValue().value, entry.getValue().version);
  17. sendRequest(new_backup, update);
  18. }
  19. }
  20. }
  21. else
  22. backup_coords=null;
  23. if(old_coord != null && coord != null && !old_coord.equals(coord) && local_addr.equals(coord)) {
  24. discard_requests=true; // set to false when the task is done
  25. startReconciliationTask();
  26. }
  27. }

代码示例来源:origin: wildfly/wildfly

  1. public void handleView(View view) {
  2. super.handleView(view);
  3. Address old_coord=coord;
  4. if(view.size() > 0) {
  5. coord=view.getCoord();
  6. is_coord=coord.equals(local_addr);
  7. log.debug("[%s] coord=%s, is_coord=%b", local_addr, coord, is_coord);
  8. }
  9. if(is_coord && num_backups > 0) {
  10. List<Address> new_backups=Util.pickNext(view.getMembers(), local_addr, num_backups);
  11. List<Address> copy_locks_list=null;
  12. synchronized(backups) {
  13. if(!backups.equals(new_backups)) {
  14. copy_locks_list=new ArrayList<>(new_backups);
  15. copy_locks_list.removeAll(backups);
  16. backups.clear();
  17. backups.addAll(new_backups);
  18. }
  19. }
  20. if(copy_locks_list != null && !copy_locks_list.isEmpty())
  21. copyLocksTo(copy_locks_list);
  22. }
  23. // For all non-acquired client locks, send the GRANT_LOCK request to the new coordinator (if changed)
  24. if(old_coord != null && !old_coord.equals(coord))
  25. client_lock_table.resendPendingLockRequests();
  26. }

代码示例来源:origin: wildfly/wildfly

  1. List<Address> new_backups=Util.pickNext(view.getMembers(), local_addr, num_backups);
  2. List<Address> new_members=null;
  3. synchronized(backups) {
  4. List<Address> possiblebackups = Util.pickNext(view.getMembers(),
  5. coord, num_backups);

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. protected Address determinePingDest() {
  2. if(pingable_mbrs == null || local_addr == null)
  3. return null;
  4. Address next=Util.pickNext(pingable_mbrs, local_addr);
  5. return Objects.equals(local_addr, next) ? null : next;
  6. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. protected void handleView(View view) {
  2. this.view=view;
  3. if(log.isDebugEnabled())
  4. log.debug("view=" + view);
  5. List<Address> members=view.getMembers();
  6. Address old_coord=coord;
  7. if(!members.isEmpty())
  8. coord=members.get(0);
  9. if(Objects.equals(coord, local_addr)) {
  10. List<Address> old_backups=backup_coords != null? new ArrayList<>(backup_coords) : null;
  11. backup_coords=new CopyOnWriteArrayList<>(Util.pickNext(members, local_addr, num_backups));
  12. // send the current values to all *new* backups
  13. List<Address> new_backups=Util.newElements(old_backups,backup_coords);
  14. for(Address new_backup: new_backups) {
  15. for(Map.Entry<String,VersionedValue> entry: counters.entrySet()) {
  16. UpdateRequest update=new UpdateRequest(entry.getKey(), entry.getValue().value, entry.getValue().version);
  17. sendRequest(new_backup, update);
  18. }
  19. }
  20. }
  21. else
  22. backup_coords=null;
  23. if(old_coord != null && coord != null && !old_coord.equals(coord) && local_addr.equals(coord)) {
  24. discard_requests=true; // set to false when the task is done
  25. startReconciliationTask();
  26. }
  27. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. protected void handleView(View view) {
  2. view_size=view.size();
  3. Address tmp=Util.pickNext(view.getMembers(), local_addr);
  4. if(tmp != null && !tmp.equals(local_addr)) {
  5. next=tmp;
  6. if(log.isDebugEnabled())
  7. log.debug("next=" + next);
  8. }
  9. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. public void handleView(View view) {
  2. super.handleView(view);
  3. Address old_coord=coord;
  4. if(view.size() > 0) {
  5. coord=view.getCoord();
  6. is_coord=coord.equals(local_addr);
  7. log.debug("[%s] coord=%s, is_coord=%b", local_addr, coord, is_coord);
  8. }
  9. if(is_coord && num_backups > 0) {
  10. List<Address> new_backups=Util.pickNext(view.getMembers(), local_addr, num_backups);
  11. List<Address> copy_locks_list=null;
  12. synchronized(backups) {
  13. if(!backups.equals(new_backups)) {
  14. copy_locks_list=new ArrayList<>(new_backups);
  15. copy_locks_list.removeAll(backups);
  16. backups.clear();
  17. backups.addAll(new_backups);
  18. }
  19. }
  20. if(copy_locks_list != null && !copy_locks_list.isEmpty())
  21. copyLocksTo(copy_locks_list);
  22. }
  23. // For all non-acquired client locks, send the GRANT_LOCK request to the new coordinator (if changed)
  24. if(old_coord != null && !old_coord.equals(coord))
  25. client_lock_table.resendPendingLockRequests();
  26. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. List<Address> new_backups=Util.pickNext(view.getMembers(), local_addr, num_backups);
  2. List<Address> new_members=null;
  3. synchronized(backups) {
  4. List<Address> possiblebackups = Util.pickNext(view.getMembers(),
  5. coord, num_backups);

相关文章

Util类方法