You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Brian Tol <br...@imagegroup.com> on 2001/12/06 20:32:00 UTC

JJar activity

Hello,

I'm curious on the status of the JJar project and a CPAN-like Java
repository in general. JJar seems to be a useful tool, but it looks like
there has been little progress on it in the last few months. I'm part of
a group interested in working on a CPAN for java, but we don't want to
overlook other such projects if they exist.

Thanks in advance for any help/advice!

- Brian 

Brian Tol
briant@imagegroup.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


abaut SoftRefHashMap implementation

Posted by Juozas Baliuka <ba...@mwm.lt>.
Hi,
I wrote two days ago, but I thik it was poor described.
I think good implementation for SoftHashMap can be useful, but not current 
implementation :

1) SoftRefHashMap has public method purge(), it iterates all values and 
searches removed references.
this method must  be private , because application don't know then to know 
then to call it, If it knows, this Map
don't need java.lang.ref.*. SoftHashMap must call this method it self. 
Purge must be implemented using java.lang.ref.ReferenceQueue to detect 
collected referants.

2) Implementation on Soft values is not useful, must be implemented on keys
  (if you don't like standard Weak Map ). it can be useful on values, if 
you hold strong references on keys,
but if hold strong references on keys may be you don't need a Map( use 
referense as class's field),
or clone keys.
Class for keys final and not cloneable or you not sure hold reference on 
key or not ?
It is possible, you have a bug in your application's architecture .

3) SoftRefHashMap must be final, factory method may be good idea, if you 
implementing map with refences
on keys. if you implementing this on values, both purge and factory method 
must be abstract.

It is may modified SoftRefHashMap code with reference values, it is better, 
but not good ( Use WeakHasmap !!! ):

public final class SoftRefHashMap implements Map {

     java.lang.ref.ReferenceQueue queue = new java.lang.ref.ReferenceQueue();

     static class SoftValueRef extends java.lang.ref.SoftReference{

         private Object key;

         public SoftValueRef(Object referent,Object key, ReferenceQueue q){

             super(referent,q);

             this.key = key;

         }

     }
private void purge() {

         try{

             while(true)
                 hashMap.remove(((SoftValueRef)queue.poll()).key);

         }catch(java.lang.NullPointerException npe){

         }
     }

private Map getMap() {

         purge();
         return hashMap;

     }
  public Object put( final Object key, final Object value ) {

         Object answer = getMap().put( key, new 
SoftValueRef(value,key,queue) );

         if ( answer != null )
             return ((Reference) answer).get();

         return null;

     }
    ----------------------------------------------------------------




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JJar activity

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 12/6/01 2:32 PM, "Brian Tol" <br...@imagegroup.com> wrote:

> Hello,
> 
> I'm curious on the status of the JJar project and a CPAN-like Java
> repository in general. JJar seems to be a useful tool, but it looks like
> there has been little progress on it in the last few months. I'm part of
> a group interested in working on a CPAN for java, but we don't want to
> overlook other such projects if they exist.

Cool beans.

I actually have a bit of committing to do.  I have been reworking some parts
of it to make a better namespace for projects.  Also refactored a bit to
make a better API for apps to use, and some other stuff I can't remember.

I am finishing up another little project now, and will get back to that ASAP
so you can get a complete picture of where it currently is.

Geir

> 
> Thanks in advance for any help/advice!
> 
> - Brian 
> 
> Brian Tol
> briant@imagegroup.com
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>