Note that there are some explanatory texts on larger screens.

plurals
  1. PORed5 - ArrayList in SharedObject being corrupted
    primarykey
    data
    text
    <p>Well, perhaps not corrupted as such.</p> <p>So, a little background. I've recently moved my Red5 powered game from a windows build of red5 to one running on Debian Squeeze. I have a game lobby which uses a shared object to maintain a list of the various available games.</p> <p>A single game is stored as a HashMap[String, Object] against it's game_id in said SharedObject. A couple of the properties of the HashMap are ArrayLists, specifically <em>players</em> (an ArrayList[Integer] of connected player id's) and <em>votes</em> (another ArrayList[Integer] of players who have submitted a vote)</p> <p>Whenever I make a change to either of these ArrayLists, something, somewhere goes wrong and I can no long write the HashMap to the SharedObject (setAttribute returns false)</p> <p>Creating a new game (server side):</p> <pre><code>HashMap&lt;String, Object&gt; game = new HashMap&lt;String, Object&gt;(); game.put("id", PendingGameManager.GAME_IDX); game.put("difficulty", difficulty); game.put("type", type); game.put("description", this.getDescription(type, difficulty)); game.put("players", new ArrayList&lt;Integer&gt;()); game.put("coords", coords); game.put("created", Calendar.getInstance().getTimeInMillis()); game.put("votes", new ArrayList&lt;Integer&gt;()); boolean success = this.gamesSO.setAttribute(Integer.toString(PendingGameManager.GAME_IDX), game); </code></pre> <p>This executes without problem, and <em>success</em> returns true.</p> <p>Later I retrieve the player array and make amendments:</p> <pre><code>HashMap&lt;String, Object&gt; game = (HashMap&lt;String, Object&gt;)this.gamesSO.getMapAttribute(Integer.toString(game_id)); ArrayList&lt;Integer&gt; players = (ArrayList&lt;Integer&gt;) game.get("players"); players.add(new Integer(Integer.parseInt((user_id)))); boolean success = this.gamesSO.setAttribute(Integer.toString(game_id), game); </code></pre> <p>here success <em>always</em> returns false. If a create a new HashMap for the game and copy across each property from the old one but omitting <em>players</em> and <em>votes</em> it is fine, but what ever try, I cannot get it to maintain an array. I've also tried this with List and Vector with the same results. This is my first contact with Java, I've been careful to only add class instances of Integer and not the primitive int but for all my efforts I have run out of ideas.</p> <p>When on Windows it ran <em>perfectly</em>, my original implementation used ArrayList[String] instead of ArrayList[Integer]</p> <p>Environment: Debian Squeeze 6.0.6 jre 1.7 Red5 1.0RC2</p> <p>Any help or suggestions would be greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload