Garo Garabedyan's Divergent Thinking Blog

java.lang.ref.* in GoogleWebToolkit ?

leave a comment »

Is java.lang.ref.* functioning in GWT? I come to an idea that java.lang.ref.* is necessary to enable proper garbage collection while implementing the Observer pattern in Model View Controller.

I was writing a big Java code for GWT for my school final project to make a program that at that days was modern to call Rich Internet Applications (RIA). I have implemented the full MVC by making the model to be a fully functional object (at that time only a Bean object carrier but able to implement business logic if having this need in future) which updates by request to the server made in a definite period of time. I have enabled different views to edit at one time one object by implementing the Observer pattern. After I have finished the project I realized that a newly created view will never be collected by the garbage collector because always its model has a reference to it in order to update it when an update is received from the server.

Now I think that by implementing java.lang.ref.* in the client side (translating to written by hand JavaScript code that adds and can manages new type of object references) many people can avoid their own implementation of object release algorithm used to classify the significant (regular) and not significant (which do not require object existance at all) object references.

Link to GoogleWebToolkit Discussion Forum thread on “java.lang.ref.* in GoogleWebToolkit ?”.

Garbage collection in Java and design patterns https://garabedyan.wordpress.com/2008/01/08/garbage-collection-in-java-and-design-patterns/

Written by garabedyan

November 18, 2008 at 09:21

Leave a comment