我希望能够创建EMR集群,并让这些集群将消息发送回某个中央队列.为了使其工作,我需要在每个主节点上运行某种代理.这些代理中的每一个都必须在此消息中标识自己,以便收件人知道该消息所针对的群集.
主节点是否知道其ID(j-*************)?如果没有,那么是否还有其他一些识别信息可以让邮件收件人推断出这个ID?
我已经看了一下配置文件/home/hadoop/conf,我没有发现任何有用的东西.我发现了ID /mnt/var/log/instance-controller/instance-controller.log,但看起来很难找到.我想知道实例控制器可能从哪个位置获取该ID.
嗨,我在调度程序类中使用带有Quartz的spring 3.0.我已经创建了应用程序上下文
private static final ClassPathXmlApplicationContext applicationContext;
static {
applicationContext = new
ClassPathXmlApplicationContext("config/applicationContext.xml");
}
Run Code Online (Sandbox Code Playgroud)
问题是没有任何@Autowiredbean实际上是自动连接的,所以我必须手动设置依赖关系,如下所示:
<bean class="com.spr.service.RegistrationServiceImpl" id="registrationService">
<property name="userService" ref="userService" />
</bean>
Run Code Online (Sandbox Code Playgroud)
我正在使用的示例@Autowired:
public class RegistrationService {
@AutoWired private UserService userService;
// setter for userService;
}
public class UserService{
// methods
}
Run Code Online (Sandbox Code Playgroud)
我还确保在Spring配置中启用注释配置:
<context:annotation-config/>
<bean id="registrationSevice" class="RegistrationService"/>
<bean id="userService" class="UserService"/>
Run Code Online (Sandbox Code Playgroud)
为什么@Autowired不为我工作?
我正在使用Symfony 2.3,我有一个看起来像这样的方法:
public function addAction() {
$user = new User();
$form = $this->createForm(new UserType(), $user);
$form->handleRequest($this->getRequest());
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
try {
return $this
->render(
'SomeBundle:Default:adduser.html.twig',
array('id' => $user->getId()));
} catch (Exception $e) {
throw new HttpException(500, "Error persisting");
}
}
throw new HttpException(400, "Invalid request");
}
Run Code Online (Sandbox Code Playgroud)
这条路线:
some_bundle_adduserpage:
pattern: /user
defaults: { _controller: SomeBundle:User:add }
methods: [POST]
Run Code Online (Sandbox Code Playgroud)
它工作得很好.我也有这个方法:
public function editAction($id) {
$response = new Response();
if (!$this->doesUserExist($id)) {
$response->setStatusCode(400);
return $response;
}
$user = …Run Code Online (Sandbox Code Playgroud) 在下面的代码中,构造函数的Child可见性降低public了private,这是允许的.继承的方法(例如)test()不能降低可见性.为什么Java以这种方式运行?
class Parent {
public Parent(){}
public void test()
{
System.out.print("parent test executed!");
}
}
class Child extends Parent{
private Child(){}
private void test(){
System.out.print("child test executed!");
}
}
Run Code Online (Sandbox Code Playgroud) java ×2
amazon-emr ×1
constructor ×1
hadoop ×1
inheritance ×1
methods ×1
php ×1
spring ×1
symfony ×1
symfony-2.3 ×1