You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by in...@dvholten.de on 2009/06/03 17:48:32 UTC

small increments

hi folks,

are you interested in putting forward jdk5/6 - usage in OpenJPA ?
As a starter I would offer to replace Numbers.valueOf(x) by 
Integer.valueOf(x) (and Short/Long etc).
Next step would be adding generification to most Iterators.
And i saw a number of places which 'manually' close Connections, 
Statements and ResultSets.
I propose to collect these into a small utility-method which checks for 
null, closes and takes care of SQLExceptions.

Iff so, how ? One big patch or many small ?

CLA is no problem, you find it in the Batik-folder.

greetings from sunny Hamburg
dieter von holten

Re: small increments

Posted by Pinaki Poddar <pp...@apache.org>.
Hi Milosz,
> As for caching integers, Integer.valueOf(int) does caching. At least in
> Sun's JDK 5:
  Thanks -- did not know that.



-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/small-increments-tp3019067p3025661.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Re: small increments

Posted by MiƂosz Tylenda <mt...@o2.pl>.
Hi!

As for caching integers, Integer.valueOf(int) does caching. At least in Sun's JDK 5:

    /**
     * Returns a <tt>Integer</tt> instance representing the specified
     * <tt>int</tt> value.
     * If a new <tt>Integer</tt> instance is not required, this method
     * should generally be used in preference to the constructor
     * {@link #Integer(int)}, as this method is likely to yield
     * significantly better space and time performance by caching
     * frequently requested values.
     *
     * @param  i an <code>int</code> value.
     * @return a <tt>Integer</tt> instance representing <tt>i</tt>.
     * @since  1.5
     */
    public static Integer valueOf(int i) {
	final int offset = 128;
	if (i >= -128 && i <= 127) { // must cache 
	    return IntegerCache.cache[i + offset];
	}
        return new Integer(i);
    }

Greetings,
Milosz

> 
> Hi,
>   A previous discussion [3] led to the conclusion that OpenJPA should
> continue supporting JDK5 runtime. But OpenJPA libraries itself are compiled
> with JDK6 compiler. Certain parts of JPA 2.0 specification is making it
> mandatory that JPA applications compile and run only in JDK6 -- and we are
> trying to make those parts of the specification optional to retain the
> ability to support JDK5 runtime. 
> 
> The major issue to move to JDK6 was supporting JDBC4 (refer OPENJPA-5 [1]). 
> Also, readability can be improved and a degree of type-safety can be
> achieved by more widespread usage of generics throughout the core OpenJPA
> codebase [2]. Some of the suggestions in your post has been addressed in
> [2]. 
> 
>   Please note that Numbers.valueOf() caches. Not exactly same as
> Integer.valueOf().
> In any case, smaller commits/patches are preferred to the larger ones.
> 
> 
> [1] http://issues.apache.org/jira/browse/OPENJPA-5
> [2] http://issues.apache.org/jira/browse/OPENJPA-1050
> [3]
> http://n2.nabble.com/-DISCUSS--Drop-build-support-for-Java-5--tc2539470.html#a2545464
> 
> 
> 
> -----
> Pinaki Poddar                      http://ppoddar.blogspot.com/
>                                       
> http://www.linkedin.com/in/pinakipoddar
> OpenJPA PMC Member/Committer
> JPA Expert Group Member
> -- 
> View this message in context: http://n2.nabble.com/small-increments-tp3019067p3019630.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
> 
> 

Re: small increments

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  May not need a new JIRA. You can attach the patch on OPENJPA-1050.

 

info-124 wrote:
> 
> ok, done.
> 
> when i get feedback, i can prepare the other top-level-folders as well, 
> one be one.
> 
> greetings
> dieter von holten
> 
> 


-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/small-increments-tp3019067p3025655.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Re: small increments

Posted by in...@dvholten.de.
ok, done.

when i get feedback, i can prepare the other top-level-folders as well, 
one be one.

greetings
dieter von holten

Re: small increments

Posted by Donald Woods <dw...@apache.org>.
Opening a JIRA and attaching the patch would be the next step, so we can 
review your proposed changes.

Info on creating a JIRA and patch can be found at -
http://openjpa.apache.org/found-a-bug.html
http://openjpa.apache.org/get-involved.html


-Donald


info@dvholten.de wrote:
> Hello,
> 
> thanks for the info. My changes would be in line with JDK5.
> As a starter, I prepared a patch-file for the changes under folder 
> openjpa-jdbc.
> The changes are based on the trunk, which was updated locally before i 
> started (few hours ago).
> So, what to do with it? Attach to some message in this mail-list? Open a 
> JIRA-issue? Send to you?
> 
> greetings
> dieter von holten
> 
> 

Re: small increments

Posted by in...@dvholten.de.
Hello,

thanks for the info. My changes would be in line with JDK5.
As a starter, I prepared a patch-file for the changes under folder 
openjpa-jdbc.
The changes are based on the trunk, which was updated locally before i 
started (few hours ago).
So, what to do with it? Attach to some message in this mail-list? Open a 
JIRA-issue? Send to you?

greetings
dieter von holten


Re: small increments

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  A previous discussion [3] led to the conclusion that OpenJPA should
continue supporting JDK5 runtime. But OpenJPA libraries itself are compiled
with JDK6 compiler. Certain parts of JPA 2.0 specification is making it
mandatory that JPA applications compile and run only in JDK6 -- and we are
trying to make those parts of the specification optional to retain the
ability to support JDK5 runtime. 

The major issue to move to JDK6 was supporting JDBC4 (refer OPENJPA-5 [1]). 
Also, readability can be improved and a degree of type-safety can be
achieved by more widespread usage of generics throughout the core OpenJPA
codebase [2]. Some of the suggestions in your post has been addressed in
[2]. 

  Please note that Numbers.valueOf() caches. Not exactly same as
Integer.valueOf().
In any case, smaller commits/patches are preferred to the larger ones.


[1] http://issues.apache.org/jira/browse/OPENJPA-5
[2] http://issues.apache.org/jira/browse/OPENJPA-1050
[3]
http://n2.nabble.com/-DISCUSS--Drop-build-support-for-Java-5--tc2539470.html#a2545464



-----
Pinaki Poddar                      http://ppoddar.blogspot.com/
                                      
http://www.linkedin.com/in/pinakipoddar
OpenJPA PMC Member/Committer
JPA Expert Group Member
-- 
View this message in context: http://n2.nabble.com/small-increments-tp3019067p3019630.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.