Issue closed, code is mistaken

> Hello all!

> I'm facing the following effect: several flash clients (two) connects
> to a SharedObject and listens changes issued from server side via
> onSync listener. Everything works, clients disconnects.

> After several reconnects (often at the second connect) w/o server
> restarts, flash client does not receive any notifications of SO
> changes. Everything works at server side, so.setAttribute(...) is
> invoked - but a client does not get anything.

> Any thoughts?
> Can this be due to an application Exception occur?
> Can 'onSharedObjectDelete()' be not invoked on
> SO removal in attached ISharedObjectListener?

> Serverside code:

> public class RoomService implements IRoomService {
>     /** Map of roomId -> roomSO */
>     private static final Map<Long, ISharedObject> roomSOs
>             = Collections.synchronizedMap(new WeakHashMap<Long, 
> ISharedObject>());

>     /** SharedObject service */
>     @NotNull private final ISharedObjectService soService;

>     /** Application scope */
>     @NotNull private final IScope scope;

>             
>     public void handle(@NotNull String roomId, @NotNull Map<String,
> Object> event) throws AppException {
>            ...
>         // Post to others
>         // Obtain SO ref
>         final ISharedObject roomSO = getRoomSO(roomId);
>         
>         // Send event to all the stakeholders via the queue attr update
>         roomSO.setAttribute(EVENT_QUEUE, event);
>     }

>     /**
>      * Creates SO for a room
>      * @param roomId Id of the room
>      * @return SO assotiated with a room with the given Id 
>      */
>     protected ISharedObject getRoomSO(@NotNull final Long roomId) {
>         ISharedObject roomSO = roomSOs.get(roomId);
>         if (roomSO == null) {
>             // If absent, create (or get if has been GCed from map for some 
> reason)
>             String soId = "room_" + roomId;
>             roomSO = soService.getSharedObject(scope, soId);
>             if (roomSO == null) {
>                // Create and get
>                soService.createSharedObject(scope, soId, false);
>                roomSO = soService.getSharedObject(scope, soId);
>                // Paranoid
>                if (roomSO == null) throw new
> IllegalStateException("Unable to get and unable to create
> SharedObject with name = '" + soId + '\'');
>                // Add listener for guaranteed removal from map @ onDelete
>                roomSO.addSharedObjectListener(new 
> SharedObjectListenerAdapter() {
>                    @Override public void
> onSharedObjectDelete(ISharedObjectBase so, String key) {
>                        roomSOs.remove(roomId);
>                    }
>                });
>             }

>             // Put into map
>             roomSOs.put(roomId, roomSO);
>         }
>         
>         return roomSO;
>     }
> }

> Thanks in advance,
> Alex.


> _______________________________________________
> Red5 mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/red5_osflash.org



-- 
Best regards,
 Alexey                            mailto:[EMAIL PROTECTED]


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to