Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (601)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (649)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java creation of Temporary files  (Read 1099 times)
0 Members and 1 Guest are viewing this topic.
Offline blahblahblahh

JGO Coder

Medals: 1

« Posted 2004-07-26 23:32:52 »

I have an app that uses the File.createTempFile method, which has always worked for me, but refuses to work in Debian Sad. It seems that this method doesn't work on Debian (it generates "permission denied" whenever you try to use the file you've created).

[Presumably this is either a bug in the JVM (not working with the OS as it should) or in Debian (being over-zealous and some smart-arse making temporary files not work the way they are supposed to in a standard OS, possibly braking POSIX compliance or something like that?), but I know it works fine on both windows and linux. EDIT ... or some other app, completely unrelated, that I happened to run previously from the same BASH and which set the umask to something magnanimous and didn't restore it...although I have NO idea why this breaks the /tmp directory!]

Now I'm stuck trying to think of a workaround: how to get temporary files to work when the OS gives permission-denied every time you open them. This is for an app that creates thousands of files on every run, as a form of primitive file-memory-mapping.

The only thing I can think of is to re-write it from the ground up to use NIO mem-mapping - but then, we already *know* that that part of NIO doesn't work properly at the moment, so... ARGH!

In case someone can think of an easier refactoring (or better design), the basic process is this:

1. recursively split a very very large (hundreds of megabytes) input file into smaller sub-sections using a computationally intensive algorithm (i.e. it's not something plain and simple like a sort)

2. use those sub-sections as source data for running a variety of algorithms. Most algorihtms "cherry-pick" a small subset of the sub-sections to work on (hence this gives us a fast, effective, simplistic sort of virtual memory mgmt). Some algos work on all sub-sections, but use the tree-structured grouping to deal with them in large chunks. Various magic goes on to order algorithm execution to maximise use of any given section whilst it's in memory.

3. delete everything, and return to 1, using a DIFFERENT recursive split algorithm, and a different set of algos in 2 (although many will be the same as ones used previously, there are also many that aren't).

4. ...continues until all splitting algos are complete...

With 2 or 3 splitting algos and a dozen or so processing algos this works fine and fast. It needs to scale to 20-odd splitters and 30-odd processors, but only over time (As I get around to adding the extra algos).

malloc will be first against the wall when the revolution comes...
Offline blahblahblahh

JGO Coder

Medals: 1

« Reply #1 - Posted 2004-07-26 23:36:44 »

OK, I've solved the Debian part, but perhaps my design is still wrong. Any better ideas?

FYI Debian problem was because the umask had been set temporarily to "0777" and not unset. (PS is there a way to set umasks for particular local directories on linux?).

malloc will be first against the wall when the revolution comes...
Offline AndersDahlberg

Junior Devvie

« Reply #2 - Posted 2004-07-31 13:58:37 »

?? chmod ??

Maybe I'm way off here  Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline blahblahblahh

JGO Coder

Medals: 1

« Reply #3 - Posted 2004-07-31 15:00:40 »

?? chmod ??

Maybe I'm way off here  Grin

Sorry, I mean so that any file copied in from anywhere else gets converted to those attributes too. My local copy of chmod only seems to affect new files created there. ?

malloc will be first against the wall when the revolution comes...
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Jesse (11 views)
2015-07-29 04:35:27

Riven (33 views)
2015-07-27 16:38:00

Riven (16 views)
2015-07-27 15:35:20

Riven (20 views)
2015-07-27 12:26:13

Riven (10 views)
2015-07-27 12:23:39

BurntPizza (28 views)
2015-07-25 00:14:37

BurntPizza (39 views)
2015-07-24 22:06:39

BurntPizza (22 views)
2015-07-24 06:06:53

NoxInc (25 views)
2015-07-22 22:16:53

NoxInc (17 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!