You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Maurice Amsellem <ma...@systar.com> on 2013/11/06 02:05:16 UTC

RemoteOperation last result not garbage collected

Hi,

I discovered a not-so-known behavior of RemoteObject that could be useful to the community:

RemoteObject RemoteOperations are keeping a reference to the last call result, that can be retrieved through lastResult property.
Most of the time, you don't need that reference, as you will be processing the result in the result handlers.

For operations that are called often, and return small result, it's not an issue.
The problem raises if you have a RemoteObject with an operation that is called once (or only a few times) and returns a large result.  
This could be the case for operations that are called at initialization only, and that loads large results from the server.
In this case, the result of the last (and only) call, will not be garbage collected.

To avoid this, you must clear the result manually in the result handler:.

For example:

protected function handleGenericVOResult(resultEvent:ResultEvent, token:AsyncToken = null):void {
    var op: AbstractOperation = _remoteObject.getOperation(RemotingMessage(token.message).operation);
    op.clearResult(false);}
}

Hope this helps...

Maurice 


RE: RemoteOperation last result not garbage collected

Posted by Maurice Amsellem <ma...@systar.com>.
https://issues.apache.org/jira/browse/FLEX-33881

Please VOTE if you are interested in this feature.

Maurice 

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Envoyé : mercredi 6 novembre 2013 11:36
À : users@flex.apache.org
Objet : RE: RemoteOperation last result not garbage collected

That's what I was thinking about too.  Something like "keepLastResult=true|false".

I will create a JIRA for that.

Note: lastResult is actually managed in AbstractInvoker super class.

Maurice 

-----Message d'origine-----
De : christofer.dutz@c-ware.de [mailto:christofer.dutz@c-ware.de] 
Envoyé : mercredi 6 novembre 2013 11:28
À : users@flex.apache.org
Objet : AW: RemoteOperation last result not garbage collected

Hmmm ... gee ... I really forgott about this :-(

And I have to admit that I have never really used the lastResult of a remote objects function. 
How about extending RemoteObject with Parameters to turn this Feature off?

Chris

________________________________________
Von: Maurice Amsellem [maurice.amsellem@systar.com]
Gesendet: Mittwoch, 6. November 2013 02:05
An: users@flex.apache.org
Betreff: RemoteOperation last result not garbage collected

Hi,

I discovered a not-so-known behavior of RemoteObject that could be useful to the community:

RemoteObject RemoteOperations are keeping a reference to the last call result, that can be retrieved through lastResult property.
Most of the time, you don't need that reference, as you will be processing the result in the result handlers.

For operations that are called often, and return small result, it's not an issue.
The problem raises if you have a RemoteObject with an operation that is called once (or only a few times) and returns a large result.
This could be the case for operations that are called at initialization only, and that loads large results from the server.
In this case, the result of the last (and only) call, will not be garbage collected.

To avoid this, you must clear the result manually in the result handler:.

For example:

protected function handleGenericVOResult(resultEvent:ResultEvent, token:AsyncToken = null):void {
    var op: AbstractOperation = _remoteObject.getOperation(RemotingMessage(token.message).operation);
    op.clearResult(false);}
}

Hope this helps...

Maurice

RE: RemoteOperation last result not garbage collected

Posted by Maurice Amsellem <ma...@systar.com>.
That's what I was thinking about too.  Something like "keepLastResult=true|false".

I will create a JIRA for that.

Note: lastResult is actually managed in AbstractInvoker super class.

Maurice 

-----Message d'origine-----
De : christofer.dutz@c-ware.de [mailto:christofer.dutz@c-ware.de] 
Envoyé : mercredi 6 novembre 2013 11:28
À : users@flex.apache.org
Objet : AW: RemoteOperation last result not garbage collected

Hmmm ... gee ... I really forgott about this :-(

And I have to admit that I have never really used the lastResult of a remote objects function. 
How about extending RemoteObject with Parameters to turn this Feature off?

Chris

________________________________________
Von: Maurice Amsellem [maurice.amsellem@systar.com]
Gesendet: Mittwoch, 6. November 2013 02:05
An: users@flex.apache.org
Betreff: RemoteOperation last result not garbage collected

Hi,

I discovered a not-so-known behavior of RemoteObject that could be useful to the community:

RemoteObject RemoteOperations are keeping a reference to the last call result, that can be retrieved through lastResult property.
Most of the time, you don't need that reference, as you will be processing the result in the result handlers.

For operations that are called often, and return small result, it's not an issue.
The problem raises if you have a RemoteObject with an operation that is called once (or only a few times) and returns a large result.
This could be the case for operations that are called at initialization only, and that loads large results from the server.
In this case, the result of the last (and only) call, will not be garbage collected.

To avoid this, you must clear the result manually in the result handler:.

For example:

protected function handleGenericVOResult(resultEvent:ResultEvent, token:AsyncToken = null):void {
    var op: AbstractOperation = _remoteObject.getOperation(RemotingMessage(token.message).operation);
    op.clearResult(false);}
}

Hope this helps...

Maurice

AW: RemoteOperation last result not garbage collected

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
Hmmm ... gee ... I really forgott about this :-(

And I have to admit that I have never really used the lastResult of a remote objects function. 
How about extending RemoteObject with Parameters to turn this Feature off?

Chris

________________________________________
Von: Maurice Amsellem [maurice.amsellem@systar.com]
Gesendet: Mittwoch, 6. November 2013 02:05
An: users@flex.apache.org
Betreff: RemoteOperation last result not garbage collected

Hi,

I discovered a not-so-known behavior of RemoteObject that could be useful to the community:

RemoteObject RemoteOperations are keeping a reference to the last call result, that can be retrieved through lastResult property.
Most of the time, you don't need that reference, as you will be processing the result in the result handlers.

For operations that are called often, and return small result, it's not an issue.
The problem raises if you have a RemoteObject with an operation that is called once (or only a few times) and returns a large result.
This could be the case for operations that are called at initialization only, and that loads large results from the server.
In this case, the result of the last (and only) call, will not be garbage collected.

To avoid this, you must clear the result manually in the result handler:.

For example:

protected function handleGenericVOResult(resultEvent:ResultEvent, token:AsyncToken = null):void {
    var op: AbstractOperation = _remoteObject.getOperation(RemotingMessage(token.message).operation);
    op.clearResult(false);}
}

Hope this helps...

Maurice

Re: RemoteOperation last result not garbage collected

Posted by Cosma Colanicchia <co...@gmail.com>.
Never thought about this, thanks.


2013/11/6 Sugan Naicker <Su...@dev-x.co.za>

> Hi Maurice,
>
> Thanks for sharing!
>
> Regards,
>
> Sugan Naicker
> South Africa
>
>
>
> -----Original Message-----
> From: Maurice Amsellem [mailto:maurice.amsellem@systar.com]
> Sent: 06 November 2013 03:05 AM
> To: users@flex.apache.org
> Subject: RemoteOperation last result not garbage collected
>
> Hi,
>
> I discovered a not-so-known behavior of RemoteObject that could be useful
> to
> the community:
>
> RemoteObject RemoteOperations are keeping a reference to the last call
> result, that can be retrieved through lastResult property.
> Most of the time, you don't need that reference, as you will be processing
> the result in the result handlers.
>
> For operations that are called often, and return small result, it's not an
> issue.
> The problem raises if you have a RemoteObject with an operation that is
> called once (or only a few times) and returns a large result.
> This could be the case for operations that are called at initialization
> only, and that loads large results from the server.
> In this case, the result of the last (and only) call, will not be garbage
> collected.
>
> To avoid this, you must clear the result manually in the result handler:.
>
> For example:
>
> protected function handleGenericVOResult(resultEvent:ResultEvent,
> token:AsyncToken = null):void {
>     var op: AbstractOperation =
> _remoteObject.getOperation(RemotingMessage(token.message).operation);
>     op.clearResult(false);}
> }
>
> Hope this helps...
>
> Maurice
>
>
>

RE: RemoteOperation last result not garbage collected

Posted by Sugan Naicker <Su...@Dev-X.co.za>.
Hi Maurice,

Thanks for sharing!

Regards,

Sugan Naicker
South Africa



-----Original Message-----
From: Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Sent: 06 November 2013 03:05 AM
To: users@flex.apache.org
Subject: RemoteOperation last result not garbage collected

Hi,

I discovered a not-so-known behavior of RemoteObject that could be useful to
the community:

RemoteObject RemoteOperations are keeping a reference to the last call
result, that can be retrieved through lastResult property.
Most of the time, you don't need that reference, as you will be processing
the result in the result handlers.

For operations that are called often, and return small result, it's not an
issue.
The problem raises if you have a RemoteObject with an operation that is
called once (or only a few times) and returns a large result.  
This could be the case for operations that are called at initialization
only, and that loads large results from the server.
In this case, the result of the last (and only) call, will not be garbage
collected.

To avoid this, you must clear the result manually in the result handler:.

For example:

protected function handleGenericVOResult(resultEvent:ResultEvent,
token:AsyncToken = null):void {
    var op: AbstractOperation =
_remoteObject.getOperation(RemotingMessage(token.message).operation);
    op.clearResult(false);}
}

Hope this helps...

Maurice 



RE: RemoteOperation last result not garbage collected

Posted by Maurice Amsellem <ma...@systar.com>.
Implemented as designed:
https://issues.apache.org/jira/browse/FLEX-33881

Will be available in next nightly build...

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Envoyé : jeudi 7 novembre 2013 10:51
À : users@flex.apache.org; paul.hastings@gmail.com
Objet : RE: RemoteOperation last result not garbage collected

>Isn't it true that lastResult is used in binding expressions which is why it has to be "sticky? 
> And don't you normally have references to data from the lastResult around in your app until the next invocation?

I understand now: this is the MXML way of handling RemoteObject operation results, in very simple cases.
I am doing everything in ActionScript using result Handlers to have better control.

>But also, what could possibly break if you add a flag and default it to the old behavior?  If nothing, feel free to add it.
Will do.

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] Envoyé : jeudi 7 novembre 2013 06:12 À : users@flex.apache.org; paul.hastings@gmail.com Objet : Re: RemoteOperation last result not garbage collected

Isn't it true that lastResult is used in binding expressions which is why it has to be "sticky?  And don't you normally have references to data from the lastResult around in your app until the next invocation?

But also, what could possibly break if you add a flag and default it to the old behavior?  If nothing, feel free to add it.

-Alex

On 11/6/13 4:40 AM, "Maurice Amsellem" <ma...@systar.com> wrote:

>I am not an expert of the matter, but since this behavior is 
>implemented in AbstractInvoker, which is the base class of all remote 
>application, then I guess it applies.
>You can easily check by yourself...
>
>Maurice
>
>-----Message d'origine-----
>De : Paul Hastings [mailto:paul.hastings@gmail.com] Envoyé : mercredi 6 
>novembre 2013 13:27 À : users@flex.apache.org Objet : Re:
>RemoteOperation last result not garbage collected
>
>On 11/6/2013 8:05 AM, Maurice Amsellem wrote:
>> I discovered a not-so-known behavior of RemoteObject that could be 
>>useful to the community:
>>
>> RemoteObject RemoteOperations are keeping a reference to the last 
>>call result, that can be retrieved through lastResult property.
>> Most of the time, you don't need that reference, as you will be 
>>processing the result in the result handlers.
>
>interesting find. we have some apps that make a bunch of REST calls to 
>ESRI's arcGIS server & i guess this would be applicable.
>
>but does this apply to all remoting calls? what about to/from 
>coldfusion or blazeDS? we've only ever cared about ResultEvents from 
>these & never bothered w/tokens.
>
>


RE: RemoteOperation last result not garbage collected

Posted by Maurice Amsellem <ma...@systar.com>.
>Isn't it true that lastResult is used in binding expressions which is why it has to be "sticky? 
> And don't you normally have references to data from the lastResult around in your app until the next invocation?

I understand now: this is the MXML way of handling RemoteObject operation results, in very simple cases.
I am doing everything in ActionScript using result Handlers to have better control.

>But also, what could possibly break if you add a flag and default it to the old behavior?  If nothing, feel free to add it.
Will do.

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : jeudi 7 novembre 2013 06:12
À : users@flex.apache.org; paul.hastings@gmail.com
Objet : Re: RemoteOperation last result not garbage collected

Isn't it true that lastResult is used in binding expressions which is why it has to be "sticky?  And don't you normally have references to data from the lastResult around in your app until the next invocation?

But also, what could possibly break if you add a flag and default it to the old behavior?  If nothing, feel free to add it.

-Alex

On 11/6/13 4:40 AM, "Maurice Amsellem" <ma...@systar.com> wrote:

>I am not an expert of the matter, but since this behavior is 
>implemented in AbstractInvoker, which is the base class of all remote 
>application, then I guess it applies.
>You can easily check by yourself...
>
>Maurice
>
>-----Message d'origine-----
>De : Paul Hastings [mailto:paul.hastings@gmail.com] Envoyé : mercredi 6 
>novembre 2013 13:27 À : users@flex.apache.org Objet : Re: 
>RemoteOperation last result not garbage collected
>
>On 11/6/2013 8:05 AM, Maurice Amsellem wrote:
>> I discovered a not-so-known behavior of RemoteObject that could be 
>>useful to the community:
>>
>> RemoteObject RemoteOperations are keeping a reference to the last 
>>call result, that can be retrieved through lastResult property.
>> Most of the time, you don't need that reference, as you will be 
>>processing the result in the result handlers.
>
>interesting find. we have some apps that make a bunch of REST calls to 
>ESRI's arcGIS server & i guess this would be applicable.
>
>but does this apply to all remoting calls? what about to/from 
>coldfusion or blazeDS? we've only ever cared about ResultEvents from 
>these & never bothered w/tokens.
>
>


Re: RemoteOperation last result not garbage collected

Posted by Paul Hastings <pa...@gmail.com>.
On 11/7/2013 12:12 PM, Alex Harui wrote:
> Isn't it true that lastResult is used in binding expressions which is why
> it has to be "sticky?  And don't you normally have references to data from
> the lastResult around in your app until the next invocation?

for remoting w/coldfusion we pretty much always take the results & stick them 
into something else or use as a test that the server side process succeeded. 
either way nobody cares about the event result after its returned.

in any case, i confused myself when i read maurice's "lastResult" as 
"lastRequest" ;-) so, yes it does apply to coldfusion remoting & yes it's 
probably a good idea.


Re: RemoteOperation last result not garbage collected

Posted by Alex Harui <ah...@adobe.com>.
Isn't it true that lastResult is used in binding expressions which is why
it has to be "sticky?  And don't you normally have references to data from
the lastResult around in your app until the next invocation?

But also, what could possibly break if you add a flag and default it to
the old behavior?  If nothing, feel free to add it.

-Alex

On 11/6/13 4:40 AM, "Maurice Amsellem" <ma...@systar.com> wrote:

>I am not an expert of the matter, but since this behavior is implemented
>in AbstractInvoker, which is the base class of all remote application,
>then I guess it applies.
>You can easily check by yourself...
>
>Maurice
>
>-----Message d'origine-----
>De : Paul Hastings [mailto:paul.hastings@gmail.com]
>Envoyé : mercredi 6 novembre 2013 13:27
>À : users@flex.apache.org
>Objet : Re: RemoteOperation last result not garbage collected
>
>On 11/6/2013 8:05 AM, Maurice Amsellem wrote:
>> I discovered a not-so-known behavior of RemoteObject that could be
>>useful to the community:
>>
>> RemoteObject RemoteOperations are keeping a reference to the last call
>>result, that can be retrieved through lastResult property.
>> Most of the time, you don't need that reference, as you will be
>>processing the result in the result handlers.
>
>interesting find. we have some apps that make a bunch of REST calls to
>ESRI's arcGIS server & i guess this would be applicable.
>
>but does this apply to all remoting calls? what about to/from coldfusion
>or blazeDS? we've only ever cared about ResultEvents from these & never
>bothered w/tokens.
>
>


RE: RemoteOperation last result not garbage collected

Posted by Maurice Amsellem <ma...@systar.com>.
I am not an expert of the matter, but since this behavior is implemented in AbstractInvoker, which is the base class of all remote application, then I guess it applies.
You can easily check by yourself...

Maurice

-----Message d'origine-----
De : Paul Hastings [mailto:paul.hastings@gmail.com] 
Envoyé : mercredi 6 novembre 2013 13:27
À : users@flex.apache.org
Objet : Re: RemoteOperation last result not garbage collected

On 11/6/2013 8:05 AM, Maurice Amsellem wrote:
> I discovered a not-so-known behavior of RemoteObject that could be useful to the community:
>
> RemoteObject RemoteOperations are keeping a reference to the last call result, that can be retrieved through lastResult property.
> Most of the time, you don't need that reference, as you will be processing the result in the result handlers.

interesting find. we have some apps that make a bunch of REST calls to ESRI's arcGIS server & i guess this would be applicable.

but does this apply to all remoting calls? what about to/from coldfusion or blazeDS? we've only ever cared about ResultEvents from these & never bothered w/tokens.



Re: RemoteOperation last result not garbage collected

Posted by Paul Hastings <pa...@gmail.com>.
On 11/6/2013 8:05 AM, Maurice Amsellem wrote:
> I discovered a not-so-known behavior of RemoteObject that could be useful to the community:
>
> RemoteObject RemoteOperations are keeping a reference to the last call result, that can be retrieved through lastResult property.
> Most of the time, you don't need that reference, as you will be processing the result in the result handlers.

interesting find. we have some apps that make a bunch of REST calls to ESRI's 
arcGIS server & i guess this would be applicable.

but does this apply to all remoting calls? what about to/from coldfusion or 
blazeDS? we've only ever cared about ResultEvents from these & never bothered 
w/tokens.