I am currently developing a module for Apache 2/2.2 and need to perform some cleanup before the main Apache process terminates (not the child processes).
I have searched extensively without finding any guidelines on which hook to use. Can anyone help point me in the right direction?
I'm not sure what you are exactly trying to do, but I think that the apr_reslist_create and apr_pool_cleanup_register functions may help you. One of the parameters in the apr_reslist_create function is apr_reslist_destructor which you can use to pass destructor function. Also, I think you should take a look at the mod_dbd module source code since it is a pretty good example of how to create and cleanup external resources from the apache process.
Apr-Util apr_reslist_create
Apr apr_pool_cleanup_register
Related
I just want to my flink application as much as configurable. And also i want to change the behavior of the process function in the running time instead of stopping the cluster and re-deploy the jar file.
Is there any document for that? Or is it possible to inject process function code into running jar. For instance, from the web ui, i will get the process function input(as a java code) then after submitting the form, I will update the process function behavior.
You can use a BroadcastProcessFunction (or a KeyedBroadcastProcessFunction), and on the broadcast channel, communicate (in some fashion) what the process function is supposed to do.
I've seen this technique used to broadcast javascript code (to be executed by Rhino), commands in a DSL, references to a JAR file to load, etc.
It's old and not well documented, but https://github.com/alpinegizmo/flink-training-exercises/blob/master/src/main/java/com/ververica/flinktraining/solutions/datastream_java/broadcast/TaxiQuerySolution.java is an example of this approach that uses Janino to compile and execute dynamically supplied Java expressions.
I've just started learning Mosquitto recently. I need to create a custom event handler (on client connect and on message received) that will be built in Mosquitto and run on server as a bundle. The idea is not in using separate program (client) subscribed to some topics (as it works in most use-cases) but make Mosquitto handle data.
My idea is:
Some imagine client do a pub to Mosquitto in some topic.
Mosquitto do its magic (default behavior) and also runs a callback (so the data handled the way I describe it in CB)
I've read Mosquitto API docs but can hardly understand how to use it.
Questions are:
Is that possible to create such plugin using Mosquitto/API?
Do you have a repository with an example of creating callbacks? Seen mysql example and auth-plug example but none worked for me - still no luck in building custom plugin.
Or maybe someone can describe the process of creating plugins / extending mosquitto?
Any instructions on building plugins and injecting them into Mosquitto?
If you know rust, this might be useful, I just wrote it. Just because I did not want to figure out how to do stuff in C.
https://crates.io/crates/mosquitto-plugin
There is an example showing how to use it.
Regarding your callback to do something with the data,I havent tried it, but I believe that you could use ACL rule check to do something with the data, even spawning a thread do do something asynchronous
I know that plugins like surefire have an "argLine" configuration parameter which they pass along to the JVM where the specific goals for the plugin is run. As I understand, by default, maven plugins are forked and run in a separate JVM (please correct me if I am wrong).
I am trying to figure out how to pass on VM arguments to a maven plugin jibx, but don't know if there is an easier/declarative way (or via a Util class) that I can configure it to do this. In surefire, there are utility classes in booterclient that seem to be handling this, but the functionality seems to be universal across plugins, right? Hence wondering if there might be some support from Mojo/Plexus to add this easily without writing a bunch of plumbing code. Again, please correct me if my understanding is incorrect
Thanks in advance!
The actual Maven plugin classes are run in the same JVM as Maven.
Where a Maven plugin is wrapping a separate tool, it depends on how the Maven plugin was written whether it forks a process or not.
For example the Cobertura Maven Plugin forks a process to do the Cobertura things. There is no technical reason for this fork, in the case of Cobertura the forking of the JVM is to work around the GPL licensing of the Cobertura Tool itself.
As you noticed the Surefire plugin usually forks a process for running the unit tests. It does not technically need to fork (see forkMode=never) however, there are good reasons due to the poor isolation of some parts of the JVM that require forking, e.g. System properties being global.
Looking at the plugin in your question you can see that it is just invoking the JIBX's main method directly. In other words it is not forking the JVM at all. If there are JVM options that you want, you will need to use the MAVEN_OPTS environment variable to specify them (with the side-effect that they are global for Maven, and if you forget to specify them, then things will not work as you expect)
I think to fix this you should really suggest a patch to the plugin that forks and accepts JVM options for the forked JVM
We have an existing C library (DLL / .so) that processes some data. There's a call to initialise it, then a call to give it the parameters it needs to process, and then a few calls to retrieve the different output parameters you are interested in. The initialise is then called to reset the library for the next session. We have an app built around this to easily input the data and view the results.
Now we want to take this library and make it available as a web service. We are looking for the simplest (read quickest) way to do this. As I see it, we need:
A web services framework (Apache Axis2/C looks good for existing C code)
Some way to start a process for each incoming query (not sure if Axis2 can do something like this).
So my question is : Is Axis2/C the simplest way, or is there another simple solution?
If you have an external executable you can call, how about using something like Apache with FastCGI?
I am trying to write a simple program, preferably in C, that will watch a given directory. Whenever a process accesses that directory, I just want to print out the name of that process. It seems simple, but I am coming up short for solutions on MSDN. Does anyone know which library calls I will need for this, or any helpful advice? I have considered repeatedly querying for what processes have handles on the given directory and just watching for additions to that list.This approach just seems very intensive and I am hoping there is an easier way. Thanks.
I'm not sure if there's an easier way, but one way is to use a file system filter driver. Or easier a file system minifilter driver.
You can filter, log, track, control, ... all IO.
There is no supported way to do this from user mode. You can use the FindFirstChangeNotification API to tell when a file or directory has changed, but that doesn't tell you who did it. You might be able to hook some things to obtain this information... but that is of course not supported.
If you can use a driver, you can use Event Tracing for Windows for this information. This is what Sysinternals ProcMon uses. But installation of a driver is a very invasive process, bugs in your driver cause BSODs, and installation of a driver requires administrative rights. Something to keep in mind.