Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How can you make idle processors pick up java work?

Reply
Thread Tools

How can you make idle processors pick up java work?

 
 
qwertmonkey
Guest
Posts: n/a
 
      07-31-2012
From: "qwertmonkey" <qwertmonkey@1:261/38.remove-dpk-this>

From: http://www.velocityreviews.com/forums/(E-Mail Removed)

~
> You might have more luck reading the whole file at once

~
Well, this I have tried also, but I am getting java.lang.OutOfMemoryError:
Java heap space relating to the HeapCharBuffer ~ import
java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.channels.FileChannel; import java.nio.MappedByteBuffer; import
java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder; import
java.nio.charset.CodingErrorAction; import
java.nio.charset.CharacterCodingException;

import java.io.File;
import java.io.FileNotFoundException; import java.io.IOException; import
java.io.FileInputStream;

// __
public class NIO06Test{
private static final String aNWLn = System.getProperty("line.separator");
private static final String aOEnc = "UTF-8";
// __
public static void main(String[] aArgs){
if((aArgs != null) && (aArgs.length == 1)){
// __
long lTm00 = System.currentTimeMillis();

Path IFlPth = FileSystems.getDefault().getPath(aArgs[0]);
File IFl = IFlPth.toFile();
if(IFl.exists()){
long lIFlL = IFlPth.toFile().length();
// __
Charset InChrSt = Charset.forName(aOEnc);
CharsetDecoder InDec = InChrSt.newDecoder();
InDec.onMalformedInput(CodingErrorAction.REPORT);
InDec.onUnmappableCharacter(CodingErrorAction.REPO RT);
// __
try{
// __
FileInputStream FIS = new FileInputStream(IFl);
FileChannel IFlChnl = FIS.getChannel();
int iChnlSz = (int)IFlChnl.size();
MappedByteBuffer MptBytBfr = IFlChnl.map(FileChannel.MapMode.READ_ONLY,
0, iChnlSz);
CharBuffer MptChrBfr = InDec.decode(MptBytBfr);
// __
}catch(CharacterCodingException ChrKdX){ ChrKdX.printStackTrace(); }
catch(FileNotFoundException FNFX){ FNFX.printStackTrace(); }
catch(IOException IOX){ IOX.printStackTrace(); }
}
}
else{ System.err.println("// __ usage:" + aNWLn + aNWLn + " java
NIO2_newBufferedReader02Test \"<text file>\"" + aNWLn); }
}
}
~
$ javac -encoding utf8 NIO06Test.java
$ date; java -Xms256m -Xmx1024m -Xincgc -Dfile.encoding=utf8 NIO06Test
/media/sdb1/tmp/eng_news_2006_10M-sentences.txt; date;
Tue Jul 31 08:26:49 UTC 2012
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapCharBuffer.<init>(HeapCharBuffer.java :57)
at java.nio.CharBuffer.allocate(CharBuffer.java:331)
at java.nio.charset.CharsetDecoder.decode(CharsetDeco der.java:777)
at NIO06Test.main(NIO06Test.java:105)
Tue Jul 31 08:26:49 UTC 2012
~
lbrtchx

-+- BBBS/Li6 v4.10 Dada-1
+ Origin: Prism bbs (1:261/3
-+- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24

--- BBBS/Li6 v4.10 Dada-1
* Origin: Prism bbs (1:261/3
--- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can you make idle processors pick up java work? qwertmonkey@syberianoutpost.ru Java 0 07-31-2012 05:30 PM
How can you make idle processors pick up java work? qwertmonkey@syberianoutpost.ru Java 0 07-31-2012 12:30 PM
How can you make idle processors pick up java work? qwertmonkey@syberianoutpost.ru Java 2 07-31-2012 11:41 AM
How can you make idle processors pick up java work? lbrtchx@gemale.com Java 3 07-31-2012 11:16 AM
How can you make idle processors pick up java work? qwertmonkey@syberiaoutpost.ru Java 3 07-31-2012 03:45 AM



Advertisments