- Timestamp:
- 02/09/09 10:32:59 (13 years ago)
- Location:
- chess
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
chess/build.xml
r22 r32 68 68 <include name = "lib/midpapi21.jar" /> 69 69 <include name = "lib/cldcapi11.jar" /> 70 <include name = "../TEMP/j2me/libs/bluecove-2.1.0.jar" /> 70 </fileset> 71 <fileset dir = "${basedir}"> 72 <include name = "libs/bluecove-2.1.0.jar" /> 71 73 </fileset> 72 74 </path> … … 155 157 fork = "true" 156 158 target = "1.3" 159 source = "1.3" 157 160 executable = "${module.jdk.bin.chess}/javac"> 158 161 <compilerarg line = "${compiler.args.chess}" /> … … 215 218 <target name = "preverify" 216 219 description = "Preverify module 'chess'"> 217 <exec executable = "${jdk.home.SJWTK_2.5.2_01}/bin/preverify"> 220 <exec executable = "${jdk.home.SJWTK_2.5.2_01}/bin/preverify" 221 failonerror = "true"> 218 222 <arg line = "-d ${tmp.dir.chess}" /> 219 223 <arg line = "-classpath ${jdk.home.SJWTK_2.5.2_01}/lib/midpapi21.jar;${jdk.home.SJWTK_2.5.2_01}/lib/cldcapi11.jar;${basedir}/libs/bluecove-2.1.0.jar" /> -
chess/chess.jad
r29 r32 1 1 MIDlet-1: Chess Game, , chess.ui.ChessMIDlet 2 MIDlet-Jar-Size: 857002 MIDlet-Jar-Size: 311740 3 3 MIDlet-Jar-URL: chess.jar 4 4 MIDlet-Name: Chess -
chess/src/chess/control/BaseController.java
r29 r32 6 6 import javax.microedition.lcdui.Command; 7 7 import javax.microedition.lcdui.Displayable; 8 import javax.microedition.lcdui.AlertType; 8 9 9 10 import chess.game.*; … … 159 160 160 161 public void closed() { 162 final Throwable e = node.getError(); 163 if ( e != null ) { 164 final Alert alert = new Alert( "Error", e.getMessage(), null, AlertType.ERROR ); 165 app.getMidlet().display.setCurrent( alert ); 166 } 161 167 setStatus( WAITING_CONNECT ); 162 168 } … … 316 322 if ( status == WAITING_CONNECT ) { 317 323 //fixme: òóò ïîäñòàâà -- ïîõîæå, deadlock 318 node.close( );324 node.close( true ); 319 325 midlet.searchGame(); 320 326 } … … 328 334 } else if ( c == ui.surrenderCommand ) { 329 335 postSurrender(); 330 node.close( );336 node.close( true ); 331 337 midlet.showStartScreen(); 332 338 } else if ( c == ui.askForDrawCommand ) { -
chess/src/chess/remote/IRemoteNode.java
r19 r32 17 17 public void send( final IDatagram data ); 18 18 19 public void close(); 19 public void close( final boolean safe ); 20 21 public Throwable getError(); 20 22 } -
chess/src/chess/remote/impl/BTNode.java
r31 r32 33 33 private StreamConnection connection = null; 34 34 35 private volatile boolean quitPump = false; 36 35 37 private transient InputStream in; 36 38 private transient OutputStream out; 37 39 private transient Thread pump; 40 41 private Throwable lastError = null; 38 42 39 43 /** … … 128 132 queueOverloadedLock.wait( 250 ); 129 133 } catch ( InterruptedException e ) { 130 e.printStackTrace();134 //e.printStackTrace(); 131 135 } 132 136 } … … 145 149 listener.connected(); 146 150 } 147 // synchronized( connectLock ) {148 // connectLock.notifyAll();149 // }150 151 final GenericDatagram data = new GenericDatagram(); 151 while ( !isClosed() ) {152 while ( !isClosed() && !quitPump ) { 152 153 synchronized ( this ) { 153 154 final int timeout; … … 188 189 } catch ( Throwable e ) { 189 190 e.printStackTrace(); 191 lastError = e; 190 192 } finally { 191 193 pump = null; 192 close ();193 } 194 } 195 196 public void close( ) {194 closeImpl(); 195 } 196 } 197 198 public void close( final boolean safe ) { 197 199 if ( isClosed() ) { 198 200 return; 199 201 } 202 if ( safe ) { 203 askPumpToQuit(); 204 } else { 205 closeImpl(); 206 } 207 } 208 209 public Throwable getError() { 210 return null; 211 } 212 213 private void closeImpl() { 200 214 try { 201 215 if ( in != null ) { … … 259 273 } catch ( IOException ex ) { 260 274 ex.printStackTrace(); 261 throw new RuntimeException( "Can't open input stream:" + ex.getMessage() ); 275 throw ex; 276 //throw new IOException( "Can't open input stream:" + ex.getMessage() ); 262 277 } 263 278 } … … 267 282 } catch ( IOException ex ) { 268 283 ex.printStackTrace(); 269 throw new RuntimeException( "Can't open output stream:" + ex.getMessage() ); 284 throw ex; 285 //throw new IOException( "Can't open output stream:" + ex.getMessage() ); 270 286 } 271 287 } … … 301 317 } 302 318 319 private void askPumpToQuit() { 320 synchronized ( this ) { 321 quitPump = true; 322 notifyAll(); 323 } 324 //device = null; 325 } 326 303 327 private boolean isStartCalled() { 304 328 return pump != null; -
chess/src/chess/remote/impl/BTRemote.java
r29 r32 132 132 return; 133 133 } 134 client.close( );134 client.close( true ); 135 135 } 136 136 } catch( InterruptedIOException ex ) { -
chess/src/chess/remote/impl/debug/DebugRemote.java
r29 r32 203 203 } 204 204 205 public void close( ) {205 public void close( final boolean safe ) { 206 206 listener.closed(); 207 207 } 208 } 208 209 public Throwable getError() { 210 return null; 211 } 212 } 209 213 210 214 private class ServerRemoteNode implements IRemoteNode { … … 316 320 } 317 321 318 public void close( ) {322 public void close( final boolean safe ) { 319 323 listener.closed(); 320 324 } 321 } 325 326 public Throwable getError() { 327 return null; 328 } 329 } 322 330 323 331 private static class QueryDeviceProcess extends TimerTask implements IAsyncProcess {
Note: See TracChangeset
for help on using the changeset viewer.