-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
INTERNAL: Adjust @NonNullApi
and @NonNullFields
using package-info.
#97
base: develop
Are you sure you want to change the base?
Conversation
@Nullable | ||
private ArcusClientPool client; | ||
@Nullable | ||
private String url; | ||
@Nullable | ||
private String serviceCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์์ฑ์์์ null์ด ์๋ ๊ฐ์ ๋ฃ์ด์ฃผ์ง ์๊ธฐ ๋๋ฌธ์ ์ฒ์ ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ฉด null์ด ๋ค์ด๊ฐ๋๋ค.
๊ทธ๋์ @Nullable
์ ๋ถ์์ต๋๋ค.
|
||
ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder() | ||
.setFrontCacheExpireTime(frontCacheExpireTime) | ||
.setTimeoutExceptionThreshold(timeoutExceptionThreshold) | ||
.setFrontCacheCopyOnRead(frontCacheCopyOnRead) | ||
.setFrontCacheCopyOnWrite(frontCacheCopyOnWrite) | ||
.setMaxReconnectDelay(maxReconnectDelay); | ||
|
||
if (maxFrontCacheElements > 0) { | ||
cfb.setMaxFrontCacheElements(maxFrontCacheElements); | ||
} | ||
if (globalTranscoder != null) { | ||
cfb.setTranscoder(globalTranscoder); | ||
} | ||
|
||
client = ArcusClient.createArcusClientPool(url, serviceCode, cfb, poolSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZK ์ ์ ์ฃผ์์ ์๋น์ค ์ฝ๋๊ฐ null์ด ์๋์ ๊ฒ์ฆํ๊ธฐ ์ํด ArcusClientPool ๊ฐ์ฒด๋ฅผ ์ฌ๊ธฐ์ ์์ฑํฉ๋๋ค.
๊ธฐ์กด๊ณผ ๊ฐ์ด getObject() ๋ฉ์๋์์ ์์ฑํ๋, ํ๋กํผํฐ์ ๊ฒ์ฆ ์ฝ๋๋ฅผ ์ค๋ณต์ผ๋ก ๋ณต์ฌํ๋ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค.
getObject() ๋ฉ์๋ ๋ด์์ afterPropertiesSet()์ ํธ์ถํ๋ ๊ฒฝ์ฐ IDE๊ฐ url
๊ณผ serviceCode
์ null ์ฌ๋ถ ๊ฒ์ฆ์ ์ธ์ํ์ง ๋ชปํด์ ๊ฒ์ฆ ์ฝ๋๋ฅผ ๋ณต์ฌํด์ผ ํฉ๋๋ค.
Assert.notNull(this.url, "Url property must be provided.");
Assert.notNull(this.serviceCode, "ServiceCode property must be provided.");
Assert.isTrue(this.poolSize > 0, "PoolSize property must be larger than 0.");
Assert.isTrue(this.timeoutExceptionThreshold > 0, "TimeoutExceptionThreshold must be larger than 0.");
Assert.isTrue(this.maxReconnectDelay > 0, "MaxReconnectDelay must be larger than 0.");
private String prefix; | ||
private String serviceId; | ||
private int expireSeconds; | ||
private int frontExpireSeconds; | ||
private long timeoutMilliSeconds = DEFAULT_TIMEOUT_MILLISECONDS; | ||
private ArcusClientPool arcusClient; | ||
private ArcusClientPool arcusClient = new ArcusClientPoolPlaceholder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arcusClient ํ๋๊ฐ ๊ฐ์ฅ @Nullable
์ ๋ถ์ผ์ง ๋ง์ง ์ ๋งคํ ํ๋์
๋๋ค.
๋ณธ ๋ณ๊ฒฝ์ฌํญ์ @Nullable
์ ๋ถ์ด๋ ๋์ Placeholder ๊ฐ๋
์ ์ด๊ธฐ๊ฐ์ ๋ฃ์ด์ฃผ๋ ๊ฒ์
๋๋ค.
์ด ํ๋์ @Nullable
์ ๋ถ์ด๋ฉด IDE๋ ์บ์ ์ฐ์ฐ์ ์ํด ์ด ํ๋์ ์ฐธ์กฐํ ๋๋ง๋ค null ์ฌ๋ถ๋ฅผ ์ฒดํฌํด์ผ ํ๋ค๊ณ ํฉ๋๋ค.
์ด ํ๋์ @Nullable
์ ๋ถ์ด์ง ์์ผ๋ฉด ์ฒ์์ null์ด ๋ค์ด๊ฐ๊ณ ์๋ค๊ณ ์๋ฆฝ๋๋ค.
ArcusCacheManager๋ฅผ ์ฌ์ฉํ์ง ์๋ ๊ฒฝ์ฐ ๊ฐ์ฒด ์์ฑ ์ ์ฒ์์๋ null์ด ๋ค์ด๊ฐ๊ธฐ ๋๋ฌธ์
๋๋ค.
๋จ, ArcusCacheManager๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์์ฑ์์์ null์ด ์๋ ๊ฐ์ ํ ๋นํฉ๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ฌ๊ธฐ์ ๋ํ ์ ์๊ฐ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. @jhpark816๋๋ ์๊ฒฌ ์ฃผ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
- Placeholder ๋์
@Nullable
์ ๋ถ์ ๋๋ค. IDE๋ฅผ ์ฌ์ฉํ์ง ์๋ ๋ฐฐํฌ ํ๊ฒฝ์๋ ์ํฅ์ด ์๊ธฐ ๋๋ฌธ์ ๋ฌธ์ ๊ฐ ๋ ๊ฒ ๊ฐ์ง ์์ต๋๋ค. - ์ธ์๊ฐ ์๋ public ์์ฑ์๋ฅผ deprecateํ๊ณ ํ์ ์ธ์๋ฅผ ๋ฐ๋ ์์ฑ์๋ฅผ ์ ๊ณตํฉ๋๋ค.
- ์ธ์๊ฐ ์๋ public ์์ฑ์๊ฐ ์ ๊ฑฐ๋๋ ์์ ์ ํ์ ์ธ์์ ๋ํ
@Nullable
๋ ์ ๊ฑฐํฉ๋๋ค.
src/main/java/com/navercorp/arcus/spring/cache/ArcusCacheConfiguration.java
Outdated
Show resolved
Hide resolved
return 0; | ||
} | ||
return key.hashCode() & (mutexes.length - 1); | ||
return Objects.hashCode(key) & (mutexes.length - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key ๋งค๊ฐ๋ณ์๋ ๊ฐ๋
์ ์ผ๋ก null์ด ์๋์ด์ผ ํฉ๋๋ค.
ํ์ง๋ง null ์ฒดํฌํ๋ if๋ฌธ์ ์ ๊ฑฐํ๋ฉด, ๊ธฐ์กด์ null์ ๋ฃ๋ ๊ณณ์์ NullPointerExcpetion์ด ๋ฐ์ํฉ๋๋ค.
Objects.hashCode() ๋ฉ์๋๋ ๋ด๋ถ์ ์ผ๋ก null ์ฒดํฌ๋ฅผ ํด์ฃผ์ด null์ธ ๊ฒฝ์ฐ 0์ ๋ฐํํ๊ณ ๊ทธ๋ ์ง ์์ผ๋ฉด Object.hashCode() ๊ฐ์ ๋ฐํํ๋ฏ๋ก null์ธ ๊ฒฝ์ฐ์ ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ ๋ชจ๋ ๋์์ด ๋์ผํฉ๋๋ค.
this.name = this.getNamePlaceholder(); | ||
this.serviceId = this.getServiceIdPlaceholder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด ๋ ํ๋๋ ๋ด๋ถ ๋ก์ง์ ์ผ๋ก null์ด ์๋ ๊ฐ์ผ๋ก ๋์ํฉ๋๋ค
ํ์ง๋ง ArcusCacheManager๋ฅผ ์ฌ์ฉํ์ง ์๋๋ค๋ฉด ์ฒ์์๋ null์ด ๋ค์ด๊ฐ๋๋ค.
@Nullable
์ ๋ถ์ด๋ ๋์ Placeholder ๊ฐ๋
์ ์ด๊ธฐ๊ฐ์ ๋ฃ์ด์ค๋๋ค.
public ArcusCacheConfiguration() { | ||
this.serviceId = this.getServiceIdPlaceholder(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArcusCache ์์ฑ์์์ serviceId์ Placeholder ๊ฐ๋ ์ ์ด๊ธฐ๊ฐ์ ๋ฃ์ด์ฃผ๋ ๊ฒ๊ณผ ๋์ผํฉ๋๋ค.
@uhm0311 @jhpark816 |
FactoryBean์ด ์๋์ด๋ Placeholder๋ฅผ ๋๋ ๊ณณ์ ์์ต๋๋ค. |
์ง๋ PR๋ณ๊ฒฝ์ฌํญ๋ค๊ณผ JDK8๋ฒ์ ์ผ๋ก ์ฌ๋ผ๊ฐ develop ๋ธ๋์น์ ๊ธฐ๋ก์ ๋ดค์ ๋ <dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${com.google.code.findbugs.version}</version>
<scope>provided</scope>
</dependency> |
@kiheyunkim Arcus Spring์ ๊ฒฝ์ฐ Compile Warning์ด ๋ฐ์ํ๋ฉด ์ปดํ์ผ์ด ๋์ง ์๋๋ก ์ค์ ํด๋๊ณ ๊ฐ๋ฐํ๊ณ ์์ต๋๋ค. Spring ๋ฌธ์์์๋ ์ด์ ๊ด๋ จํ ๋ด์ฉ์ ๋ค๋ฃจ๊ณ ์์ต๋๋ค. |
@uhm0311 @oliviarla |
๐ Related Issue
โจ๏ธ What I did
@Nullable
์ ๋ถ์ ๋๋ค.@Nullable
์ค์ ์ ์ด๋๊น์ง ๋ถ์ผ์ง๊ฐ ์ ๋งคํ์ฌ ๋ ผ์๊ฐ ํ์ํฉ๋๋ค.