Please enable JavaScript.
Coggle requires JavaScript to display documents.
Java Specialist Part 1 (005 Dynamic Proxies (DYNAMIC PROXY PATTERN (logic…
Java Specialist Part 1
001 Deadlocks
CTL+BREAK
command promt app
stack trace
each thread
work
is waiting?
problem
SWING
GUI components
change
inside Swing thread only!
buttonPress
jLabel1.setText("BlaBla")
SOLUTION
SwingUtilities.invokeLater(new Runnable(){})
#
SwingUtilities.invokeAndWait()
race conditions
1 more item...
ADVANCED
check if thread is swingThread
1 more item...
002 Annonymous Inner Classes
application
new Thread
new way
implement Runnable.run()
old way
constructor with Runnable()
implement Runnable.run()
initializing collections and array
new vector(3){add("Heinz"), add("Stephan")}
def
implementing super class
exmp
pre-populate vector
Logging
003 Part 1
Questions before impl
How to show when the event?
What if log file gets to big?
How to switch off logging?
Willing to mess up client code?
Study case
TeeOutputStream
setting different Out.Streams
loging on console and file
004 Part 2
invocation of method
WHERE
005 Dynamic Proxies
JAVA PATTERN
structural pattern
Represent object functionality
in another class
PROXY PATTERN
purpose
Pre-processing
Post processing
overriding functionality
cashing
security
DYNAMIC PROXY PATTERN
uses reflection
logic split
invocation logic
calling the framework
before/after delagation of application target
interception logic
simulating arbitrary interface
008 Boolean Comparison
if requires boolen
c++ value vas OK
0 false
non zero true
mistakes
assingments vs. comparison
java compiler errors
can't prevent boolean asingment
solution
c++ style
true == var
java
if(var)
boolean array
1 Byte per boolen
boolean field
4 Bytes