Skip to content
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

InstructionFactory 缓存 #15

Closed
newbigTech opened this issue Mar 6, 2018 · 3 comments
Closed

InstructionFactory 缓存 #15

newbigTech opened this issue Mar 6, 2018 · 3 comments

Comments

@newbigTech
Copy link

InstructionFactory的Map<String,InstructionFactory> instructionFactory 只看到有get , 没看到那里有put

public static InstructionFactory getInstructionFactory(String factory) {
	try {
		InstructionFactory result = instructionFactory.get(factory);
		if (result == null) {
			result = (InstructionFactory) Class.forName(factory)
					.newInstance();
		}
		return result;
@baoxingjie
Copy link
Contributor

这是一个不需要对外暴露的内部对象,请问你使用过程中遇到什么问题,或者需要做什么特殊处理吗?

@newbigTech
Copy link
Author

newbigTech commented Apr 7, 2018

if (result == null) { 里面 newInstance 之后是不是需要把result放到 instructionFactory的Map里面,否则 instructionFactory.get 每次都返回null ,Map<String,InstructionFactory> instructionFactory 存在的意义是什么?

@wongswoon
Copy link

我也觉得这个有问题,instructionFactory为啥没有put?map的意义是啥?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants