Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  
  Applet trouble - long pause due to download??  (Read 3190 times)
0 Members and 1 Guest are viewing this topic.
Offline CommanderKeith
« Posted 2011-02-03 10:25:10 »

Hi,

I've had a niggly problem where my applet demo stalls for ages before displaying anything.

Here it is: http://www.keithwoodward.com/straightedge/index.html

I think I've figured out the problem- the applet stalls while it tries to download something, because
1. When I pull out the network cable just after it begins to stall the applet just stays frozen forever.
2. It only affects the applet version of the demo not the (http://www.keithwoodward.com/straightedge/straightedge.jnlp) webstart version
3. When using appletviewer on my computer's local version of the applet then there is no pause, it only occurs when the applet is hosted from my website.
4. Running the applet using appletviewer.exe with the -Xprof option on the web-hosted applet shows that a lot of time is spent in the method java.net.SocketInputStream.socketRead0 in the thread which runs the code that stalls. The place where the code stalls is just before the constructor of my game's View object. Using System.out.println I know that the stall occurs before the constructor is actually executed, and before the class is fully loaded (static{System.out.println();} is printed after the stall has ended and the applet continues).

I've got a feeling that the applet is trying to download the jts-1.11.jar when the classloader tries to load the View class, since the View class references code that requires the jts-1.11.jar file, and so the applet pauses while that jar is being downloaded. But this is just a guess  Undecided

So my question is, why is the applet trying to download stuff halfway thru execution? I thought eager downloading was the default and lazy downloading had to be specified?

Here's my applet html code:
1  
2  
3  
4  
5  
6  
<applet code="straightedge.test.demo.AppletImpl.class"
        archive="straightedge.jar, jts-1.11.jar"
        width="500" height="500"
        align="center"
        alt="StraightEdge demo applet">
</applet>


And the huge -Xprof output from appletviewer. The last lines printed to the console when the stall occurs are 1/4 way down at:
MainApplet: init
: start 0
: start 1
: start .1
: start .2
: start .3.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
C:\Users\Keith>c:\"Program Files"\Java\jdk1.6.0_20\bin\appletviewer.exe http://w
ww.keithwoodward.com/straightedge/index.html -J-Xprof

Flat profile of 0.01 secs (1 total ticks): AppContextCreator

  Thread-local ticks:
100.0%     1             Unknown: no last frame


Flat profile of 0.98 secs (97 total ticks): main
  Interpreted + native   Method
 52.6%     0  +    50    java.net.SocketInputStream.socketRead0
 24.2%     0  +    23    sun.java2d.d3d.D3DRenderQueue.flushBuffer
  2.1%     0  +     2    sun.java2d.d3d.D3DGraphicsDevice.initD3D
  2.1%     0  +     2    java.io.WinNTFileSystem.canonicalize0
  1.1%     0  +     1    java.io.WinNTFileSystem.getBooleanAttributes
  1.1%     0  +     1    java.net.Inet6AddressImpl.lookupAllHostAddr
  1.1%     0  +     1    java.lang.ClassLoader$NativeLibrary.load
  1.1%     0  +     1    sun.awt.windows.WMenuItemPeer.create
  1.1%     0  +     1    sun.awt.windows.WFramePeer.setMenuBar0
  1.1%     0  +     1    java.io.WinNTFileSystem.checkAccess
  1.1%     0  +     1    java.util.zip.ZipFile.open
  1.1%     0  +     1    sun.awt.windows.WComponentPeer.pShow
  1.1%     0  +     1    java.security.AccessController.getStackAccessControlCon
text
  1.1%     1  +     0    java.lang.SecurityManager.checkRead
  1.1%     1  +     0    java.lang.CharacterDataLatin1.getProperties
  1.1%     1  +     0    java.awt.color.ICC_Profile.<init>
  1.1%     1  +     0    java.net.SocketInputStream.read
  1.1%     1  +     0    java.awt.Color.<clinit>
  1.1%     1  +     0    sun.net.spi.DefaultProxySelector.select
 96.8%     6  +    86    Total interpreted

     Compiled + native   Method
  1.1%     0  +     1    java.util.Arrays.binarySearch0
  1.1%     0  +     1    Total compiled

         Stub + native   Method
  1.1%     0  +     1    java.lang.System.arraycopy
  1.1%     0  +     1    Total stub

  Thread-local ticks:
  2.1%     2             Blocked (of total)
  1.1%     1             Class loader


Flat profile of 2.81 secs (276 total ticks): Thread-3

  Interpreted + native   Method
 96.7%     0  +   267    java.net.SocketInputStream.socketRead0
  0.7%     0  +     2    sun.security.provider.NativeSeedGenerator.nativeGenerat
eSeed
  0.4%     0  +     1    java.lang.ClassLoader.findBootstrapClass
  0.4%     0  +     1    java.net.Inet6AddressImpl.lookupAllHostAddr
  0.4%     1  +     0    java.util.LinkedHashMap.addEntry
  0.4%     1  +     0    java.util.Arrays.copyOfRange
  0.4%     1  +     0    java.util.HashMap.<init>
  0.4%     1  +     0    java.lang.StringCoding$StringEncoder.encode
  0.4%     0  +     1    java.io.WinNTFileSystem.list
100.0%     4  +   272    Total interpreted

MainApplet: init
: start 0
: start 1
: start .1
: start .2
: start .3.

Flat profile of 5.00 secs (494 total ticks): Keep-Alive-Timer

  Thread-local ticks:
100.0%   494             Blocked (of total)

View : static 1
View : static 2
View: 1
View: 2
View: 3
View: 4
: start .4
: start 2
: start 3
: start 4
: start 5
: start 6
: start 7

Flat profile of 5.86 secs (577 total ticks): Thread-4

  Interpreted + native   Method
 66.2%     0  +   382    java.net.SocketInputStream.socketRead0
  2.4%    14  +     0    straightedge.test.demo.Player.makeImage
  1.9%    11  +     0    straightedge.test.demo.Player.makeImage2
  0.3%     0  +     2    java.lang.StrictMath.floor
  0.3%     0  +     2    java.lang.ClassLoader.findBootstrapClass
  0.3%     1  +     1    straightedge.test.demo.WorldLetters.fillMultiPolygonsLi
st
  0.3%     0  +     2    sun.java2d.d3d.D3DRenderQueue.flushBuffer
  0.3%     0  +     2    java.io.FileOutputStream.writeBytes
  0.3%     1  +     1    java.lang.ClassLoader.defineClass1
  0.2%     0  +     1    java.util.zip.Inflater.inflateBytes
  0.2%     1  +     0    java.awt.geom.Path2D.getPathIterator
  0.2%     0  +     1    com.vividsolutions.jts.geom.GeometryFactory.createLinea
rRing
  0.2%     0  +     1    straightedge.geom.PolygonConverter.<init>
  0.2%     1  +     0    sun.misc.URLClassPath$JarLoader$2.<init>
  0.2%     0  +     1    sun.font.FileFont.getGlyphMetrics
  0.2%     0  +     1    com.vividsolutions.jts.operation.buffer.OffsetCurveSetB
uilder.addCurve
  0.2%     0  +     1    straightedge.geom.util.TileArrayIntersections$Tile.<ini
t>
  0.2%     1  +     0    com.vividsolutions.jts.geomgraph.Label.<init>
  0.2%     0  +     1    com.vividsolutions.jts.operation.buffer.OffsetCurveSetB
uilder.addPolygonRing
  0.2%     1  +     0    straightedge.geom.KPoint.ptLineDistSq
  0.2%     1  +     0    com.vividsolutions.jts.geom.Envelope.expandToInclude
  0.2%     1  +     0    straightedge.geom.KPoint.createPointToward
  0.2%     0  +     1    com.vividsolutions.jts.operation.buffer.BufferBuilder.c
reateSubgraphs
  0.2%     0  +     1    straightedge.test.demo.EventHandler.init
  0.2%     0  +     1    straightedge.geom.PolygonConverter.makeKPolygonListFrom

 76.8%    35  +   408    Total interpreted (including elided)

     Compiled + native   Method
 20.8%   120  +     0    straightedge.geom.KPolygon.getClosestIntersectionToFirs
tFromSecond
  1.2%     7  +     0    straightedge.geom.path.NodeConnector.isConnectionPossib
leAndUseful
  0.3%     2  +     0    straightedge.geom.path.NodeConnector.reConnectNodeAfter
Checks
  0.2%     1  +     0    straightedge.geom.KPoint.relCCWDouble
  0.2%     1  +     0    straightedge.test.demo.Player.makeImage
  0.2%     1  +     0    straightedge.test.demo.Player.makeImage2
 22.9%   132  +     0    Total compiled

         Stub + native   Method
  0.3%     0  +     2    java.lang.System.arraycopy
  0.3%     0  +     2    Total stub

MainApplet: stop
MainApplet: destroy

Flat profile of 9.51 secs (931 total ticks): thread applet-straightedge.test.dem
o.AppletImpl.class

  Interpreted + native   Method
100.0%     1  +     0    java.lang.ClassLoader.defineClass1
100.0%     1  +     0    Total interpreted

  Thread-local ticks:
 99.9%   930             Blocked (of total)

ViewPane: getGraphics() == null

Flat profile of 2.73 secs (258 total ticks): Loop

  Interpreted + native   Method
 24.0%     0  +    24    sun.java2d.d3d.D3DRenderQueue.flushBuffer
 19.0%     0  +    19    sun.java2d.loops.TransformHelper.Transform
  3.0%     0  +     3    sun.java2d.loops.FillRect.FillRect
  2.0%     2  +     0    sun.java2d.d3d.D3DScreenUpdateManager.wakeUpUpdateThrea
d
  2.0%     0  +     2    sun.dc.pr.PathFiller.writeAlpha8
  2.0%     0  +     2    sun.font.FileFont.getGlyphImage
  2.0%     0  +     2    java.lang.System.nanoTime
  1.0%     1  +     0    java.awt.BasicStroke.getLineWidth
  1.0%     0  +     1    java.lang.Object.clone
  1.0%     0  +     1    sun.java2d.pipe.ShapeSpanIterator.dispose
  1.0%     1  +     0    straightedge.geom.util.Tracker.getCountID
  1.0%     0  +     1    sun.awt.windows.WToolkit.nativeSync
  1.0%     0  +     1    sun.java2d.loops.MaskFill.MaskFill
  1.0%     0  +     1    sun.java2d.loops.MaskBlit.MaskBlit
  1.0%     0  +     1    sun.dc.pr.PathStroker.closedSubpath
  1.0%     0  +     1    java.lang.Thread.yield
  1.0%     1  +     0    java.awt.Component.getFont_NoClientCode
  1.0%     1  +     0    sun.java2d.pipe.LoopPipe.getFillSSI
  1.0%     1  +     0    straightedge.geom.KMultiPolygon$KMultiPolygonIterator.<
init>
  1.0%     1  +     0    sun.dc.pr.Rasterizer.<init>
  1.0%     1  +     0    straightedge.test.demo.AcceleratedImage.getAndCheckVola
tileImage
  1.0%     1  +     0    sun.font.GlyphList.getGrayBits
  1.0%     0  +     1    sun.misc.Unsafe.compareAndSwapInt
  1.0%     1  +     0    straightedge.geom.KPolygon.perimeterIntersects
  1.0%     1  +     0    sun.java2d.d3d.D3DSurfaceData.validatePipe
 74.0%    14  +    60    Total interpreted (including elided)

     Compiled + native   Method
  3.0%     3  +     0    straightedge.geom.KPolygon.contains
  1.0%     0  +     1    java.lang.Object.<init>
  1.0%     1  +     0    straightedge.geom.KPoint.linesIntersect
  1.0%     1  +     0    straightedge.geom.vision.VisionFinder.calc
  1.0%     1  +     0    straightedge.geom.KPolygon.intersectsLine
  7.0%     6  +     1    Total compiled

         Stub + native   Method
  7.0%     0  +     7    sun.dc.pr.PathFiller.writeAlpha8
  5.0%     0  +     5    sun.java2d.loops.MaskFill.MaskFill
  3.0%     0  +     3    sun.java2d.pipe.ShapeSpanIterator.nextSpan
  3.0%     0  +     3    java.lang.System.arraycopy
  1.0%     0  +     1    java.lang.StrictMath.atan2
 19.0%     0  +    19    Total stub

  Thread-local ticks:
 61.2%   158             Blocked (of total)


Flat profile of 9.87 secs (966 total ticks): AWT-Windows

  Interpreted + native   Method
 97.2%     0  +   939    sun.awt.windows.WToolkit.eventLoop
  2.4%     0  +    23    sun.java2d.d3d.D3DGraphicsDevice.getDeviceCapsNative
  0.2%     0  +     2    sun.java2d.d3d.D3DSurfaceData.initFlipBackbuffer
  0.1%     1  +     0    java.awt.KeyboardFocusManager.getGlobalFocusOwner
  0.1%     0  +     1    sun.awt.windows.WToolkit.init
100.0%     1  +   965    Total interpreted


Flat profile of 9.43 secs (927 total ticks): D3D Screen Updater

  Interpreted + native   Method
100.0%     0  +    10    sun.java2d.d3d.D3DRenderQueue.flushBuffer
100.0%     0  +    10    Total interpreted

  Thread-local ticks:
 98.9%   917             Blocked (of total)


Flat profile of 0.10 secs (9 total ticks): Thread-1

  Interpreted + native   Method
100.0%     0  +     9    sun.awt.windows.WToolkit.shutdown
100.0%     0  +     9    Total interpreted


Flat profile of 0.14 secs (14 total ticks): Thread-6

  Thread-local ticks:
 92.9%    13             Blocked (of total)
100.0%     1             Unknown: no last frame


Flat profile of 2.88 secs (273 total ticks): Keep-Alive-Timer

  Thread-local ticks:
100.0%   273             Blocked (of total)


Flat profile of 6.78 secs (663 total ticks): AWT-EventQueue-1

  Interpreted + native   Method
 33.3%     0  +     1    sun.java2d.d3d.D3DRenderQueue.flushBuffer
 33.3%     0  +     1    sun.awt.windows.WComponentPeer._requestFocus
 33.3%     0  +     1    sun.awt.windows.WComponentPeer.hide
100.0%     0  +     3    Total interpreted

  Thread-local ticks:
 99.5%   660             Blocked (of total)


Flat profile of 6.81 secs (665 total ticks): TimerQueue

  Thread-local ticks:
100.0%   665             Blocked (of total)


Flat profile of 9.55 secs (938 total ticks): DestroyJavaVM

  Thread-local ticks:
100.0%   938             Blocked (of total)


Flat profile of 9.63 secs (943 total ticks): AWT-EventQueue-0

  Interpreted + native   Method
 25.0%     0  +     2    sun.awt.windows.WGlobalCursorManager.setCursor
 12.5%     1  +     0    java.awt.Component.contains
 12.5%     0  +     1    sun.awt.windows.WGlobalCursorManager.getCursorPos
 12.5%     0  +     1    sun.java2d.d3d.D3DRenderQueue.flushBuffer
 12.5%     1  +     0    sun.awt.PostEventQueue.flush
 12.5%     1  +     0    java.awt.EventQueue.dispatchEvent
 12.5%     0  +     1    java.lang.Object.notifyAll
100.0%     3  +     5    Total interpreted

  Thread-local ticks:
 99.2%   935             Blocked (of total)


Flat profile of 9.92 secs (971 total ticks): AWT-Shutdown

  Thread-local ticks:
100.0%   971             Blocked (of total)


Flat profile of 9.96 secs (975 total ticks): Java2D Disposer

  Thread-local ticks:
100.0%   975             Blocked (of total)


Global summary of 10.58 seconds:
100.0%  1041             Received ticks
  0.3%     3             Received GC ticks
  1.0%    10             Compilation
  0.1%     1             Other VM operations
  0.1%     1             Class loader
  0.1%     1             Unknown code


Thanks for any pointers  Smiley
keith

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #1 - Posted 2011-02-03 10:48:22 »

try putting a <param name="codebase_lookup" value="false"> in the applet tag.
Offline CommanderKeith
« Reply #2 - Posted 2011-02-03 13:28:10 »

Thanks! that sounds like exactly the reason why it's going wrong. You must have wrestled with all this stuff before when making that nifty lwjgl applet installer.

For anyone interested here's the 'special parameter' guide: http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/special_attributes.html

I can't check if it works yet because even though I added the applet parameter to the html file the stupid browser keeps showing the old version for some reason, even after I cleared the browser cache... grrh! wish I knew how to force it to update...  Huh

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #3 - Posted 2011-02-03 15:02:25 »

I can't check if it works yet because even though I added the applet parameter to the html file the stupid browser keeps showing the old version for some reason, even after I cleared the browser cache... grrh! wish I knew how to force it to update...  Huh
You'll have to go to the java control panel and clear the cache from there (also restart browser).

You must have wrestled with all this stuff before when making that nifty lwjgl applet installer.
The LWJGL AppletLoader took a ton of ppl to do an amazing amount of wrestling, time and hacking at the internals of the java plugin to get just right, but yeh its turned out pretty cool (its basically a mini-plugin now on top the java one). It'll be even better in the upcoming LWJGL 2.7 release Smiley.
Offline CommanderKeith
« Reply #4 - Posted 2011-02-03 15:13:40 »

You'll have to go to the java control panel and clear the cache from there (also restart browser).

Still doesn't work, even when I go to a different computer it shows the same old page, I can tell since 'view source' shows the old applet tag parameters... but all the computers here use the same university internet connection so maybe that's the problem. It seems to update after a day or two so I'll wait.

The lwjgl applet plugin is awesome. I've been looking at the options you guys implemented for it to try and figure out how to get rid of the crappy java default settings for applets. It's unbelievable how hard applets are to deploy and customise. kudos to all of you for making it work. And also for keeping it fully customisable without forcing lwjgl logos down everyone's throats, unlike the way java logos tend to spattered everywhere without a choice.

Offline Mike

JGO Ninja


Medals: 71
Projects: 1
Exp: 5 years


Java guru wanabee


« Reply #5 - Posted 2011-02-03 16:35:19 »

The uni proxy probably cached it, if it's a php page you can add some no cache and always revalidate headers to it.

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #6 - Posted 2011-02-03 23:40:19 »

I have had a similar problem. I found out that the applet loaded fine from one place, <10sec the first time and then ~3sec thereafter. When I deployed it where it needed to be, it took >30sec always! It looked like it was trying to fetch stuff from the server all the time, that existed in a jar that I think already was downloaded. The "codebase_lookup" helped a bit but not much. After spending way too much time on this problem I finally found the solution for my problem and it was called jar indexing.

See http://wiki.games4j.com/wiki/en/Applet (Slow loading applets)

Not sure if your problem will be fixed with this, but it is easy enough to test. It also seems like this can be used to lazy load stuff! Does anyone have experience with this?

Offline CommanderKeith
« Reply #7 - Posted 2011-02-04 02:33:10 »

Ah now that sounds like my problem exactly! I'll give it a shot and report back.

Cheers for all the pointers guys  Cool

Offline DzzD
« Reply #8 - Posted 2011-02-04 11:01:00 »

nice informations,

jar indexing aswell as the lookup code base flag should maybe put in the wiki or in the best practice of deploying Applet (I remember seeing this one somewhere in JGO but cant remember where ?)

ps : this flag is also nice to avoid flickering of Applet
1  
<PARAM name="java_arguments" value="-Dsun.awt.noerasebackground=true">

Offline ddyer

Senior Member


Medals: 5



« Reply #9 - Posted 2011-02-04 19:04:54 »

crank up the debug level in your java console, you'll see the sequence and timing of downloads.

segment your applet into an "immediate" part and a "later" part, and load the "later" part
in a separate thread while the "immediate" part keeps the user entertained.  It's a little
tricky because you have to make sure the "later" part is only referred to through interfaces,
so it's not required to be loaded until actually instantiate it.   At boardspace.net, the
lobby is "immdiate" and each game is "later".  A game doesn't start loading until you
begin the process of launching it.

be sure to index and manifest your .jar files, and be warned that the mechanism is fragile - it's
easy to screw up your manifest which forces java to fall back to loading the classes one at
a time.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DzzD
« Reply #10 - Posted 2011-02-04 19:13:54 »

...segment your applet into an "immediate" part and a "later" part, and load the "later" part
in a separate thread while the "immediate" part keeps the user entertained.  It's a little
tricky because you have to make sure the "later" part is only referred to through interfaces...
+1

you can also completly load an Applet B using an Applet A as this Applet Booter do

the second Applet (and its jars) are loaded & started  after the first Applet have started

Offline CommanderKeith
« Reply #11 - Posted 2011-02-05 12:14:42 »

Thanks ddyer for the debug tip - I turned the debug level up to 5 in the java console and saw exactly what the problem was  Cool

Turns out there were 2 problems, one my fault and the other is a weird applet quirk.

First problem was that the applet was looking for the jts-1.11.jar in the "/lib" directory, but I put the jts-1.11.jar in the same directory as the straightedge.jar. For some reason this works fine with webstart, but not very well for applets. I think the applet looked for the jts-1.11.jar in the lib sub-dir since the straightedge.jar file's manifest had a line in it that must have been added by NetBeans IDE saying "Class-Path: lib/jts-1.11.jar". When it couldn't find it there it then downloaded the jts-1.11.jar from where I put it in the same directory as the straightedge.jar, as given in the archive tag (archive="straightedge.jar, jts-1.11.jar").

So I made a new "lib" directory and put the jts-1.11.jar in there. But this didn't solve the stalling problem! Now there was less error output in the java console debug output, and it still stalled at the same place to download the jts-1.11.jar. The applet seemed to just download the straightedge.jar file, found that it had the Applet launch class (code="straightedge.test.demo.AppletImpl.class"), then closed the java loading logo and fired up the program, but then it found out it needed the jts-1.11.jar so it would try to download it while stalling my program. For some reason the jars I listed in the archive tag straightedge.jar and jts-1.11.jar weren't both being downloaded at the beginning, only the first one was.

So then I switched the order of the jars as they're listed in the archive tag. Instead of archive="straightedge.jar, lib/jts-1.11.jar" I changed it to archive="lib/jts-1.11.jar, straightedge.jar". Now it seems to work fine with no stall. Yay!

From now on I'll make sure:
1. I put the lib jars in the lib sub-directory
2. I list the archive jars so that the jar which contains the Applet class comes last

Point 2 seems pretty dumb to me, it's strange that the applet doesn't download all archives straight away  Huh I didn't mark any of them to be lazily downloaded and the default behaviour is meant to be that they're eagerly downloaded.

For anyone interested here's my applet console debug output, after making change 1, but before and after change 2:

Output with the straightedge jar coming first in the archive tag, which stalls to download the jts.jar during program operation:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
Java Plug-in 1.6.0_23
Using JRE version 1.6.0_23-b05 Java HotSpot(TM) Client VM
User home directory = C:\Users\Keith

----------------------------------------------------
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>
----------------------------------------------------

Trace level set to 5: all ... completed.
network: Downloading resource: http://www.keithwoodward.com/straightedge/lib/jts-1.11.jar
  Content-Length: 679,870
   Content-Encoding: null
network: CleanupThread used 50300 us
network: Wrote URL http://www.keithwoodward.com/straightedge/lib/jts-1.11.jar to File C:\Users\Keith\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\17\17773951-2f9cdf1e-temp
security: Blacklist revocation check is enabled
security: Trusted libraries list check is enabled
network: CleanupThread used 5 us
network: Cache entry not found [url: http://www.keithwoodward.com/straightedge/straightedge.jar, version: null]
network: Connecting http://www.keithwoodward.com/straightedge/straightedge.jar with proxy=DIRECT
network: Connecting http://www.keithwoodward.com:80/ with proxy=DIRECT
network: Connecting http://www.keithwoodward.com/straightedge/straightedge.jar with cookie "__utmz=174074680.1296901017.8.6.utmcsr=java-gaming.org|utmccn=(referral)|utmcmd=referral|utmcct=/topics/applet-trouble-long-pause-due-to-download/23716/view.html; __utma=174074680.1956695795.1296735508.1296901017.1296903287.9; __utmc=174074680; __utmb=174074680.1.10.1296903287"
network: CleanupThread used 6 us
network: Downloading resource: http://www.keithwoodward.com/straightedge/straightedge.jar
  Content-Length: 397,264
   Content-Encoding: null
network: Wrote URL http://www.keithwoodward.com/straightedge/straightedge.jar to File C:\Users\Keith\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\18\8457612-49e4fb92-temp
network: CleanupThread used 4 us
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 294940 us, pluginInit dt 31121656 us, TotalTime: 31416596 us
MainApplet: init
basic: Applet initialized
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1198891
basic: Applet made visible
basic: Starting applet
basic: completed perf rollup
basic: Applet started
basic: Told clients applet is started
: start 0
: start 1
: start .1
: start .2
: start .3.
View : static 1
View : static 2
View: 1
View: 2
View: 3
View: 4
: start .4
: start 2
: start 3
: start 4
: start 5
: start 6
: start 7


Output with the straightedge jar coming last in the archive tag, which runs fine:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
Java Plug-in 1.6.0_23
Using JRE version 1.6.0_23-b05 Java HotSpot(TM) Client VM
User home directory = C:\Users\Keith

----------------------------------------------------
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>
----------------------------------------------------

Trace level set to 5: all ... completed.
network: Downloading resource: http://www.keithwoodward.com/straightedge/straightedge.jar
  Content-Length: 397,264
   Content-Encoding: null
network: CleanupThread used 66578 us
network: Wrote URL http://www.keithwoodward.com/straightedge/straightedge.jar to File C:\Users\Keith\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\18\8457612-4c19ed12-temp
security: Blacklist revocation check is enabled
security: Trusted libraries list check is enabled
network: CleanupThread used 6 us
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 245445 us, pluginInit dt 13860914 us, TotalTime: 14106359 us
MainApplet: init
basic: Applet initialized
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@cfec48
basic: Applet made visible
basic: Starting applet
basic: completed perf rollup
basic: Applet started
basic: Told clients applet is started
: start 0
: start 1
: start .1
: start .2
: start .3.
network: Cache entry not found [url: http://www.keithwoodward.com/straightedge/lib/jts-1.11.jar, version: null]
network: Connecting http://www.keithwoodward.com/straightedge/lib/jts-1.11.jar with proxy=DIRECT
network: Connecting http://www.keithwoodward.com:80/ with proxy=DIRECT
network: Connecting http://www.keithwoodward.com/straightedge/lib/jts-1.11.jar with cookie "__utmz=174074680.1296901017.8.6.utmcsr=java-gaming.org|utmccn=(referral)|utmcmd=referral|utmcct=/topics/applet-trouble-long-pause-due-to-download/23716/view.html; __utma=174074680.1956695795.1296735508.1296901017.1296903287.9; __utmc=174074680; __utmb=174074680.2.10.1296903287"
network: CleanupThread used 7 us
network: Downloading resource: http://www.keithwoodward.com/straightedge/lib/jts-1.11.jar
  Content-Length: 679,870
   Content-Encoding: null
network: Wrote URL http://www.keithwoodward.com/straightedge/lib/jts-1.11.jar to File C:\Users\Keith\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\17\17773951-6b010e65-temp
network: CleanupThread used 5 us
View : static 1
View : static 2
View: 1
View: 2
View: 3
View: 4
: start .4
: start 2
: start 3
: start 4
: start 5
: start 6
: start 7




Offline CommanderKeith
« Reply #12 - Posted 2011-02-05 12:21:34 »

By the way thanks everyone for your help, much appreciated  Cool  Saved me so much hassle and time  Smiley

If I see any more performance trouble I'll add jar-indexing and try those additional applet parameters, but right now it seems to work fine, well at least on this computer. Here's my html applet tag for anyone interested:

1  
2  
3  
4  
5  
6  
<applet code="straightedge.test.demo.AppletImpl.class"
        archive="lib/jts-1.11.jar, straightedge.jar"
        width="500" height="500"
        align="center"
        alt="StraightEdge demo applet">
</applet>

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (24 views)
2014-07-24 01:59:36

Riven (22 views)
2014-07-23 21:16:32

Riven (18 views)
2014-07-23 21:07:15

Riven (21 views)
2014-07-23 20:56:16

ctomni231 (50 views)
2014-07-18 06:55:21

Zero Volt (45 views)
2014-07-17 23:47:54

danieldean (36 views)
2014-07-17 23:41:23

MustardPeter (39 views)
2014-07-16 23:30:00

Cero (54 views)
2014-07-16 00:42:17

Riven (54 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!