Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

J2EE File Event Pattern

Thread view: 
jeff.harman@gmail.com - 10 Jul 2006 15:55 GMT
I have a design issue that I was hoping that this list could assist me
with:

I need to create a File Event Handler that is J2EE compliant.

The basic requirements are:
-       Detect the arrival of a file on a particular path (including
file masking patterns)
-       Recognize the type of file
-       Route either data stream or file reference to an appropriate
handler.  The handler will process the contents of the file.
-       Election of an instance to handle the file (the file will
arrive on a shared drive that all instances of the app will see) to
prevent multiple instances of the same file being processed

Anyone have any good pointers or patterns to use?

Thanks,
Jeff Harman
pranshu - 10 Jul 2006 16:57 GMT
Hello Jeff,

The multiple instance part is interesting.

One option is to use a clustered scheuler.
I have used flux, and it works well.

I think open source Quartz does the trick as well.
http://www.opensymphony.com/quartz/wikidocs/ConfigJDBCJobStoreClustering.html

Alternatively, you could schedule this job on all machine and try to
implement concurrency control which works across JVMs.

The lock - for handling concurrency - is best obtained from a database.
Alternatively, you can make your life more complex and use a file
system and custom code to keep this lock, but be aware that you will
need to check that the OS you are using allows file locking. Java.NIO
lock may not work across JVMs.

Java is quite efficient at listing the files in the file system, so you
are unlikely to run into any issues while polling.

If you have a clustered database - it might be better to create this
job on the database- or trigger it from database - so that it runs only
on one machine and fails over whenever the database does.

Pranshu

> I have a design issue that I was hoping that this list could assist me
> with:
[quoted text clipped - 15 lines]
> Thanks,
> Jeff Harman


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.