voyent
[ICEpdf version 4.0.]Exception in thread "ICEpdf-pagePainter" and "ICEpdf-pageInitializer"  XML
Forum Index -> ICEpdf General
Author Message
minhbt2709

Joined: 11/Dec/2009 00:00:00
Messages: 7
Offline


Hello,
I use ICE pdf as an applet. When i open few scanned pdf continuously , It show only GUI without page content. I open java console to see error and get this:

Java Plug-in 1.6.0_10
Using JRE version 1.6.0_10 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\NPL
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


Dec 29, 2009 3:13:24 PM org.icepdf.core.pobjects.Catalog <clinit>
INFO: ICEsoft ICEpdf Core ICE-v4
Exception in thread "ICEpdf-pagePainter" java.lang.IllegalMonitorStateException
at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown Source)
at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "ICEpdf-pageInitializer" java.lang.IllegalMonitorStateException
at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown Source)
at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


It might be wrong when ICE try to creat a thread to initit page pool.
How can i fix this?
Thanks to ICEpdf team!
Minhbt.
[Thumb - 29-12-2009 3-48-40 PM.png]
 Filename 29-12-2009 3-48-40 PM.png [Disk] Download
 Description Error image
 Filesize 56 Kbytes
 Downloaded:  198 time(s)

 Filename error.txt [Disk] Download
 Description Java console
 Filesize 2 Kbytes
 Downloaded:  204 time(s)

patrick.corless

Joined: 26/Oct/2004 00:00:00
Messages: 1927
Offline


I suspect you might need to assign more memory to the JVM, try 128 MB. Also can you post the file?
[Email]
minhbt2709

Joined: 11/Dec/2009 00:00:00
Messages: 7
Offline


Hello patrick.corless,
I m happy to inform you that: we ve solved this last week. Let me describe this error more detail:
I use ICEpdf as applet to view PDF files in client-side, Whenever i close browser that contains applet, this error comes. But if i keep browser open and continue to open another pdf files, there is no error, it works well.
And how we fix this:
-Whenever thread pageInitilizationThreadPool is created and executes, try to catch exception and re-create it.
In function executePageInitialization:
public void executePageInitialization(Runnable runnable) throws InterruptedException {
try {
pageInitilizationThreadPool.execute(runnable);
} catch (RejectedExecutionException re) {
System.out.println("Create new pageInitializer thread");
pageInitilizationThreadPool = new ThreadPoolExecutor(
1, maxPageInitThreads, KEEP_ALIVE_TIME, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
// pageInitilizationThreadPool.getThreadFactory();
// set a lower thread priority

pageInitilizationThreadPool.setThreadFactory(new ThreadFactory() {
public Thread newThread(java.lang.Runnable command) {
Thread newThread = new Thread(command);
newThread.setName("ICEpdf-pageInitializer-" + index);
newThread.setPriority(Thread.NORM_PRIORITY);
newThread.setDaemon(true);
return newThread;
}
});
index++;
pageInitilizationThreadPool.execute(runnable);
}
}

-Same solution for pagePainterThreadPool in function executePagePainter
public void executePagePainter(Runnable runnable) throws InterruptedException {
try {
pagePainterThreadPool.execute(runnable);
} catch (RejectedExecutionException re) {
System.out.println("Create new pagePainter thread");
pagePainterThreadPool = new ThreadPoolExecutor(
1, maxPageInitThreads, KEEP_ALIVE_TIME, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>());
// pageInitilizationThreadPool.getThreadFactory();
// set a lower thread priority
pagePainterThreadPool.setThreadFactory(new ThreadFactory() {

public Thread newThread(java.lang.Runnable command) {
Thread newThread = new Thread(command);
newThread.setName("ICEpdf-pagePainter-" + index);
newThread.setPriority(Thread.NORM_PRIORITY);
newThread.setDaemon(true);
return newThread;
}
});
index++;
pageInitilizationThreadPool.execute(runnable);
}
}

-In dispose function: shutdown threads:
public void dispose() {

if (pageComponents != null) {
for (AbstractPageViewComponent pageViewComponent : pageComponents) {
if (pageViewComponent != null) {
pageViewComponent.dispose();
}
}
pageComponents.clear();
}
synchronized (this) {
// do a little clean up.pageInitilizationThreadPool
pageInitilizationThreadPool.shutdownNow();
pagePainterThreadPool.shutdownNow();
// pageInitilizationThreadPool.getQueue().clear();
// pagePainterThreadPool.getQueue().clear();

}
}


And it works!
Many thanks to ICE team!
Minhbt.

 Filename AbstractDocumentViewModel.java [Disk] Download
 Description
 Filesize 17 Kbytes
 Downloaded:  297 time(s)

 
Forum Index -> ICEpdf General
Go to:   
Powered by JForum 2.1.7ice © JForum Team