Does Quartz have analogs of ThreadPoolExecutor's beforeExecute and afterExecute methods?
See the TriggerListener and JobListener interfaces.
Related
Unlike Swing Javafx-8 doesn't appear to have "setEnabled()" methods (or equivalent) for UI controls. Suggestions for workarounds?
You can use setDisable() instead of setEnabled() in javaFx..
like button.setDisable(false)
setDisable is a public method for disabling a node, setDisabled is a protected method used only by internal implementations
I am using JBoss application server 6 and using JBoss AOP aspects in my application.
An example of aspect shown below:
public class DBAspect{
public Object accessDBConnection(FieldReadInvocation invocation) {
return dbConnection;
}
public Object accessDBConnection((FieldWriteInvocation invocation) {
throw exception;
}
}
Currently, these advice methods are applied to a private variable in class say DBUsage by binding it with this aspect.
I am migrating to a new application server and it is not supporting JBoss AOP. So, how do I implement this concept.
How can I implement this behavior. Please help.
Applying field get/set pointcuts to private field does not sound like good application or aspect design to me. Maybe refactoring your application would be a better idea. Anyway, in AspectJ you can use get() and set() pointcuts in order to intercept field get/set actions. If you want to access private fields, you might need to use a privileged aspect.
AspectJ quick reference
Privileged aspects
AspectJ pointcut types (incl. get/set)
There is a feature in Spring.Net called "look-up method injection", that allows the container to override the method. For example:
The method:
protected abstract DbConnection GetCurrentConnection();
The config file:
<lookup-method name="GetCurrentConnection" ref="connection"/>
Does Autofac support this feature? If not, is there any alternative approach?
I've considered two approaches, but allow of them seems anti-pattern
Use ServiceLocator
Inject a Func object
I just got the grip on GWTP and the MVP, GIN and Dispatch.
With dispatch there is a Handler class which defines what the action does and returns something accordingly.
So far I found myself with a case where I have 2 actions that require to execute the same method. For which I believe ActionHandling is not where the bussiness logic goes, but that it should go in a layer behind it which pass something to it somehow
How should I layout my logic? I would like to use Hibernate later on btw.
EDIT:
as a note, applying the answers provided on practice, what needs to be done is:
1.- Create a module class that extends AbstractModule, this contains
bind(Service.class).to(ServiceImpl.class);
2.- on your GuiceServletcontextListener add your serviceModule to the getInjector method return:
return Guice.createInjector(new ServerModule(), new DispatchServletModule(), new ServiceModule());
3.- On yours actionHandlers constructors have something like this
#Inject
TestHandler(Service service) { this.service=service }
Business logic should be in your business objects, which are independent from your Handler classes. Try to design your business layer in a technology-agnostic way.
The handlers delegate all significant processing to the business objects, so they (the handlers) should be pretty thin actually.
You could try to inject the service layer into the handler. The service can be created as a singleton.
#Inject
public MyHandler(MyService service) {
this.service = service;
}
Is MyService an interface? If yes, you forgot to bind it inside Guice.
Personnaly I use DAOs to put my logic between ActionHandlers and my persistence framework (Hybernate, Objectify, Twig-Persist, etc.)
How do I add to my Quartz Job DisallowConcurrenExecution?
I am new to Quartz 2.0, but I implemented a StatefulJob
If you implement StatefulJob, then you automatically inherit the #DisallowConcurrenExecution annotation.
You can instead tag your class with the annotation (and other related annotation for re-persisting the JobDataMap after execution) - and not implement StatefulJob and have the same affect.