顯示具有 JAVA 標籤的文章。 顯示所有文章
顯示具有 JAVA 標籤的文章。 顯示所有文章

2024年2月16日 星期五

Java 8u261以上才支援SHA384WithECDSA

https://www.oracle.com/java/technologies/javase/8all-relnotes.html#R180_261

security-libs/javax.net.ssl

➜ Increase the priorities of GCM cipher suites

In TLS, a ciphersuite defines a specific set of cryptography algorithms used in a TLS connection. JSSE maintains a prioritized list of ciphersuites. In this update, GCM-based cipher suites are configured as the most preferable default cipher suites in the SunJSSE provider.


In the SunJSSE provider, the following ciphersuites are now the most preferred by default:

TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384

https://github.com/AdoptOpenJDK/openjdk-jdk8u/blob/master/jdk/src/share/classes/sun/security/ssl/CipherSuite.java

2020年7月5日 星期日

2019年8月7日 星期三

DBCP和c3p0連線timeout設置

因為預設值都是indefinitely無限制等待
如果Connection Pool滿載,應用程式要不到閒置的Connection,會造成應用程式的Block無任何反應
建議一定要設定 timeout

https://blog.csdn.net/qq_34359363/article/details/72763491
DBCP 
最小连接数 minIdle(預設值為0)
初始化连接数 initialSize(預設值為0)
最大连接数 maxTotal(預設值為8)
最大等待时间 maxWaitMillis(預設值為無限毫秒)
詳細資訊 https://commons.apache.org/proper/commons-dbcp/configuration.html
Hibernate要設定hibernate.dbcp.maxWaitMillis

c3p0    
最小连接数 minPoolSize(預設值為3)
初始化连接数 initialPoolSize(預設值為3)
最大连接数 maxPoolSize(預設值為15)
最大等待时间 maxIdleTime(預設值為無限秒)
詳細資訊 https://www.mchange.com/projects/c3p0/#maxIdleTime
Hibernate要設定hibernate.c3p0.maxIdleTime 

2016年4月20日 星期三

Java的RowSet 類似C#的DataSet

都是把結果集存到記憶體進行離線操作

ref:
Java 6 RowSet 使用完全剖析
https://www.ibm.com/developerworks/cn/java/j-lo-java6rowset/

2016年4月19日 星期二

Java 8連到Access資料庫連線方式修改

 java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Exception occuring.
For Java 8 you cannot use the JDBC-ODBC Bridge because it has been removed. You will need to use something like UCanAccess instead.

2016年3月2日 星期三

Java Incompatibilities

Compatibility Guide for JDK 8
http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html

Java SE 7 and JDK 7 Compatibility
http://www.oracle.com/technetwork/java/javase/compatibility-417013.html

Oracle Java SE Support Roadmap
http://www.oracle.com/technetwork/java/eol-135779.html

Java SE 7 End of Public Updates Notice
https://java.com/en/download/faq/java_7.xml

Incompatibilities in the Java Platform, Standard Edition 6   (since J2SE 5.0)
http://www.oracle.com/technetwork/java/javase/compatibility-137541.html#incompatibilities

Incompatibilities in the Java 2 Platform, Standard Edition, v1.4.2   (since 1.4.1)
http://www.oracle.com/technetwork/java/javase/compatibility-142878.html#incompatibilities

Incompatibilities in J2SE 1.4.1   (since 1.4.0)
http://www.oracle.com/technetwork/java/javase/compatibility-j2se1-140308.html

Incompatibilities in J2SE 1.4.0   (since 1.3)
http://www.oracle.com/technetwork/java/javase/compatibility-j2se1-141394.html

Incompatibilities in J2SE 1.3   (since 1.2)
http://www.oracle.com/technetwork/java/javase/compatibility-135119.html

Is your project ready for Java 7?
http://vyazelenko.com/2012/02/01/is-your-project-ready-for-java-7/

Is JDK “upward” or “backward” compatible?
http://stackoverflow.com/questions/4692626/is-jdk-upward-or-backward-compatible


keyword:
java Incompatibilities、java Compatibility Guide

2012年7月14日 星期六

64-bit HotSpot VM的UseCompressedOops

Java 6 Update 18之後的HotSpot VM版本會根據Java heap最大值的設定自動決定是否開啟-XX:+UseCompressedOops。Java heap的最大值大約在25 GB以下所得的性能最好。

2012年7月11日 星期三

Java SE 6 Javadoc and Source

http://javasourcecode.org/html/open-source/jdk/jdk-6u23/

BufferedWriter default buffer size

http://developer.classpath.org/doc/java/io/BufferedWriter.html
default buffer size of 8192 chars.


http://developer.classpath.org/doc/java/io/BufferedWriter-source.html
private static final int DEFAULT_BUFFER_SIZE = 8192;

  91:   public BufferedWriter (Writer out)
  92:   {
  93:     this (out, DEFAULT_BUFFER_SIZE);
  94:   }

 104:   public BufferedWriter (Writer out, int size)
 105:   {
 106:     super(out.lock);
 107:     this.out = out;
 108:     this.buffer = new char[size];
 109:     this.count = 0;
 110:   }

http://javasourcecode.org/html/open-source/jdk/jdk-6u23/java/io/BufferedWriter.java.html
private static int defaultCharBufferSize = 8192;

    public BufferedWriter(Writer out) {
    this(out, defaultCharBufferSize);
    }

    public BufferedWriter(Writer out, int sz) {
    super(out);
    if (sz <= 0)
        throw new IllegalArgumentException("Buffer size <= 0");
    this.out = out;
    cb = new char[sz];
    nChars = sz;
    nextChar = 0;

    lineSeparator = (String) java.security.AccessController.doPrivileged(
               new sun.security.action.GetPropertyAction("line.separator"));
    }




GNU Classpath Documentation

http://developer.classpath.org/doc/

Tuning Java I/O Performance

http://java.sun.com/developer/technicalArticles/Programming/PerfTuning/


For a 1 MB input file, the execution times in seconds of the programs are:
 intro1    6.9
 intro2    0.9
 intro3    0.4

Buffering

Approaches 2 and 3 use the technique of buffering, where large chunks of a file are read from disk, and then accessed a byte or character at a time. Buffering is a basic and important technique for speeding I/O, and several Java classes support buffering (BufferedInputStream for bytes, BufferedReader for characters).



int len = (int)(new File(args[0]).length());byte buf[] = new byte[len];
This approach is convenient, in that a file can be treated as an array of 
bytes. But there's an obvious problem of possibly not having enough memory to 
read in a very large file. 

2012年7月8日 星期日

JDOQL

JDOQL是JDO資料庫查詢語言標準

javax.jdo.Query
Query類別是JDO中專門用來查詢的類別,可由PersistenceManager的newQuery方法產生

利用Query的execute方法進行查詢

Query的setResult方法,可限定欲取得的屬性以字串方式傳入

Query的setFilter方法,將原本在WHERE語法後的篩選字串轉入,再呼叫execute方法

Query的declareParameters方法,訂定參數的資料型態

Query的setOrdering方法,可指定查詢結果的排序方式,ascending是升幕,descending為降幕

ref:
http://db.apache.org/jdo/api20/apidocs/javax/jdo/Query.html