- 浏览: 184532 次
-
最新评论
-
adamed:
zhangwenzhuo 写道为什么this.get()会返回 ...
jQuery源码历代记5 -
zhangwenzhuo:
为什么this.get()会返回本身的呢?
jQuery源码历代记5 -
narutolby:
支持下~,哈哈~
jQuery历代记1 -
cpszy:
mark下
jQuery历代记1 -
gleams:
支持你
jQuery历代记1
In the example in Listing 10.2, the helloWorld() method that was invoked on the EJB didn't defined any parameters. The EJBInvokedJob class enables you to pass arguments to an EJB method by specifying them using the EJB_ARGS_KEY and EJB_ARG_TYPES_KEY parameters shown in Table 10.1.
<o:p> </o:p>
列表10.2中定义的供EJB调用的helloWord()方法并没有定义任何参数。EJBInvokedJob类允许你想EJB方法中传递参数。方法是使用表10.1中的EJB_ARGS_KEY 和 EJB_ARG_TYPES_KEY。
<o:p> </o:p>
Listing 10.3 shows another simple example that passes an argument to a different version of helloWorld() EJB running on the Apache Geronimo J2EE server.
<o:p> </o:p>
列表 10.3 显示了另一个简单的示例,将参数传递给其他版本的运行在Apache Geronimo J2EE 服务器上的EJB helloWorld() 。
<o:p> </o:p>
Listing 10.3 is very similar to Listing 10.2, except that it includes the parameters EJB_ARGS_KEY and EJB_ARG_TYPES_KEY. Also, because it's running against the Geronimo J2EE application server, it needed to add the arguments for PRINCIPAL and CREDENTIALS.
<o:p> </o:p>
列表10.3与10.2非常类似除了10.3中包含参数EJB_ARGS_KEY 和 EJB_ARG_TYPES_KEY。当然由于运行在Geronimo J2EE服务器上,它需要添加额外的参数(PRINCIPAL 和 CREDENTIALS)。
<o:p> </o:p>
Listing 10.3. A Simple Example Using the EJBInvokerJob<o:p></o:p>
列表10.3 一个简单的使用EJBInvokerJob的例子<o:p></o:p>
- package org.cavaness.quartzbook.chapter10;
- import java.util.Date;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import org.quartz.JobDetail;
- import org.quartz.Scheduler;
- import org.quartz.SchedulerException;
- import org.quartz.Trigger;
- import org.quartz.TriggerUtils;
- import org.quartz.impl.StdSchedulerFactory;
- import org.quartz.jobs.ee.ejb.EJBInvokerJob;
- public class Listing_10_3 {
- static Log logger = LogFactory.getLog(Listing_10_3.class);
- public static void main(String[] args) {
- Listing_10_3 example = new Listing_10_3();
- try {
- // Create a Scheduler and schedule the Job
- Scheduler scheduler = example.createScheduler();
- example.scheduleJob(scheduler);
- // Start the Scheduler running
- scheduler.start();
- logger.info("Scheduler started at " + new Date());
- } catch (SchedulerException ex) {
- logger.error(ex);
- }
- }
- // Schedule the EJBInvokerJob
- private void scheduleJob(Scheduler scheduler)
- throws SchedulerException {
- // Create a JobDetail for the Job
- JobDetail jobDetail = new JobDetail("HelloWorldJob",
- Scheduler.DEFAULT_GROUP,
- org.quartz.jobs.ee.ejb.EJBInvokerJob.class);
- // Load all of the necessary EJB parameters
- loadJobDataMap(jobDetail);
- // Create a trigger that fires every 10 seconds, forever
- Trigger trigger = TriggerUtils.makeSecondlyTrigger(10);
- trigger.setName("helloWorldTrigger");
- // Start the trigger firing from now
- trigger.setStartTime(new Date());
- // Associate the trigger with the job in the scheduler
- scheduler.scheduleJob(jobDetail, trigger);
- }
- /*
- * Configure the EJB parameters in the JobDataMap
- * 在JobDataMap中配置EJB参数
- */
- public JobDetail loadJobDataMap(JobDetail jobDetail) {
- jobDetail.getJobDataMap().put(
- EJBInvokerJob.EJB_JNDI_NAME_KEY, "ejb/Test");
- jobDetail.getJobDataMap().put(EJBInvokerJob.EJB_METHOD_KEY,
- "helloWorld");
- Object[] args = new Object[1];
- args[0] = " from Quartz";
- jobDetail.getJobDataMap().put(
- EJBInvokerJob.EJB_ARGS_KEY, args);
- Class[] argTypes = new Class[1];
- argTypes[0] = java.lang.String.class;
- jobDetail.getJobDataMap().put(
- EJBInvokerJob.EJB_ARG_TYPES_KEY, argTypes);
- jobDetail.getJobDataMap().put(
- EJBInvokerJob.PROVIDER_URL, "127.0.0.1:4201");
- jobDetail.getJobDataMap().put(
- EJBInvokerJob.INITIAL_CONTEXT_FACTORY,
- "org.openejb.client.RemoteInitialContextFactory");
- jobDetail.getJobDataMap().put(
- EJBInvokerJob.PRINCIPAL, "system");
- jobDetail.getJobDataMap().put(
- EJBInvokerJob.CREDENTIALS, "manager");
- return jobDetail;
- }
- /*
- * return an instance of the Scheduler from the factory
- */
- public Scheduler createScheduler() throws SchedulerException {
- return StdSchedulerFactory.getDefaultScheduler();
- }
- }
EJBInvokerJob Parameters and Serialization<o:p></o:p> EJBInvokerJob参数与串行化<o:p></o:p> Because of the typical serialization problems that are associated with Java and distributed applications, you should stick to passing Strings and primitives to your EJB methods. If you need to pass more complex types, your code must serialize the objects between client and server properly. For more in-depth information on Java serialization, check out Sun's Serialization specification at http://java.sun.com/j2se/1.5.0/docs/guide/serialization. <o:p> </o:p> 由于典型的串行化问题都与JAVA分布式应用有关,所以你最好只传递字符串和基本类型到EJB方法中。如果你需要传递复杂类型你需要在客户端和服务器代码中恰当的串行化对象。更加深入的关于JAVA串行化的资料点击Sun的串行化规范:http://java.sun.com/j2se/1.5.0/docs/guide/serialization。 <o:p> </o:p> |
<o:p> </o:p>
Because Quartz needs to get a reference to the home and remote interfaces for the EJB, you need to deploy some J2EE client JARs with your external Quartz application. The JARs you need to add depend on which J2EE container you're using. If you're using WebLogic, for example, you'll probably just put the weblogic.jar with the Quartz application. For Geronimo, several are involved. Check with the server documentation to be sure.
<o:p> </o:p>
应为Quartz需要为EJB获取本地与远程的接口,你必须将一些J2EE客户端jar包导入到外部Quartz应用中。添加的Jar包依赖于你使用的J2EE容器。例如,如果你使用WebLogic你需要将weblogic.jar导入到Quartz应用中。如果使用Geronimo导入其他几个被调用的包。你需要查看服务器支持文档。
<o:p> </o:p>
Running Quartz Within the J2EE Application Server<o:p></o:p>
在J2EE应用服务器中部署Quartz<o:p></o:p>
Running Quartz as a J2EE client is a little more involved than running Quartz as an external J2SE application. This is mostly because deploying applications within the container is somewhat more complicated. In addition, the J2EE specification puts some constraints on components within the container. One of the biggest guidelines that the specification gives involves who and what can create Java threads. Because it's the container's responsibility to manage all resources, it can't allow just anything or anyone to create threads. If it did, it would have a harder time managing the environment and keeping things stable. Quartz creates its own worker threads, so you need to follow some steps to make sure things work properly.
<o:p> </o:p>
与作为外部J2SE应用相比将Quartz作为一个J2EE客户端比较复杂。这是因为在容器中部署应用就比较复杂。另外J2EE规范对容器内的组件加以约束。影响最大的准则是规范规定了谁或者什么可以创建JAVA线程。因为容器通过创建线程管理资源。所以不允许任何人或物私自创建线程。如果这样做了容器将不能管理环境也不能保持容器中事务的稳定。Quartz创建自己的工作线程。这样你就必须按下面的步骤配置以保证Quartz正常运行。
<o:p> </o:p>
Assume that a stateless session bean such as the one from Listing 10.1 is already deployed in the container. The easiest way to deploy Quartz within the container is to build a WAR file that contains all the necessary files and then use the admin tools, or Eclipse, to deploy the Web application within the container.
<o:p> </o:p>
加入要向容器中部署一个列表10.1那样的无状态会话bean。最简单的方法是将Quartz建立一个包含所有必要文件的war文件使用管理员工具或Eclipse将Web应用部署到容器中。
<o:p> </o:p>
The Web application directory structure is just like that of any other Web application. You need to add the following files to it:
<o:p> </o:p>
Web应用文件夹与其他Web应用相同。你需要相其中添加下面的文件。
<o:p> </o:p>
- web.xml (put in WEB-INF)
- quartz.properties (put in WEB-INF/classes)
- quartz_jobs.xml (put in WEB-INF/classes)
- Quartz binary (put in WEB-INF/lib)
- Third-party libraries (put in WEB-INF/lib)
Because you are building a Web application, you need to add the requisite web.xml deployment descriptor. Listing 10.4 shows the web.xml for our client application that will be installed within the container.
<o:p> </o:p>
因为你要建立Web应用。你必须添加Web.xml文件。列表10.4显示了将要部署到容器中的客户端应用的web.xml。
<o:p> </o:p>
Listing 10.4. The web.xml for the Quartz J2EE Client Application<o:p></o:p>
列表10.4 Quartz J2EE客户端应用的web.xml<o:p></o:p>
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app>
- <servlet>
- <servlet-name>QuartzServlet</servlet-name>
- <servlet-class>
- org.quartz.ee.servlet.QuartzInitializerServlet
- </servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>QuartzServlet</servlet-name>
- <url-pattern>/servlet/QuartzServlet</url-pattern>
- </servlet-mapping>
- </web-app>
The Quartz framework includes a Java servlet called QuartzInitializerServlet that, when invoked, initializes the Quartz Scheduler and loads job information. In Listing 10.4, we've set the <load-on-startup> parameter to have a value of 1 so the servlet will be loaded and initialized when the container is started. By using the servlet to start the Quartz Scheduler, we avoid the issues of thread permission because the container will allow servlets to create user threads.
<o:p> </o:p>
Quartz 包含一个Java Servlet(QuartzInitializerServlet)当它被用来初始化Quartz 的Scheduler并加载job信息。在列表10.4中我们设置<load-on-startup>参数为1,当容器初始化时这个servlet就会被加载并初始化。通过使用servlet启动Quartz Scheduler我们避免了线程权限问题,因为容器允许servlet创建用户权限。<o:p></o:p>
<o:p> </o:p>
QuartzInitializerListener Added to Quartz<o:p></o:p> 将QuartzInitializerListener添加到Quartz中<o:p></o:p> Recently, a new class called QuartzInitializerListener was added to Quartz that implements the javax.servlet.ServletContextListener interface. This class can be used as an alternative to the QuartzInitializerServlet mentioned earlier. 最近一个新类QuartzInitializerListener被添加到Quartz中改类实现javax.servlet.ServletContextListener接口,QuartzInitializerListener可以作为刚刚提到的QuartzInitializerServlet替代方案。 |
<o:p> </o:p>
Next, you need to put the standard quartz.properties file into the WEB-INF/classes directory of the Web application. There's nothing special about this version of the properties file; it's essentially what we did in past chapters. However, here we use the JobInitializationPlugin (this was shown in Chapter 8, "Using Quartz Plug-Ins," and is designed to load job information from an XML file). By default, the plug-in looks for a file called quartz_jobs.xml and loads the jobs found in the file. As Chapter 8 described, using this particular plug-in keeps you from having to write job-loading code and be forced to recompile when changes occur. The quartz_jobs.xml file for this example is shown in Listing 10.5.
<o:p> </o:p>
下一步你需要将quartz.properties文件添加到WEB-INF/classes文件夹中。Properties文件没有版本限制与我们在前面章节讲解的配置文件没有区别。然而,这里我们使用了JobInitializationPlugin(在第8章 使用Quartz插件 做详细讲解),它被设计用来从XML文件中加载Job信息。默认情况下,插件寻找quartz_jobs.xml文件并从中加载job信息。正如第8章描述的那样,这个特殊的插件使你不必编写job加载代码,也就不用在job发生改变时重新编译代码。这个例子的quartz_jobs.xml如列表10.5。
<o:p> </o:p>
Listing 10.5. The quartz_jobs.xml Used Within the J2EE Client<o:p></o:p>
列表10.5 在J2EE客户端使用的quartz_jobs.xml<o:p></o:p>
- <?xml version='1.0' encoding='utf-8'?>
- <quartz>
- <job>
- <job-detail>
- <name>HelloWorldJob</name>
- <group>DEFAULT</group>
- <job-class>org.quartz.jobs.ee.ejb.EJBInvokerJob</job-class>
- <volatility>false</volatility>
- <durability>false</durability>
- <recover>false</recover>
- <job-data-map allows-transient-data="true">
- <entry>
- <key>ejb</key>
- <value>ejb/Test</value>
- </entry>
- <entry>
- <key>java.naming.factory.initial</key>
- <value>org.openejb.client.RemoteInitialContextFactory</value>
- </entry>
- <entry>
- <key>java.naming.provider.url</key>
- <value>127.0.0.1:4201</value>
- </entry>
- <entry>
- <key>method</key>
- &nb
发表评论
-
JQuery CookBook翻译连载7(第四章)
2010-06-29 18:45 1031今天超级爆发,整理出来第四章中文版翻译。 -
JQuery CookBook翻译连载6(第三章)
2010-06-29 11:31 1017放出jQuery CookBook翻译的第三章。 最近找工作 ... -
JQuery CookBook 翻译连载6(第2章发布)
2010-06-01 14:15 955jQuery Cookbook第1、2章合订版。 不知 ... -
JQuery CookBook 翻译连载5(第1章发布)
2010-05-16 16:55 933jQuery cookBook 第一章翻译打包发布。 ... -
JQuery CookBook翻译连载1
2010-05-14 11:46 8231.1 在HTML页面中添加j ... -
JQuery CookBook翻译连载2
2010-05-14 11:45 8111.2 在页面DOM加载结束后、整个页面加载结束前执行jQue ... -
JQuery CookBook翻译连载3
2010-05-14 11:34 7091.3 使用选择器及jQuery函 ... -
JQuery CookBook翻译连载4
2010-05-14 11:09 6891.4 在特定的上下文 中查找元素 问 ... -
Quartz Job Scheduling Framework第11章翻译初稿
2007-10-27 15:21 1070内容在附件中 -
Quartz Job Scheduling Framework第7章翻译初稿
2007-10-27 15:18 1145内容在附件中 -
Quartz Job Scheduling Framework第5章翻译初稿
2007-10-27 15:18 976在附件中 -
Quartz Job Scheduling Framework第2章翻译初稿
2007-10-27 15:17 1155在附件中 -
Quartz Job Scheduling Framework第8章翻译初稿 续
2007-09-27 19:46 2188You can have as many properti ... -
Quartz Job Scheduling Framework第8章翻译初稿
2007-09-27 19:42 2633Chapter 8. Using Quartz Plug- ... -
Quartz Job Scheduling Framework翻译初稿奉上
2007-09-26 21:55 1609由于时间与水平限制。这本经典书籍翻译的可能并不尽如人意,在此先 ... -
Quartz Job Scheduling Framework第10章翻译初稿
2007-09-26 21:40 2625Chapter 10. Using Quartz with J ...
相关推荐
Quartz Job Scheduling Framework是一个强大的、开放源代码的作业调度框架,它使应用程序能够在指定的时间执行任务,无需人工干预。这个框架广泛应用于Java应用程序中,用于实现定时任务和工作流管理。在第11章中,...
在阅读《Quartz Job Scheduling Framework》第5章时,你会了解到如何创建和配置Cron Triggers,如何结合SimpleTrigger和CalendarIntervalTrigger实现不同类型的定时任务,以及如何优化Quartz的配置以适应大规模的...
Quartz Job Scheduling Framework第2章翻译初稿 博文链接:https://adamed.iteye.com/blog/135880
Quartz Job Scheduling Framework是一个强大的、开源的作业调度框架,用于在Java应用程序中安排任务执行。这个框架允许开发者创建和管理作业,以及定义作业的触发时间。第7章的主题聚焦于实现Quartz监听器,这是一个...
qtz40塔式起重机总体及塔身有限元分析法设计().zip
Elasticsearch是一个基于Lucene的搜索服务器
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
美国纽约HVAC(暖通空调)数据示例,谷歌地图数据包括:时间戳、名称、类别、地址、描述、开放网站、电话号码、开放时间、更新开放时间、评论计数、评级、主图像、评论、url、纬度、经度、地点id、国家等。 在地理位置服务(LBS)中,谷歌地图数据采集尤其受到关注,因为它提供了关于各种商业实体的详尽信息,这对于消费者和企业都有极大的价值。本篇文章将详细介绍美国纽约地区的HVAC(暖通空调)系统相关数据示例,此示例数据是通过谷歌地图抓取得到的,展示了此技术在商业和消费者领域的应用潜力。 无需外网,无需任何软件抓取谷歌地图数据:wmhuoke.com
2023-04-06-项目笔记-第四百五十五阶段-课前小分享_小分享1.坚持提交gitee 小分享2.作业中提交代码 小分享3.写代码注意代码风格 4.3.1变量的使用 4.4变量的作用域与生命周期 4.4.1局部变量的作用域 4.4.2全局变量的作用域 4.4.2.1全局变量的作用域_1 4.4.2.453局变量的作用域_453- 2025-04-01
1_实验三 扰码、卷积编码及交织.ppt
北京交通大学901软件工程导论必备知识点.pdf
内容概要:本文档总结了 MyBatis 的常见面试题,涵盖了 MyBatis 的基本概念、优缺点、适用场合、SQL 语句编写技巧、分页机制、主键生成、参数传递方式、动态 SQL、缓存机制、关联查询及接口绑定等内容。通过对这些问题的解答,帮助开发者深入理解 MyBatis 的工作原理及其在实际项目中的应用。文档不仅介绍了 MyBatis 的核心功能,还详细解释了其在不同场景下的具体实现方法,如通过 XML 或注解配置 SQL 语句、处理复杂查询、优化性能等。 适合人群:具备一定 Java 开发经验,尤其是对 MyBatis 有初步了解的研发人员,以及希望深入了解 MyBatis 框架原理和最佳实践的开发人员。 使用场景及目标:①理解 MyBatis 的核心概念和工作原理,如 SQL 映射、参数传递、结果映射等;②掌握 MyBatis 在实际项目中的应用技巧,包括 SQL 编写、分页、主键生成、关联查询等;③学习如何通过 XML 和注解配置 SQL 语句,优化 MyBatis 性能,解决实际开发中的问题。 其他说明:文档内容详尽,涵盖面广,适合用于面试准备和技术学习。建议读者在学习过程中结合实际项目进行练习,以更好地掌握 MyBatis 的使用方法和技巧。此外,文档还提供了丰富的示例代码和配置细节,帮助读者加深理解和应用。
《基于YOLOv8的智能电网设备锈蚀评估系统》(包含源码、可视化界面、完整数据集、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计
插头模具 CAD图纸.zip
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
《基于YOLOv8的智慧农业水肥一体化控制系统》(包含源码、可视化界面、完整数据集、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计
python爬虫;智能切换策略,反爬检测机制
台区终端电科院送检文档
e235d-main.zip
丁祖昱:疫情对中国房地产市场影响分析及未来展望