Comments (5)
For now, I'm going to switch that specific piece of code to use the function that gets a Client array (which I added back in ago in a recent commit under the alternate function name getClients_alt() )
from mud-server.
You can't modify a collection while iterating over it. This is a better fix:
public Vector<Client> getClients() {
return new ArrayList<Client>(clients);
}
It's almost always better to use collections and this just copies the current one.
from mud-server.
Do point out if I misunderstand. The thing is that it's possible to try to modify them and that could happen, and would then throw an exception. How is that an improvement? True it's a collection, but I can iterate over an array as well.
from mud-server.
You can iterate over either, especially since they are copies. It's only bad if you modify the original collection. But working with arrays might mean you later want to modify it and can't. Working with an ArrayList means you get all of the functionality of an array and an arraylist at essentially no cost, including things like contains().
From: Jeremy Harton [email protected]
To: jnharton/mud-server [email protected]
Cc: joshgit [email protected]
Sent: Friday, February 1, 2013 9:01 PM
Subject: Re: [mud-server] Problem with concurrent modification regarding the collection of client objects the server holds (#7)
Do point out if I misunderstand. The thing is that it's possible to try to modify them and that could happen, and would then throw an exception. How is that an improvement? True it's a collection, but I can iterate over an array as well.
—
Reply to this email directly or view it on GitHub.
from mud-server.
issue ought to be re-evaluated post merge.
from mud-server.
Related Issues (20)
- exit handling borked (post PR #15) HOT 2
- Add Intermud chat functionality (IMC 3 a.ka. I3 in this case)
- Overhauling chat HOT 1
- Name References - Evaluation HOT 1
- Review mail system (Mail/Mailbox) HOT 1
- add JSON data storage (spells, database?, etc)
- initialization of items and placement in room
- Issues with determining whether a player is new for the purposes of character generation HOT 3
- Problem with Greet command (identifying unknown players)
- Database dependent data may not be kept separate with regard to different database files
- Room Editor: setflag command HOT 1
- Exit names (what you send to use them) may not contain some characters HOT 1
- AttackCommand issues
- Quest System issues with tasks on primary quest object shared across all copies of the Quest HOT 1
- loadRaces uses google-gson library
- Need to properly make object data persistent
- Any plan use the maven to build? HOT 1
- Finish implementing Zone Editor
- Finish implementing Quest Editor
- complete quest system overhaul
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mud-server.