org.quartz.simpl.SimpleThreadPool如何使用

Java中quartz框架下的org.quartz.simpl.SimpleThreadPool类如何使用?或者说quartz的线程池如何使用?

tongkp
tongkp 已经解决了,谢谢
6 年多之前 回复
suannai0314
鹳狸媛 楼主的这个问题解决了么?下边的答案能解决问题么?如果可以麻烦点击答案旁的√采纳哦~如果没有也可以将自己的答案贴上然后进行采纳的。
6 年多之前 回复

1个回答

已经解决了,算是一下临时方案,哪位大神有更好的方法可以交流一下,代码如下:

    Properties props = new Properties();
    props.put(StdSchedulerFactory.PROP_THREAD_POOL_CLASS,
            "org.quartz.simpl.SimpleThreadPool");
    props.put("org.quartz.threadPool.threadCount", "50");       //任务线程个数

    StdSchedulerFactory factory = new StdSchedulerFactory();
    factory.initialize(props);
    Scheduler scheduler = factory.getScheduler();
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
quartz项目启动到一半,不停止也不继续启动,求救

我一个quartz项目启动时没报错,但是不知道为什么就是不继续往下启动,控制台输出 2018-3-22 19:37:07 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.6.0_32\bin;E:\Tomcat 6.0\bin 2018-3-22 19:37:07 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2018-3-22 19:37:07 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 579 ms 2018-3-22 19:37:07 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2018-3-22 19:37:07 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.33 2018-3-22 19:37:07 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deploying configuration descriptor manager.xml 2018-3-22 19:37:07 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory bhylhlpt 2018-3-22 19:37:09 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 2018-3-22 19:37:19 org.quartz.simpl.SimpleThreadPool initialize 信息: Job execution threads will use class loader of thread: main 2018-3-22 19:37:19 org.quartz.core.SchedulerSignalerImpl <init> 信息: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 2018-3-22 19:37:19 org.quartz.core.QuartzScheduler <init> 信息: Quartz Scheduler v.1.8.5 created. 2018-3-22 19:37:20 org.quartz.impl.jdbcjobstore.JobStoreSupport initialize 信息: Using db table-based data access locking (synchronization). 2018-3-22 19:37:20 org.quartz.impl.jdbcjobstore.JobStoreCMT initialize 信息: JobStoreCMT initialized. 2018-3-22 19:37:20 org.quartz.core.QuartzScheduler initialize 信息: Scheduler meta-data: Quartz Scheduler (v1.8.5) 'schedule' with instanceId 'zz1521718639046' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered. 2018-3-22 19:37:20 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler 'schedule' initialized from an externally provided properties instance. 2018-3-22 19:37:20 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler version: 1.8.5 2018-3-22 19:37:20 org.quartz.core.QuartzScheduler setJobFactory 信息: JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@166ff9c 2018-3-22 19:37:21 org.quartz.simpl.SimpleThreadPool initialize 信息: Job execution threads will use class loader of thread: main 2018-3-22 19:37:21 org.quartz.core.SchedulerSignalerImpl <init> 信息: Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 2018-3-22 19:37:21 org.quartz.core.QuartzScheduler <init> 信息: Quartz Scheduler v.1.8.5 created. 2018-3-22 19:37:21 org.quartz.impl.jdbcjobstore.JobStoreSupport initialize 信息: Using db table-based data access locking (synchronization). 2018-3-22 19:37:21 org.quartz.impl.jdbcjobstore.JobStoreCMT initialize 信息: JobStoreCMT initialized. 2018-3-22 19:37:21 org.quartz.core.QuartzScheduler initialize 信息: Scheduler meta-data: Quartz Scheduler (v1.8.5) 'startCancleQuertz' with instanceId 'zz1521718641219' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered. 2018-3-22 19:37:21 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler 'startCancleQuertz' initialized from an externally provided properties instance. 2018-3-22 19:37:21 org.quartz.impl.StdSchedulerFactory instantiate 信息: Quartz scheduler version: 1.8.5 2018-3-22 19:37:21 org.quartz.core.QuartzScheduler setJobFactory 信息: JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@346239 我试着把quartz给注释掉就可以启动了,但是这个项目的主要功能都在quartz,注释了就等于废了,查了好久的百度都解决不了,求大神支招

quartz jobstore存储方式,schedule启动成功,但是没有执行job

scheduleManger执行成功,job以及trigger的相关信息也都有写在数据库中,但是根本就没有执行job,希望大家可以帮我解惑,谢谢 这是quartz.properties ``` org.quartz.scheduler.instanceName = DefaultQuartzScheduler org.quartz.scheduler.rmi.export: false org.quartz.scheduler.rmi.proxy: false org.quartz.scheduler.wrapJobExecutionInUserTransaction: false org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 10 org.quartz.threadPool.threadPriority: 5 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.dataSource = myDS org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver org.quartz.dataSource.myDS.URL = jdbc:mysql://localhost:3306/quartz?characterEncoding=utf-8&useSSL=false org.quartz.dataSource.myDS.user = root org.quartz.dataSource.myDS.password = 1234 org.quartz.dataSource.myDS.maxConnections = 30 ``` 这是 QuartzManager.java 文件 public class QuartzManager { private static SchedulerFactory gSchedulerFactory = new StdSchedulerFactory(); /** * 增加任务 * @param jobClass 任务实现类 * @param jobName 任务名称 * @param interval 间隔时间 * @param data 数据 */ public static void addJob(Class<? extends Job> jobClass, String jobName, int interval, Map<String, Object> data) { try { Scheduler sched = gSchedulerFactory.getScheduler(); JobDetail jobDetail = JobBuilder.newJob(jobClass) .withIdentity(jobName, "test3")//任务名称和组构成任务key .build(); jobDetail.getJobDataMap().putAll(data); // 触发器 SimpleTrigger trigger = TriggerBuilder.newTrigger() .withIdentity(jobName, "ttest3")//触发器key .startAt(DateBuilder.futureDate(1, IntervalUnit.SECOND)) .withSchedule(SimpleScheduleBuilder.simpleSchedule() .withIntervalInSeconds(interval) .repeatForever()) .build(); sched.scheduleJob(jobDetail, trigger); // 启动 if (!sched.isShutdown()) { sched.start(); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws InterruptedException { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", "1"); String jobname = "aaa"; addJob(TestJob.class, "aaa", 1, map); try { Thread.sleep(10000); System.out.println("main end----------"); System.exit(1); } catch (InterruptedException e) { e.printStackTrace(); } } ``` ``` 这是TestJob.Java文件 import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; public class TestJob implements Job { public TestJob(){ } public void execute(JobExecutionContext jobexecutioncontext) throws JobExecutionException { String id = jobexecutioncontext.getJobDetail().getJobDataMap().getString("id"); System.out.println("threadId: " + Thread.currentThread().getId() + ", id: " + id); try { System.out.println("=====================>睡眠开始时间:"+System.currentTimeMillis()); Thread.sleep(10000); System.out.println("=====================>睡眠结束时间:"+System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); } } }

Spring 集成Quartz 不能持久话

#持久化配置 **org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX** org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.useProperties:true 运行提示:9:50:57.296 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.SimpleTriggerPersistenceDelegate 09:50:57.297 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.CronTriggerPersistenceDelegate 09:50:57.299 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.CalendarIntervalTriggerPersistenceDelegate 09:50:57.301 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Adding TriggerPersistenceDelegate of type: org.quartz.impl.jdbcjobstore.DailyTimeIntervalTriggerPersistenceDelegate 09:50:57.312 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Freed 0 triggers from 'acquired' / 'blocked' state. 09:50:57.320 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Found 0 triggers that missed their scheduled fire-time. 09:50:57.322 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Recovering 0 jobs that were in-progress at the time of the last shut-down. 09:50:57.322 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Recovery complete. 09:50:57.323 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Removed 0 'complete' triggers. 09:50:57.324 [main] INFO o.q.impl.jdbcjobstore.JobStoreTX - Removed 0 stale fired job entries. 09:50:57.325 [main] DEBUG o.q.i.jdbcjobstore.SimpleSemaphore - Lock 'TRIGGER_ACCESS' retuned by: main 09:50:57.326 [main] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - JobStore background threads started (as scheduler was started). 09:50:57.327 [main] INFO org.quartz.core.QuartzScheduler - Scheduler scheduler_$_NON_CLUSTERED started. 09:50:57.327 [QuartzScheduler_scheduler-NON_CLUSTERED_MisfireHandler] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - MisfireHandler: scanning for misfires... 09:50:57.327 [main] DEBUG o.s.c.s.DefaultLifecycleProcessor - Successfully started bean 'scheduler' 09:50:57.329 [QuartzScheduler_scheduler-NON_CLUSTERED_MisfireHandler] DEBUG o.q.impl.jdbcjobstore.JobStoreTX - Found 0 triggers that missed their scheduled fire-time. 09:50:57.331 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties] 09:50:57.331 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment] 09:50:57.332 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null] 09:50:57.332 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'scheduler' 09:50:57.333 [scheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers 09:50:57.356 [main] INFO org.quartz.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor 09:50:57.357 [main] INFO org.quartz.simpl.SimpleThreadPool - Job execution threads will use class loader of thread: main 09:50:57.359 [main] INFO o.quartz.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 09:50:57.360 [main] INFO org.quartz.core.QuartzScheduler - Quartz Scheduler v.2.2.1 created. 09:50:57.360 [main] INFO org.quartz.simpl.RAMJobStore - RAMJobStore initialized. 09:50:57.360 [main] INFO org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.2.1) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. **Using job-store 'org.quartz.simpl.RAMJobStore**' - which does not support persistence. and is not clustered. 09:50:57.360 [main] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' 09:50:57.361 [main] INFO org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 2.2.1 09:50:57.362 [main] INFO org.quartz.core.QuartzScheduler - Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. 09:50:57.362 [DefaultQuartzScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers 09:50:57.370 [DefaultQuartzScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 1 triggers 09:50:58.019 [Timer-0] DEBUG org.quartz.utils.UpdateChecker - Checking for available updated version of Quartz... 运行的时候就变成了内存方式,哪位大神遇到过,帮忙看看吧

Quartz定时器任务跑着跑着报ClassNotFoundException,但是类是存在的

环境是centOS weblogic11 布置的两个个qurtz服务,一开始跑的好好的,然后就开始莫名奇妙的报ClassNotFoundException,但是说找不到的这个类是确实存在的,因为前面也跑成功了,所以对此问题很不解,有没有遇到过类似问题的朋友 希望获得解答 java.lang.ClassNotFoundException: com.aeye.mbr.de.guangxi.task.SyncStaffYhNeverTask at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270) at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64) at java.lang.ClassLoader.loadClass(ClassLoader.java:305) at java.lang.ClassLoader.loadClass(ClassLoader.java:246) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179) at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.aeye.mbr.de.schedule.BusiJob.execute(BusiJob.java:76) at org.quartz.core.JobRunShell.run(JobRunShell.java:208) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560)

quartz与SPring scheduler.addjob()为空

scheduler.addJob(jobDetail, true); 并没有存入数据 后台也没有异常,请求哪位前辈指点一下,这是什么原因 其他的配置也都没有问题。 --quartz.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="dataSource" ref="jboss_dataSource" /> <property name="transactionManager" ref="transactionManager" /> <property name="applicationContextSchedulerContextKey" value="applicationContext" /> <property name="configLocation" value="classpath:quartz.properties" /> <!--这个是必须的,QuartzScheduler 延时启动,应用启动完后 QuartzScheduler 再启动 --> <property name="startupDelay" value="5" /> <!--这个是可选,QuartzScheduler 启动时更新己存在的Job,这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了 --> <property name="overwriteExistingJobs" value="true" /> <property name="jobDetails"> <list> <ref bean="testBatch" /> </list> </property> </bean> <bean id="testBatch" class="com.sinosoft.core.spring.quartz.MethodInvokingJobDetailFactoryBean"> <!--shouldRecover属性为true,则当Quartz服务被中止后,再次启动任务时会尝试恢复执行之前未完成的所有任务 --> <property name="shouldRecover" value="true" /> <property name="durable" value="true" /> <property name="targetObject" ref="TestBatch" /> <property name="targetMethod" value="runTestBatch" /> </bean> </beans> --quartZ.properties org.quartz.scheduler.instanceName = DefaultQuartzScheduler org.quartz.scheduler.instanceId = AUTO org.quartz.scheduler.rmi.export = false org.quartz.scheduler.rmi.proxy = false org.quartz.scheduler.wrapJobExecutionInUserTransaction = false org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 10 org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.WebLogicDelegate #org.quartz.jobStore.useProperties = true org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.isClustered = false #org.quartz.jobStore.clusterCheckinInterval = 300000 org.quartz.jobStore.maxMisfiresToHandleAtATime=1

quartz2.1.5 调用 scheduler.start()方法时报异常

quartz2.1.5 调用 scheduler.start()方法时报这样一个异常: 严重: An error occurred while scanning for the next triggers to fire. org.quartz.JobPersistenceException: Couldn't acquire next trigger: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1 [See nested exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1] at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2840) at org.quartz.impl.jdbcjobstore.JobStoreSupport$41.execute(JobStoreSupport.java:2755) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3811) at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2751) at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264) Caused by: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OPTION SQL_SELECT_LIMIT=1' at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665) at com.mysql.jdbc.Connection.execSQL(Connection.java:3170) at com.mysql.jdbc.Connection.execSQL(Connection.java:3099) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1248) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92) at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTriggerToAcquire(StdJDBCDelegate.java:2571) at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2781) ... 4 more 我数据库用的是mysql,quartz.properties配置文件时这样的: org.quartz.scheduler.instanceName: SchedulerName #是否支持远程管理 false:不支持 (服务端) org.quartz.scheduler.rmi.export: false #是否支持远程代理 false:不支持 (客服端) org.quartz.scheduler.rmi.proxy: false #如果你要 Quartz 在调用你的 Job 的 execute 之前启动一个 UserTransaction 的话,设置这个属性为 true 。 #这个事物将在 Job 的 execute 方法完成和 JobDataMap (假如是一个 StatefulJob ) 更新后提交。默认值为 false 。 org.quartz.scheduler.wrapJobExecutionInUserTransaction: false #默认线程池类 org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool #最多只能有50个线程并发 org.quartz.threadPool.threadCount: 50 #线程优先级别 org.quartz.threadPool.threadPriority: 5 #指定由石英产生的线程将继承范围内的初始化线程的ClassLoader(线程初始化石英实例)。 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true #线程之间错开后允许间隔时间 毫秒为单位 如果超过这个时间 下一个线程不执行 反之 执行 org.quartz.jobStore.misfireThreshold: 60000 ##所有的Quartz数据,例如Job和Trigger的细节信息被存储在内存中。 数据库:org.quartz.impl.jdbcjobstore.JobStoreTX:内存:org.quartz.simpl.RAMJobStore org.quartz.jobStore.class: org.quartz.impl.jdbcjobstore.JobStoreTX #根据选择的数据库类型不同而不同 PostgreSQLDelegate(mysql) org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate #org.quartz.jobStore.dataSource = myDS #org.quartz.jobStore.isClustered = false #org.quartz.jobStore.useProperties = true org.quartz.jobStore.tablePrefix = QRTZ_ #isClustered设置为"true"激活集群特性 org.quartz.jobStore.isClustered = false org.quartz.jobStore.maxMisfiresToHandleAtATime=1 请问大神,这是什么原因啊?百度了好久,都没找到具体原因

org.apache.tomcat.jdbc.pool.DataSource报错

org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'springNonTxDataSource.startQuertz': org.apache.tomcat.jdbc.pool.PoolExhaustedException: [startQuertz_Worker-6] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:200; busy:200; idle:0; lastwait:30000]. [See nested exception: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [startQuertz_Worker-6] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:200; busy:200; idle:0; lastwait:30000].] at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:168) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3793) at org.quartz.impl.jdbcjobstore.JobStoreSupport.retryExecuteInNonManagedTXLock(JobStoreSupport.java:3758) at org.quartz.impl.jdbcjobstore.JobStoreSupport.triggeredJobComplete(JobStoreSupport.java:3055) at org.quartz.core.QuartzScheduler.notifyJobStoreJobComplete(QuartzScheduler.java:1804) at org.quartz.core.JobRunShell.run(JobRunShell.java:269) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: org.apache.tomcat.jdbc.pool.PoolExhaustedException: [startQuertz_Worker-6] Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available[size:200; busy:200; idle:0; lastwait:30000]. at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:689) at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:187) at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:132) at org.springframework.scheduling.quartz.LocalDataSourceJobStore$2.getConnection(LocalDataSourceJobStore.java:131) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:165) ... 6 more

Spring 定时任务执行时有异常

Spring定时任务,时不时会爆出这么个异常,请大神解释下是什么原因 2015-12-30 16:00:00,123 ERROR [org.quartz.core.JobRunShell] - <Job DEFAULT.runAddTbCdqResultfourJob threw an unhandled Exception: > org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'addTbCdqResultfour' on target class [class com.wind.connector.quartz.RunAddTbCdqResultfour] failed; nested exception is org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:269) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835) at com.wind.daoImpl.BaseDaoImpl.uniqueQuery(BaseDaoImpl.java:46) at com.wind.daoImpl.TbCdqResultfourDaoImpl.getCdqResultByBeginDate(TbCdqResultfourDaoImpl.java:68) at com.wind.managerImpl.TbConnectorManagerImpl.addTbCdqResultfour(TbConnectorManagerImpl.java:424) at com.wind.managerImpl.TbConnectorManagerImpl$$FastClassByCGLIB$$dd5fd868.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at com.wind.managerImpl.TbConnectorManagerImpl$$EnhancerByCGLIB$$24d2f90f.addTbCdqResultfour(<generated>) at com.wind.connector.quartz.RunAddTbCdqResultfour.addTbCdqResultfour(RunAddTbCdqResultfour.java:58) at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260) ... 3 more 2015-12-30 16:00:00,124 ERROR [org.quartz.core.ErrorLogger] - <Job (DEFAULT.runAddTbCdqResultfourJob threw an exception.> org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'addTbCdqResultfour' on target class [class com.wind.connector.quartz.RunAddTbCdqResultfour] failed; nested exception is org.hibernate.NonUniqueResultException: query did not return a unique result: 2] at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) Caused by: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'addTbCdqResultfour' on target class [class com.wind.connector.quartz.RunAddTbCdqResultfour] failed; nested exception is org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:269) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 more Caused by: org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835) at com.wind.daoImpl.BaseDaoImpl.uniqueQuery(BaseDaoImpl.java:46) at com.wind.daoImpl.TbCdqResultfourDaoImpl.getCdqResultByBeginDate(TbCdqResultfourDaoImpl.java:68) at com.wind.managerImpl.TbConnectorManagerImpl.addTbCdqResultfour(TbConnectorManagerImpl.java:424) at com.wind.managerImpl.TbConnectorManagerImpl$$FastClassByCGLIB$$dd5fd868.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at com.wind.managerImpl.TbConnectorManagerImpl$$EnhancerByCGLIB$$24d2f90f.addTbCdqResultfour(<generated>) at com.wind.connector.quartz.RunAddTbCdqResultfour.addTbCdqResultfour(RunAddTbCdqResultfour.java:58) at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260) ... 3 more

springboot+quartz集群,启动时打印 NOT STARTED

启动是控制台打印:目前没有发现有什么影响,还请各位大神帮忙解答一下这个是什么意思,怎么解决 Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 20 threads. Using job-store 'org.springframework.scheduling.quartz.LocalDataSourceJobStore' - which supports persistence. and is clustered.

quartz在window上可以运行,但发布到Linux后不能运行

[org.quartz.impl.StdSchedulerFactory] - Using default implementation for ThreadExecutor [org.quartz.core.SchedulerSignalerImpl] - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl [org.quartz.core.QuartzScheduler] - Quartz Scheduler v.2.3.0 created. [org.quartz.simpl.RAMJobStore] - RAMJobStore initialized. [org.quartz.core.QuartzScheduler] - Scheduler meta-data: Quartz Scheduler (v2.3.0) 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' with instanceId 'NON_CLUSTERED' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler 'org.springframework.scheduling.quartz.SchedulerFactoryBean#0' initialized from an externally provided properties instance. [org.quartz.impl.StdSchedulerFactory] - Quartz scheduler version: 2.3.0 [org.quartz.core.QuartzScheduler] - JobFactory set to: org.springframework.scheduling.quartz.AdaptableJobFactory@45092990 quartz在window上可以运行但部署到服务器后不能运行 <bean id="orderCheckQuartz" class="com.xqt.task.OrderCheckQuartz"> </bean> <bean id="depOrderCheckQuartz" class="com.xqt.task.DepOrderCheckQuartz"> </bean> <bean id="myOrderCheck" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="orderCheckQuartz" /> <property name="targetMethod" value="checkJob" /> <property name="concurrent" value="false" /> </bean> <bean id="myOrderCheckTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="myOrderCheck" /> <property name="cronExpression"> <value>0 20 18 * * ?<alue> </property> </bean> <bean id="myDepOrderCheck" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="depOrderCheckQuartz" /> <property name="targetMethod" value="depOrderJob" /> <property name="concurrent" value="false" /> </bean> <bean id="myDepOrderCheckTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> <property name="jobDetail" ref="myDepOrderCheck" /> <property name="cronExpression"> <value>0 0 6 * * ?<alue> </property> </bean> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref local="myOrderCheckTrigger" /> <ref local="myDepOrderCheckTrigger" /> <st> </property> </bean>

部署项目后tomcat经常在某个时间段就会自动关闭

部署项目后tomcat经常在某个时间段就会自动关闭,以下是日志信息,发下会有个完整的关闭过程,请指教分析下是什么原因导致的,谢谢各位答复! 02-Aug-2017 03:28:59.203 INFO [Thread-11] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8087"] 02-Aug-2017 03:28:59.254 INFO [Thread-11] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-9709"] 02-Aug-2017 03:28:59.305 INFO [Thread-11] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina 02-Aug-2017 03:28:59.509 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [metadata] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 02-Aug-2017 03:28:59.509 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [metadata] registered the JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 02-Aug-2017 03:28:59.510 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.511 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.511 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.512 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-4] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.512 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-5] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.513 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-6] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.513 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-7] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.514 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-8] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.514 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-9] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.515 WARNING [localhost-startStop-2] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [metadata] appears to have started a thread named [scheduler_Worker-10] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:543) 02-Aug-2017 03:28:59.576 INFO [Thread-11] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8087"] 02-Aug-2017 03:28:59.642 INFO [Thread-11] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-9709"] 02-Aug-2017 03:28:59.652 INFO [Thread-11] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8087"] 02-Aug-2017 03:28:59.653 INFO [Thread-11] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-9709"]

Quartz+Spring+Hibernate集群环境下 ClusterManager: Error managing cluster: null

[2013-12-19 14:43:44] [ERROR] [QuartzScheduler_quartzScheduler-NON_CLUSTERED_ClusterManager] (org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3804)) - ClusterManager: Error managing cluster: null java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy28.rollback(Unknown Source) at org.quartz.impl.jdbcjobstore.JobStoreSupport.rollbackConnection(JobStoreSupport.java:3588) at org.quartz.impl.jdbcjobstore.JobStoreSupport.doCheckin(JobStoreSupport.java:3199) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3798) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.run(JobStoreSupport.java:3834) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.quartz.impl.jdbcjobstore.AttributeRestoringConnectionInvocationHandler.invoke(AttributeRestoringConnectionInvocationHandler.java:71) ... 5 more Caused by: java.sql.SQLException: Closed Connection at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445) at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:3450) at com.jolbox.bonecp.ConnectionHandle.rollback(ConnectionHandle.java:958) ... 10 more ##========================# quartz.properties配置如下: ##========================== # #Configure Main Scheduler Properties ##========================== org.quartz.scheduler.instanceName = quartzScheduler org.quartz.scheduler.instanceId = AUTO org.quartz.scheduler.rmi.export = false org.quartz.scheduler.rmi.proxy = false org.quartz.scheduler.wrapJobExecutionInUserTransaction = false ##========================= # #Configure ThreadPool ##========================= org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 10 org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true ##======================== # #Configure JobStore ##======================== org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.oracle.OracleDelegate org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.maxMisfiresToHandleAtATime=10 org.quartz.jobStore.isClustered = true org.quartz.jobStore.clusterCheckinInterval = 15000 #============================# applicationContext-quartz-server.xml配置: #============================# <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>${jdbc.driverClassName}</value> </property> <property name="url"> <value>${jdbc.url}</value> </property> <property name="username"> <value>${jdbc.username}</value> </property> <property name="password"> <value>${jdbc.password}</value> </property> <property name="maxActive" value="5"></property> <property name="maxIdle" value="20"></property> <property name="maxWait" value="50"></property> <property name="defaultAutoCommit" value="true"></property> </bean> <bean name="quartzScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="dataSource" ref="quartzDataSource" /> <property name="applicationContextSchedulerContextKey" value="applicationContextKey" /> <property name="configLocation" value="classpath:config/quartz.properties" /> <property name="triggers"> <list> <ref bean="Trigger1" /> <ref bean="Trigger2" /> <ref bean="Trigger3" /> <ref bean="Trigger4"/> </list> </property> </bean> 四台机器集群,不压力测试没问题,压力测试就出现以上错误,求大神帮忙解决啊! quartz-all-1.6.6.jar

【spring+quartz框架】scheduler.reschedulejob后执行了多次

关于spring+quartz框架配置多线程调度任务,小弟有一事一直没搞明白 一、quartz.properties中配置: #=============================================================== #Configure Main Scheduler Properties #=============================================================== org.quartz.scheduler.instanceName = QuartzScheduler org.quartz.scheduler.instanceId = AUTO #=============================================================== #Configure ThreadPool #=============================================================== org.quartz.threadPool.threadCount = 8 org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool #=============================================================== #Configure JobStore #=============================================================== org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore org.quartz.jobStore.misfireThreshold = 60000 二、XML配置文件中配置了jobDetail: <bean id="monitorSMSJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="server"/> <property name="targetMethod" value="monitorSMS"/> <property name="concurrent" value="true"/> </bean> <bean id="monitorSMSCronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="monitorSMSJobDetail"/> <property name="cronExpression"> <value>0/15 * * * * ?</value><!-- 每隔15秒调度执行 --> </property> </bean> 三、实现类调度方法 public void monitorSMS() { //scheduler.rescheduleJob(monitorSMSCronTrigger.getName(), Scheduler.DEFAULT_GROUP, monitorSMSCronTrigger); System.out.println("enter.."); } 问题是: 因配置了15秒执行一次调度,如果屏蔽掉scheduler.rescheduleJob这行代码,则每次是一个线程执行,如15:30:00 work_1执行,15:30:15 work_2执行,以此类推;如果不屏蔽,则每次8个线程并发执行,且每个线程执行N多次(N无规律,几十次到上百次吧) 求教大神,1 这是什么原因? 2 如果想让8个线程每次执行一遍应该如何做?

使用quartz时遇到的问题

相关配置文件如下 (1)web.xml中相关配置 <!-- qutarz loader configuration --> <servlet> <servlet-name>QuartzInitializer</servlet-name> <servlet-class> org.quartz.ee.servlet.QuartzInitializerServlet </servlet-class> <init-param> <param-name>shutdown-on-unload</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>config-file</param-name> <param-value>quartz.properties</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> (2)quartz.properties文件内容 # # Configure Main Scheduler Properties # org.quartz.scheduler.instanceName = DataTransmit org.quartz.scheduler.instanceId = one # # Configure ThreadPool # org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 5 org.quartz.threadPool.threadPriority = 4 # # Configure JobStore # org.quartz.jobStore.misfireThreshold = 5000 org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore # =========================================================================== # Configure SchedulerPlugins =============================================== # =========================================================================== org.quartz.plugin.triggHistory.class =org.quartz.plugins.history.LoggingTriggerHistoryPlugin org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger{1}.{0}firedjob{6}.{5}at:{4,date,HH:mm:ssMM/dd/yyyy} org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger{1}.{0}completedfiringjob{6}.{5}at{4,date,HH:mm:ssMM/dd/yyyy}withresultingtriggerinstructioncode:{9} org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin org.quartz.plugin.jobInitializer.fileName =/quartz_reminder.xml org.quartz.plugin.jobInitializer.overWriteExistingJobs = false org.quartz.plugin.jobInitializer.failOnFileNotFound = true org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin org.quartz.plugin.shutdownhook.cleanShutdown = true (3)quartz_reminder.xml文件内容 <?xml version="1.0" encoding="UTF-8"?> <quartz> <!-- 每日更新表情计数 --> <job> <job-detail> <name>jobDetail4Day</name> <group>DEFAULT</group> <job-class>com.cycnet.schedule.UpdateFellingCount</job-class> </job-detail> <trigger> <cron> <name>trigger4Day</name> <group>DEFAULT</group> <job-name>updatePerDay</job-name> <job-group>DEFAULT</job-group> <!-- 每天晚上0点触发此任务 --> <cron-expression> 0 0 23 * * ? </cron-expression> </cron> </trigger> </job> </quartz> !!遇到问题 : 当我改变 我的操作系统 的日期时 会在一个我不期望的时间(不是 0 0 23 * * ? 这个表达式表述的时间内) 调用 UpdateFellingCount(Job导出类) 的excute方法 请各位帮忙看下是什么原因,是不是我的配置文件有问题 谢谢 [b]问题补充:[/b] 相关配置文件如下 (1)web.xml中相关配置 <!-- qutarz loader configuration --> <servlet> <servlet-name>QuartzInitializer</servlet-name> <servlet-class> org.quartz.ee.servlet.QuartzInitializerServlet </servlet-class> <init-param> <param-name>shutdown-on-unload</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>config-file</param-name> <param-value>quartz.properties</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> (2)quartz.properties文件内容 # # Configure Main Scheduler Properties # org.quartz.scheduler.instanceName = DataTransmit org.quartz.scheduler.instanceId = one # # Configure ThreadPool # org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 5 org.quartz.threadPool.threadPriority = 4 # # Configure JobStore # org.quartz.jobStore.misfireThreshold = 5000 org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore # =========================================================================== # Configure SchedulerPlugins =============================================== # =========================================================================== org.quartz.plugin.triggHistory.class =org.quartz.plugins.history.LoggingTriggerHistoryPlugin org.quartz.plugin.triggHistory.triggerFiredMessage = Trigger{1}.{0}firedjob{6}.{5}at:{4,date,HH:mm:ssMM/dd/yyyy} org.quartz.plugin.triggHistory.triggerCompleteMessage = Trigger{1}.{0}completedfiringjob{6}.{5}at{4,date,HH:mm:ssMM/dd/yyyy}withresultingtriggerinstructioncode:{9} org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin org.quartz.plugin.jobInitializer.fileName =/quartz_reminder.xml org.quartz.plugin.jobInitializer.overWriteExistingJobs = false org.quartz.plugin.jobInitializer.failOnFileNotFound = true org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin org.quartz.plugin.shutdownhook.cleanShutdown = true (3)quartz_reminder.xml文件内容 <?xml version="1.0" encoding="UTF-8"?> <quartz> <!-- 每日更新表情计数 --> <job> <job-detail> <name>jobDetail4Day</name> <group>DEFAULT</group> <job-class>com.cycnet.schedule.UpdateFellingCount</job-class> </job-detail> <trigger> <cron> <name>trigger4Day</name> <group>DEFAULT</group> <job-name>updatePerDay</job-name> <job-group>DEFAULT</job-group> <!-- 每天晚上0点触发此任务 --> <cron-expression> 0 0 23 * * ? </cron-expression> </cron> </trigger> </job> </quartz> !!遇到问题 : 当我改变 我的操作系统 的日期时 会在一个我不期望的时间(不是 0 0 23 * * ? 这个表达式表述的时间内) 调用 UpdateFellingCount(Job导出类) 的excute方法 请各位帮忙看下是什么原因,是不是我的配置文件有问题 谢谢 补充:quartz版本是1.6.0 [b]问题补充:[/b] 不改变是正常的吗? pan_java (初级程序员) 2009-07-15 不太清楚,因为程序刚写完,应用还没有在晚上运行过 重新启动一下服务器 rain2005 (高级程序员) 2009-07-15 重启后无果 再问一下,怎么回复 答案啊? javaeye做的不是很人性化, :( [b]问题补充:[/b] 遇到了更奇怪的问题 我设置了每10秒执行一次(0/10 * * * * ?) 可以正常执行, 我修改为每分钟的20秒时执行一次(20 * * * * ?) 然后重启服务,还是每10秒执行一次, 更改excute方法 System.out.println("in the UpdateFellingCount !!! " + new Date()); (更改前) ------>>>>>>>(更改后) System.out.println("in the UpdateFellingCount !!! " + new Date() + "!!!!"); 然后重新部署应用,清空tomcat的work目录,重启Eclipse, 结果还是每10秒执行一次,console内容如下: in the UpdateFellingCount !!! Wed Jul 15 15:35:00 CST 2009 in the UpdateFellingCount !!! Wed Jul 15 15:35:10 CST 2009 in the UpdateFellingCount !!! Wed Jul 15 15:35:20 CST 2009 in the UpdateFellingCount !!! Wed Jul 15 15:35:30 CST 2009 in the UpdateFellingCount !!! Wed Jul 15 15:35:40 CST 2009 in the UpdateFellingCount !!! Wed Jul 15 15:35:50 CST 2009 in the UpdateFellingCount !!! Wed Jul 15 15:36:00 CST 2009 in the UpdateFellingCount !!! Wed Jul 15 15:36:10 CST 2009 !!!!!!!

启动一个定时任务就报错了

但是任务还是继续跑着 ``` 2016-3-11 10:36:15 org.quartz.core.ErrorLogger schedulerError 严重: Unable to notify JobListener(s) of Job that was executed: (error will be ignored). trigger= group2.guanbi job= group2.job2 org.quartz.SchedulerException: JobListener 'dummyJobListenerName' threw exception: null [See nested exception: java.lang.NullPointerException] at org.quartz.core.QuartzScheduler.notifyJobListenersWasExecuted(QuartzScheduler.java:1987) at org.quartz.core.JobRunShell.notifyJobListenersComplete(JobRunShell.java:340) at org.quartz.core.JobRunShell.run(JobRunShell.java:224) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.NullPointerException at test1.HelloJobListener.jobWasExecuted(HelloJobListener.java:37) at org.quartz.core.QuartzScheduler.notifyJobListenersWasExecuted(QuartzScheduler.java:1985) ... 3 more ``` 下面是报错类的代码 ``` public class HelloJobListener implements JobListener { public static final String LISTENER_NAME = "dummyJobListenerName"; @Override public String getName() { // TODO Auto-generated method stub return LISTENER_NAME; } @Override public void jobToBeExecuted(JobExecutionContext context) { String jobName = context.getJobDetail().getKey().toString(); System.out.println("jobToBeExecuted"); System.out.println("Job : " + jobName + " is going to start..."); } @Override public void jobExecutionVetoed(JobExecutionContext context) { System.out.println("jobExecutionVetoed"); } @Override public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { System.out.println("jobWasExecuted"); String jobName = context.getJobDetail().getKey().toString(); System.out.println("Job : " + jobName + " is finished..."); if (!jobException.getMessage().equals("")) { System.out.println("Exception thrown by: " + jobName + " Exception: " + jobException.getMessage()); } } } ```

quartz 任务调度问题,每次都执行两次 相隔只有几微秒

quartz 任务调度问题,每次都执行两次 相隔只有几微秒 导致插入数据库错误 没办法解决 [code="java"] org.quartz.scheduler.instanceName = QuartzScheduler org.quartz.scheduler.instanceId = AUTO org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 1 org.quartz.threadPool.threadPriority = 10 org.quartz.jobStore.misfireThreshold = 60000 org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore [/code] [code="java"] <bean id="cronTriggerPunch" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <!-- 使用嵌套Bean的方式来定义任务Bean --> <bean class="org.springframework.scheduling.quartz.JobDetailBean"> <!-- 指定任务Bean的实现类 --> <property name="jobClass" value="org.leegang.hrsystem.schedule.PunchJob"/> <!-- 为任务Bean注入属性 --> <property name="jobDataAsMap"> <map> <entry key="empMgr" value-ref="empManager"/> </map> </property> </bean> </property> <!-- 指定Cron表达式:周一到周五21点执行调度 --> <property name="cronExpression" value="0 0 21 ? * MON-FRI"/> </bean> [/code]

quartz 集群环境下,停掉一个点,该点下的定时任务不被其他点承接,定时任务不再执行

集群环境下 springboot + quartz,停掉一个点,该点下的定时任务不被其他点承接,定时任务不再执行 两个job类20秒执行一次 0/20 * * * * ? 启动两个,能看到控制台的两个项目分别打印两个定时任务的日志,停掉其中一个项目,日志不变,停掉项目中的任务没有被运行的项目执行,运行的项目还执行原任务 配置文件 ``` #quartz集群配置 # =========================================================================== # Configure Main Scheduler Properties 调度器属性 # =========================================================================== #调度标识名 集群中每一个实例都必须使用相同的名称 org.quartz.scheduler.instanceName=DefaultQuartzScheduler #ID设置为自动获取 每一个必须不同 org.quartz.scheduler.instanceid=AUTO #============================================================================ # Configure ThreadPool #============================================================================ #线程池的实现类(一般使用SimpleThreadPool即可满足几乎所有用户的需求) org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool #指定线程数,至少为1(无默认值)(一般设置为1-100直接的整数合适) org.quartz.threadPool.threadCount=10 #设置线程的优先级(最大为java.lang.Thread.MAX_PRIORITY 10,最小为Thread.MIN_PRIORITY 1,默认为5) org.quartz.threadPool.threadPriority=5 #============================================================================ # Configure JobStore #============================================================================ # 信息保存时间 默认值60秒 org.quartz.jobStore.misfireThreshold=60000 #数据保存方式为数据库持久化 org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX #数据库代理类,一般org.quartz.impl.jdbcjobstore.StdJDBCDelegate可以满足大部分数据库 org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate #JobDataMaps是否都为String类型 org.quartz.jobStore.useProperties=false #数据库别名 随便取 org.quartz.jobStore.dataSource=myDS #表的前缀,默认QRTZ_ org.quartz.jobStore.tablePrefix=QRTZ_ #是否加入集群 org.quartz.jobStore.isClustered=true #调度实例失效的检查时间间隔 org.quartz.jobStore.clusterCheckinInterval=15000 ``` ``` @Configuration public class QuartzConfiguration { @Autowired DataSource dataSource; /** * 继承org.springframework.scheduling.quartz.SpringBeanJobFactory 实现任务实例化方式 */ public static class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware { private transient AutowireCapableBeanFactory beanFactory; @Override public void setApplicationContext(final ApplicationContext context) { beanFactory = context.getAutowireCapableBeanFactory(); } /** * 将job实例交给spring ioc托管 我们在job实例实现类内可以直接使用spring注入的调用被spring ioc管理的实例 * * @param bundle * @return * @throws Exception */ @Override protected Object createJobInstance(final TriggerFiredBundle bundle) throws Exception { final Object job = super.createJobInstance(bundle); /** * 将job实例交付给spring ioc */ beanFactory.autowireBean(job); return job; } } /** * 配置任务工厂实例 * * @param applicationContext spring上下文实例 * @return */ @Bean public JobFactory jobFactory(ApplicationContext applicationContext) { /** * 采用自定义任务工厂 整合spring实例来完成构建任务 see {@link AutowiringSpringBeanJobFactory} */ AutowiringSpringBeanJobFactory jobFactory = new AutowiringSpringBeanJobFactory(); jobFactory.setApplicationContext(applicationContext); return jobFactory; } /** * 配置任务调度器 使用项目数据源作为quartz数据源 * * @param jobFactory 自定义配置任务工厂 * @return * @throws Exception */ @Bean(destroyMethod = "destroy", autowire = Autowire.NO) public SchedulerFactoryBean schedulerFactoryBean(JobFactory jobFactory) throws Exception { SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); // 将spring管理job自定义工厂交由调度器维护 schedulerFactoryBean.setJobFactory(jobFactory); // 设置覆盖已存在的任务 schedulerFactoryBean.setOverwriteExistingJobs(true); // 项目启动完成后,等待10秒后开始执行调度器初始化 schedulerFactoryBean.setStartupDelay(10); // 设置调度器自动运行 schedulerFactoryBean.setAutoStartup(true); // 设置数据源,使用与项目统一数据源 schedulerFactoryBean.setDataSource(dataSource); // 设置上下文spring bean name schedulerFactoryBean.setApplicationContextSchedulerContextKey("applicationContext"); // 设置配置文件位置 schedulerFactoryBean.setConfigLocation(new ClassPathResource("/application-quartz.properties")); return schedulerFactoryBean; } } ```

程序跑了3天,出现java.util.NoSuchElementException异常

程序运行3天,出现java.util.NoSuchElementException异常 [code="java"] java.util.NoSuchElementException at java.util.LinkedList.remove(LinkedList.java:788) at java.util.LinkedList.removeFirst(LinkedList.java:134) at java.util.LinkedList.poll(LinkedList.java:470) at com.etopad.netunion.visitorInfo.quartz.SaveVisitorInfoJob.pollWm(SaveVisitorInfoJob.java:118) at com.etopad.netunion.visitorInfo.quartz.SaveVisitorInfoJob.executeInternal(SaveVisitorInfoJob.java:70) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:531) [/code] [code="java"] if (visitorsNum != 0) { for (int i = 0; i < visitorsNum; i++) { saveWmList.add(wmVisitors.poll()); } } [/code] 我用poll(),就算LinkedList链表中没数据也是输出null的啊,不会出现java.util.NoSuchElementException异常,程序跑了3天后才出现这个问题的,请问是什么原因?

新手出错,求大手指教

org.apache.axis2.AxisFault: Unmarshalling Error: unexpected element (uri:"", local:"arg0"). Expected elements are <{}picrecordJson>,<{}extend> at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531) at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102) at com.tiandy.util.RPCServerClientUtil.invoke(RPCServerClientUtil.java:76) at com.tiandy.client.UpClientForDZWCHD.reportPassingVehicleInfo(UpClientForDZWCHD.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276) at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:216) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

立即提问
相关内容推荐