java

Maven ๋นŒ๋“œ์‹œ TLS ์˜ค๋ฅ˜ ๋ฐœ์ƒ

JoonHo Son
ํšŒ์‚ฌ ํ…Œ์ŠคํŠธ์šฉ PC์—์„œ ๋นŒ๋“œ์ค‘ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์˜€๋‹ค. PC ํ™˜๊ฒฝ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. Windows 10 Pro x64 JDK 1.7(1.7.0_80-b15) Maven 3(3.6.3) ๋‚ด ๋žฉํƒ‘(MBPR 2018)์—์„œ๋Š” ์ž˜ ๋˜๋Š”๋ฐ ํ…Œ์ŠคํŠธ์šฉ PC์—์„œ ๋นŒ๋“œํ•˜๋‹ˆ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค. << maven goal ์‹คํ–‰ ์˜ค๋ฅ˜ >> ํ•ด๋‹น ์˜ค๋ฅ˜๋Š” Java 1.8 ๋ฒ„์ „์—๋Š” TLS ํ”„๋กœํ† ์ฝœ์˜ ๊ธฐ๋ณธ ๋ฒ„์ „์ด 1.2์ธ ๋ฐ˜๋ฉด ์ด์ „ Java(1.7, 1.6 ๋“ฑ)๋Š” TLS ํ”„๋กœํ† ์ฝœ์˜ ๋ฒ„์ „์ด 1.0์ด์–ด์„œ ๋ฐœ์ƒํ•œ ์˜ค๋ฅ˜๋ผ๊ณ  ํ•œ๋‹ค(์ฐธ๊ณ ). ๋”ฐ๋ผ์„œ maven ์‹คํ–‰์‹œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ต์…˜์„ ์ง€์ •ํ•˜์—ฌ์•ผ ํ•œ๋‹ค. $ mvn -Dhttps.protocols=TLSv1.2 [clean | package .

Java short / byte array ๋ณ€ํ™˜

JoonHo Son
์ด๋ฒˆ ์—…๋ฌด์—์„œ ์†Œ์ผ“ํ†ต์‹ ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ถ€๋ถ„์ด ์žˆ์–ด 2์ฃผ ์ •๋„ ์‚ฝ์งˆ์„ ํ–ˆ๋‹ค. ์˜ˆ์ „ ์ง์žฅ์—์„œ ์—ด์‹ฌํžˆ ๊ณต๋ถ€ํ•ด์„œ ์ž˜ ๋งŒ๋“ค์—ˆ๋˜๊ฑธ๋กœ ๊ธฐ์–ตํ•˜๋Š”๋ฐ, ๋„๋ฌด์ง€ ๊ธฐ์–ต์ด…(ํ•˜๊ธด 5๋…„ ์ •๋„๋Š” ์ง€๋‚œ๊ฑฐ ๊ฐ™์œผ๋‹ˆ) ๊ฐ์„คํ•˜๊ณ , ๊ณต๋ฌธ์œผ๋กœ ๋‚ด๋ ค์˜จ ์ „๋ฌธ๊ทœ๊ฒฉ์„œ์ƒ์˜ ์ˆ˜์น˜ ๋ถ€๋ถ„์ด User type, n byte๋กœ๋งŒ ๋‘๋ฃจ๋ญ‰์‹คํ•˜๊ฒŒ ๋˜์–ด ์žˆ์—ˆ๋Š”๋ฐ, ์‹ค์ œ ์ธก์ •๊ฐ’์„ ๋ณด๋‚ด์ฃผ๋Š” ์—…์ฒด ์ค‘ ํ•œ ๊ณณ์—์„œ ๋จผ์ € ๊ทธ๋“ค์ด ๋ณด๋‚ด๊ณ ์ž ํ•˜๋Š” ์–‘์‹์„ ๋ณด๋‚ด์ค˜ ํ™•์ธํ•ด ๋ณด๋‹ˆ signed short์œผ๋กœ ๋˜์–ด ์žˆ์—ˆ๋‹ค. ๊ณต๋ฌธ์œผ๋กœ ๋‚ด๋ ค์˜จ ํ•ด๋‹น ๋ฐ์ดํ„ฐ์— ๋Œ€ํ•œ ๋ฐ์ด๋ธ” ๋ช…์„ธ๋Š” number(8, 3)์œผ๋กœ ๋˜์–ด ์žˆ์–ด์„œ ๋‚˜๋Š” doubleํ˜•์œผ๋กœ ๋ฐ›์œผ๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ, ๋ญ DDL script ์ˆ˜์ •ํ•˜๋Š”๊ฒƒ ๋ณด๋‹ค๋Š” ๋‚ด๊ฐ€ ์ ์ ˆํžˆ ๋ณ€ํ™˜ํ•ด์„œ ์ €์žฅํ•˜๋Š” ๋ฐฉ์‹์ด ์ข‹์„๋“ฏ ํ•ด์„œ ์—ด์‹ฌํžˆ ๊ตฌ๊ธ€๋ง์„ ํ–ˆ๋‹ค.

macOS + IntelliJ + Tomcat8 + ehcache ๊ตฌ๋™์‹œ ์˜ค๋ฅ˜ ๋ฐœ์ƒ

JoonHo Son
์ด๊ฒŒ, ์œˆ๋„์šฐ์—์„œ ๋™์ผํ•œ ํ™˜๊ฒฝ์œผ๋กœ ๊ตฌ๋™์‹œํ‚ฌ๋•Œ๋Š” ๋ฐœ์ƒํ•˜์ง€ ์•Š์•˜๋‹ค. ์˜ค๋ฅ˜ ๋ฉ”์„ธ์ง€๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. net.sf.ehcache.distribution.MulticastRMICacheManagerPeerProvider: Error starting heartbeat. Error was: Canโ€™t assign requested address << ์˜ค๋ฅ˜ ๋กœ๊ทธ >> ์ด์งํ•œ ํšŒ์‚ฌ์—์„œ ์•ฝ๊ฐ„ ํฌ์•ˆํ•œ ๊ตฌ์กฐ์˜ maven์œผ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ธธ๋ž˜โ€ฆ ์ ์‘ํ•˜๋ ค๊ณ  ๋…ธ๋ ฅ์ค‘์— ๋ฐœ์ƒํ•œ ์˜ค๋ฅ˜(์ด ํ”„๋กœ์ ํŠธ์—์„œ ehcache๋ฅผ ์“ฐ์ง€๋ฅผ ์•Š๋Š”๋‹ค. ๐Ÿ˜‘) ๋™์ผํ•œ ๊ฐœ๋ฐœํ™˜๊ฒฝ์— ์šด์˜์ฒด์ œ๋งŒ ์œˆ๋„์šฐ์ธ ํšŒ์‚ฌ๋žฉํƒ‘์—์„œ๋Š” ๋ฐœ์ƒํ•˜์ง€ ์•Š์•„ ์˜ค๋ฅ˜ ๋ฉ”์„ธ์ง€๋ฅผ ๋ณด๊ณ  ๋ญ”๊ฐ€ ๋Š๋‚Œ์ด ์™€์„œ ๊ฒ€์ƒ‰ํ•ด๋ณด๋‹ˆโ€ฆ IPv6๋กœ ์ธ์‹์ด ๋˜์„œ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ์ด๋”๋ผ. ์•„๋งˆ *NIX ๊ณ„์—ด์˜ ์šด์˜์ฒด์ œ์—์„œ๋Š” ๋™์ผํ•œ ์ƒํ™ฉ์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š์„๊นŒ ์‹ถ๋‹ค.

Isolation level

JoonHo Son
// java.sql.Connection์— ์ •์˜๋จ int TRANSACTION_NONE = 0; int TRANSACTION_READ_UNCOMMITTED = 1; int TRANSACTION_READ_COMMITTED = 2; int TRANSACTION_REPEATABLE_READ = 4; int TRANSACTION_SERIALIZABLE = 8; ์•„๋ž˜์˜ ๋‚ด์šฉ์€ ํ˜ธ๋ฐ•๊ณ ๊ตฌ๋ฉ”์˜ ๊ฒŒ์ž„ ์ด์•ผ๊ธฐ ์—์„œ ์ผ๋ถ€ ๋ฐœ์ทŒ. ๊ฐ ๋ ˆ๋ฒจ๋ณ„ ์ƒ์ˆ˜๋Š” ๋ฐœ์ทŒํ•œ ๋ธ”๋กœ๊ทธ์˜ ๋‚ด์šฉ์ด ์ž˜๋ชป๋˜์–ด ์‹ค์ œ java.sql.Connection ํด๋ž˜์Šค์— ์ •์˜๋œ ์ƒ์ˆ˜๋กœ ๋Œ€์ฒด(๋ถ‰์€๊ธ€์”จ ) ์ฐจ๋‹จ ๋ ˆ๋ฒจ ์ฐจ๋‹จ๋ ˆ๋ฒจ (Isolcation level) Dirty read Non-repeatable read Phantom read TRANSACTION_READ_UNCOMMIT O O O TRANSACTION_READ_COMMIT X O O TRANSACTION_REPEATABLE_READ X X O(X) TRANSACTION_SERIALIZABLE X X X Connection ์ธํ„ฐํŽ˜์ด์Šค์—์„œ ํŠธ๋žœ์žญ์…˜ ์ฐจ๋‹จ ๋ ˆ๋ฒจ๊ณผ ๊ด€๋ จ๋œ ํ•„๋“œ ํ•„๋“œ ์„ค๋ช… ๊ฐ’ int TRANSACTION_NONE ํŠธ๋žœ์žญ์…˜์ด ์ง€์›๋˜์ง€ ์•Š์Œ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ƒ์ˆ˜ 0 int TRANSACTION_READ_UNCOMMITTED dirty read, non-repeatable read์™€ phantom read๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ƒ์ˆ˜ 1 int TRANSACTION_READ_COMMITTED dirty read๋Š” ๊ธˆ์ง€๋˜๊ณ , non-repeatable read์™€ phantom read๋Š” ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ƒ์ˆ˜ 2 int TRANSACTION_REPEATABLE_READ dirty read์™€ non-repeatable read๋Š” ๊ธˆ์ง€๋˜๊ณ , phantom read๋Š” ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Œ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ƒ์ˆ˜ 4 int TRANSACTION_SERIALIZABLE dirty read, non-repeatable read์™€ phantom read ๋ชจ๋‘ ๊ธˆ์ง€๋จ์„ ๋‚˜ํƒ€๋‚ด๋Š” ์ƒ์ˆ˜ 8