J
Joseph
Hello All,
I have a class which establishes a JMS network connection, and then
sniffs a directory for new files. every time it sniffs a new file, it
trylocks it (to make sure the Python program that created the file is
finsished with it) then starts an instance of a runnable class which
parses the passed file and sends some stuff out the passed JMS
connection.
This works just fine, but I would like to now have multiple instances
of my sniffer/connection class because I want multiple JMS
connections. But it trips up on the file locking because the file lock
sees it all as one process. Ideally if I had two classes sniffing the
same directory, both would try to lock the file and one would succeed,
and the other would not and would ignore it and grab the next file.
But both are able to get the lock because the lock makes no
distinction between the processes and all sorts of bad things happen.
So what should I do? I could make the snifferclass open several
connections and have it assigns them round robin style to the parse
threads, but that would involve changing a bunch of things (and
potentially breaking things). The point of all of this is to be able
to open more connections when there is heavy traffic. And the easiest
way to be able to do that would be to start multiple insrtances of my
existing program when needed.
Any suggestions?
Thanks,
Joseph
I have a class which establishes a JMS network connection, and then
sniffs a directory for new files. every time it sniffs a new file, it
trylocks it (to make sure the Python program that created the file is
finsished with it) then starts an instance of a runnable class which
parses the passed file and sends some stuff out the passed JMS
connection.
This works just fine, but I would like to now have multiple instances
of my sniffer/connection class because I want multiple JMS
connections. But it trips up on the file locking because the file lock
sees it all as one process. Ideally if I had two classes sniffing the
same directory, both would try to lock the file and one would succeed,
and the other would not and would ignore it and grab the next file.
But both are able to get the lock because the lock makes no
distinction between the processes and all sorts of bad things happen.
So what should I do? I could make the snifferclass open several
connections and have it assigns them round robin style to the parse
threads, but that would involve changing a bunch of things (and
potentially breaking things). The point of all of this is to be able
to open more connections when there is heavy traffic. And the easiest
way to be able to do that would be to start multiple insrtances of my
existing program when needed.
Any suggestions?
Thanks,
Joseph