Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Based on your red5 version info, this is the implementation of the method "setAttribute":</p> <pre><code>@Override public boolean setAttribute(String name, Object value) { log.debug("setAttribute - name: {} value: {}", name, value); boolean result = true; ownerMessage.addEvent(Type.CLIENT_UPDATE_ATTRIBUTE, name, null); if (value == null &amp;&amp; super.removeAttribute(name)) { // Setting a null value removes the attribute modified = true; syncEvents.add(new SharedObjectEvent(Type.CLIENT_DELETE_DATA, name, null)); deleteStats.incrementAndGet(); } else if (value != null &amp;&amp; super.setAttribute(name, value)) { // only sync if the attribute changed modified = true; syncEvents.add(new SharedObjectEvent(Type.CLIENT_UPDATE_DATA, name, value)); changeStats.incrementAndGet(); } else { result = false; } notifyModified(); return result; } </code></pre> <p>I guess value is != null (but I could be wrong). But in my opinion it would forward that call to its parent class with the "super.setAttribute" call, this is the implementation of the parent/super class:</p> <pre><code>/** * Set an attribute on this object. * * @param name the name of the attribute to change * @param value the new value of the attribute * @return true if the attribute value was added or changed, otherwise false */ public boolean setAttribute(String name, Object value) { if (name != null) { if (value != null) { // update with new value Object previous = attributes.put(name, value); // previous will be null if the attribute didn't exist return (previous == null || !value.equals(previous)); } } return false; } </code></pre> <p>The important line here (IMHO): </p> <pre><code>return (previous == null || !value.equals(previous)); </code></pre> <p>=> "previous" cannot be found, and then it returns false.</p> <p>The issue is I think: This cast that you are doing:</p> <pre><code>HashMap&lt;String, Object&gt; game = (HashMap&lt;String, Object&gt;)this.gamesSO.getMapAttribute(Integer.toString(game_id)); </code></pre> <p>I don't think that "this.gamesSO.getMapAttribute(Integer.toString(game_id));" will return HashMap, I think I can remember that Red5 has its own Map type.</p> <p>If you simply debug and add a:</p> <pre><code>System.out.println(this.gamesSO.getMapAttribute(Integer.toString(game_id))); </code></pre> <p>and/or add some debug breakpoint and verify what type exactly this is. And then cast to this one really. </p> <p>I think you should also specify the Map more detailed. Something like:</p> <pre><code> HashMap&lt;String, MyPlayerBean&gt; </code></pre> <p>And create a class MyPlayerBean, with the attributes you really need. Making those Map/List objects might be handy to get started quickly but it can get quite ugly if your application starts to grow.</p> <p>Sebastian</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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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