commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Zeigermann <oliver.zeigerm...@gmail.com>
Subject Re: Transaction - FileResourceManager
Date Tue, 04 Jan 2005 10:23:11 GMT
On Mon, 3 Jan 2005 12:55:13 -0700, David Erickson <david@ratemod.com> wrote:
> Couple Questions regarding the new Transaction package, specifically the
> FileResourceManager.
> 
> It was a bit vague in the FRM docs, but it talked about threaded access to
> the FRM object, and left me still wondering.  I will be using this in a web
> application, and it will have multiple threads needing access to the FRM
> object, however each thread will only ever access 1 transaction at a time,
> and that transaction will be created/destroyed by that thread.  Is that ok?

Yes.
 
> I'm also wondering, for example I have a method on my service object:
> 
> InputStream getFile(Long courseId, String fileName) throws
> DataAccessException;
> 
> This method is already wrapped using AOP from Spring with a transaction
> manager for RBDMS access, I would like to integrate FRM into an Aspect as
> well.  However I'm wondering since its returning an InputStream what happens
> if the transaction closes before the InputStream is read?  Would I need to
> move from returning a stream to returning a byte[] or something that has
> been fully read from the filesystem?  Is there a best approach I should use
> for this type of situation?

If the stream comes from the FRM and it has been opened inside a
transaction it will be closed by the FRM upon commit/rollback.

> Also I noticed when you instantiate a FRM you give it a base path for the
> files to be stored at.  Is it legal when specifying resources to read/write,
> to specify a directory then the file?  IE basepath /storage/content then
> when I specify a read resource specify it as /5/something.wav for a total
> path of /storage/content/5/something.wav?

This should work.

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message