- Setback 最开始我想使用SPI的方式通过用户配置自动获得所有的任务类,但是这样做是不可取的。原因是SPI强制要求实现类有一个无参数的构造方法,并且使用这个无参数的构造方法进行实例化。 但这样的局限性太大,通常情况下,定时任务的执行需要依赖于一些其他的参数例如数据库操作类等等,使用SPI的方式无法传递引用。若是想在SPI的基础上实现自动注入,那么相当于开发了一套Spring,成本太高。 同理,指定一个包路径扫描出该包下所有的定时任务类也是不可取的。总的来说,这两种方式都是通过反射创建定时任务类的实例,但由于通过反射创建的过程中却无法动态的感知构造方法的参数并传入, 导致使用无参数的构造方法,而这样做将使得定时任务类的能力大大受限。
- Imagine 解决上述问题的一个方法是直接从Jvm Heap中取出对应已经加载好的对象,进行方法调用。After investigation,一是很难做到,二是既然都已经手动创建好了对象还费劲去Heap中拿干什么😂
timekiller-executor's Introduction
timekiller-executor's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.