Java Code Examples for java.util.ConcurrentModificationException#printStackTrace()

The following examples show how to use java.util.ConcurrentModificationException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OwnVotesFragment.java    From tron-wallet-android with Apache License 2.0 6 votes vote down vote up
private void loadVotedWitnesses() {
    mVotedWitnesses.clear();
    for(Protocol.Vote vote : mAccount.getVotesList()) {
        try {
            for (Protocol.Witness witness : mWitnesses) {
                try {
                    if (Arrays.equals(vote.getVoteAddress().toByteArray(), witness.getAddress().toByteArray())) {
                        mVotedWitnesses.add(witness);
                        break;
                    }
                } catch (NullPointerException ignore) {
                }
            }
        }
        catch (ConcurrentModificationException e) {
            e.printStackTrace();
        }
    }

    mWitnessItemListAdapter.notifyDataSetChanged();
}
 
Example 2
Source File: HelperSetAction.java    From iGap-Android with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * send cancel for files
 *
 * @param messageId unique number that we have in start upload and end of that
 */

public static void sendCancel(final long messageId) {
    try {
        for (StructAction struct : structActions) {
            if (struct.messageId == messageId) {

                if (struct.chatType.toString().equals(ProtoGlobal.Room.Type.GROUP.toString())) {
                    new RequestGroupSetAction().groupSetAction(struct.roomId, ProtoGlobal.ClientAction.CANCEL, struct.randomKey);
                } else {
                    new RequestChatSetAction().chatSetAction(struct.roomId, ProtoGlobal.ClientAction.CANCEL, struct.randomKey);
                }

                removeStruct(struct.randomKey);
            }
        }
    } catch (ConcurrentModificationException e) {
        G.handler.postDelayed(new Runnable() { // resend after one second
            @Override
            public void run() {
                sendCancel(messageId);
            }
        }, 1000);
        e.printStackTrace();
    }
}
 
Example 3
Source File: PartyImpl.java    From Parties with GNU Affero General Public License v3.0 6 votes vote down vote up
@NonNull
@Override
public Set<PartyPlayer> getOnlineMembers(boolean bypassVanish) {
	HashSet<PartyPlayer> ret = new HashSet<>();
	lock.lock();
	try {
		for (PartyPlayerImpl player : onlineMembers) {
			if (bypassVanish || !player.isVanished())
				ret.add(player);
		}
	} catch (ConcurrentModificationException ex) {
		// Avoiding ConcurrentModificationException if something edits the hashmap
		ex.printStackTrace();
	}
	lock.unlock();
	return Collections.unmodifiableSet(ret);
}
 
Example 4
Source File: TestUserGroupInformation.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
  while(runThread) {
    try {
      UserGroupInformation.getCurrentUser().getCredentials();
    } catch (ConcurrentModificationException cme) {
      this.cme = cme;
      cme.printStackTrace();
      runThread = false;
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
}
 
Example 5
Source File: CircuitState.java    From Logisim with GNU General Public License v3.0 5 votes vote down vote up
void processDirtyPoints() {
	HashSet<Location> dirty = new HashSet<Location>(dirtyPoints);
	dirtyPoints.clear();
	if (circuit.wires.isMapVoided()) {
		for (int i = 3; i >= 0; i--) {
			try {
				dirty.addAll(circuit.wires.points.getSplitLocations());
				break;
			} catch (ConcurrentModificationException e) {
				// try again...
				try {
					Thread.sleep(1);
				} catch (InterruptedException e2) {
				}
				if (i == 0)
					e.printStackTrace();
			}
		}
	}
	if (!dirty.isEmpty()) {
		circuit.wires.propagate(this, dirty);
	}

	CircuitState[] subs = new CircuitState[substates.size()];
	for (CircuitState substate : substates.toArray(subs)) {
		substate.processDirtyPoints();
	}
}
 
Example 6
Source File: TestUserGroupInformation.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
  while(runThread) {
    try {
      UserGroupInformation.getCurrentUser().getCredentials();
    } catch (ConcurrentModificationException cme) {
      this.cme = cme;
      cme.printStackTrace();
      runThread = false;
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
}
 
Example 7
Source File: NetworkUtil.java    From DoingDaily with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    try {
        if (NETWORKCONNECTIVITYCHANGELISTENERLIST != null && !NETWORKCONNECTIVITYCHANGELISTENERLIST.isEmpty()) {
            boolean isConnectivity = isNetworkConnectivity(context);
            for (NetworkConnectivityChangeListener listener : NETWORKCONNECTIVITYCHANGELISTENERLIST) {
                listener.networkConnectivityChange(isConnectivity);
            }
        }
    } catch (ConcurrentModificationException e) {
        e.printStackTrace();
    }
}
 
Example 8
Source File: CableTickHandler.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onTick(TickEvent.ServerTickEvent tick) {
	try {
		if(tick.phase == Phase.END) {
			NetworkRegistry.dataNetwork.tickAllNetworks();
			NetworkRegistry.energyNetwork.tickAllNetworks();
			NetworkRegistry.liquidNetwork.tickAllNetworks();
		}
	} catch (ConcurrentModificationException e) {
		e.printStackTrace();
	}
}