SlideShare ist ein Scribd-Unternehmen logo
1 von 73
Downloaden Sie, um offline zu lesen
(+) 55 fonctionnalités de Java 7 dont
  vous n'avez (probablement) pas
       encore entendu parler
             par David Delabassée
                 @delabassee




                                        1
About me...

•    David Delabassée

    - ... Sun, Oracle

    - Devoxx (Belgium) Steering

•    @delabassee




                                       2
The preceding is intended to outline our general product direction.
It is intended for information purposes only, and may not be
incorporated into any contract. It is not a commitment to deliver
any material, code, or functionality, and should not be relied upon in
making purchasing decisions.
The development, release, and timing of any features or functionality
described for Oracle’s products remains at the sole discretion of
Oracle.



                                                                         3
Java 7
•   InvokeDynamic

•   Fork/Join

•   NIO.2

•   Project Coin

•   ...



                             4
Project Coin



               5
Binary Literals
 1: int mask = 0b101010101010;
 2: aShort = (short)0b1010000101000101;
 3: long aLong = 0b1010000101000101101000010100010110100001010001011010000101000101L;

 1: HAPPY_FACE = {
 2:    (short)0b0000011111100000;
 3:    (short)0b0000100000010000;
 4:    (short)0b0001000000001000;
 5:    (short)0b0010000000000100;
 6:    (short)0b0100000000000010;
 7:    (short)0b1000011001100001;
 8:    (short)0b1000011001100001;
 9:    (short)0b1000000000000001;
10:    (short)0b1000000000000001;
11:    (short)0b1001000000001001;
12:    (short)0b1000100000010001;
13:    (short)0b0100011111100010;
14:    (short)0b0010000000000100;
15:    (short)0b0001000000001000;
16:    (short)0b0000100000010000;
17:    (short)0b0000011111100000; }
                                                                                        6
Underscores in Numeric Literals
• Valid
    int mask = 0b1010_1010_1010;
    long big = 9_223_783_036_967_937L;
    long creditCardNumber = 1234_5678_9012_3456L;
    long socialSecurityNumber = 999_99_9999L;
    float pi = ! 3.14_15F;
    long hexBytes = 0xFF_EC_DE_5E;
    long hexWords = 0xCAFE_BFFE;

• Invalid
    float pi1 = 3_.1415F;          float pi2 = 3._1415F;
    long ssn = 999_99_9999_L;
    int x1 = _52;                  int x1 = 52_;
    int x2 = 0_x52;                int x2 = 0x_52;


                                                           7
Strings in Switch
 1: int NbrDay(String s, int year) {
 2:   switch(s) {
 3:     case "April": case "June":
 4:     case "September": case "November":
 5:       return 30;
 6:
 7:     case "January": case "March": case "May":
 8:     case "July": case "August": case "December":
 9:       return 31;
10:
11:     case "February”:
12:       ...
13:     default:
14:       ...
15: }



                                                       8
Automatic Resource Management
1: try (InputStream in = new FileInputStream(src);
2:      OutputStream out = new FileOutputStream(dest))
3: {
4:   byte[] buf = new byte[8192];
5:   int n;
6:   while (n = in.read(buf)) >= 0)
7:     out.write(buf, 0, n);
8: }



• New java.lang.AutoCloseable interface
• Anything with a void close() method is a candidate


                                                         9
10
Suppressed Exceptions
New Throwable.getSupressed() method
1: java.io.IOException
2:      at Suppress.write(Suppress.java:19)
3:      at Suppress.main(Suppress.java:8)
4:      Suppressed:  java.io.IOException
5:          at Suppress.close(Suppress.java:24)
6:          at Suppress.main(Suppress.java:9)
7:      Suppressed:  java.io.IOException
8:          at  Suppress.close(Suppress.java:24)
9:          at  Suppress.main(Suppress.java:9)




                                                   11
Multi Catch
1:   //...
2:   catch (IOException ex) {
3:         logger.log(ex);
4:         throw ex;
5:   } catch (SQLException ex) {
6:         logger.log(ex);
7:         throw ex;
8:   }


1: //...
2: catch (IOException|SQLException ex) {
3:     logger.log(ex);
4:     throw ex;
5: }

                                           12
Multi Catch
 1:   try {
 2:   !...
 3:   } catch (SpecificException ex) {
 4:     // Do something very specific!
 5:     throw ex;
 6:   } catch (AnException | MyException | ZeException ex) {
 9:   ! // Do something more generic...
10:   ! throw ex;
11:   }




                                                               13
More Precise Rethrow
 1:   // pre Java 7 "imprecise rethrow"
 2:   // must use "throws Exception"
 3:   public static void imprecise() throws Exception {
 4:      try {
 5:   !    ! // Code that may throw either
 6:   !!     // FirstException or SecondException
 7:   ! } catch (Exception e) {
 8:             throw e;
 9:      }
10:   }




                                                          14
More Precise Rethrow
 1:   // Java 7 precise rethrow.
 2:   // No longer "throws Exception"
 3:   public static void precise() throws FirstException, SecondException {
 4:       try {
 5:   !!    // Code that may throw either
 6:   !!    // FirstException or SecondException
 7:       } catch (Exception e) {
 8:           throw e;
 9:       }
10:   }




                                                                              15
Diamond <>
Map<Ville,List<Client>> map = new HashMap<Ville,List<Client>>();
Map<Ville,List<Client>> map = new HashMap<>();

Map<Dep,Map<Ville,List<Client>>> map = new
     HashMap<Dep,Map<Ville,List<Client>>>();
Map<Dep,Map<Ville,List<Client>>> map = new HashMap<>();

Map<Pays,Map<Dep,Map<Ville,List<Client>>>> map = new
     HashMap<Pays,Map<Dep,Map<Ville,List<Client>>>>();
Map<Pays,Map<Dep,Map<Ville,List<Client>>>> map = new HashMap<>();




                                                                    16
NIO.2
 IO



        17
File Navigation Helpers
Key navigation Helper Types:
 • Class java.nio.file.Files
  - Static methods to operate on files, directories and other types of files
 • Class java.nio.file.Paths
  - Static methods to return a Path by converting a string or URI
 • Interface java.nio.file.Path
  - Used for objects that represent the location of a file in a file system

Typical use case:
 •   Use Paths to get a Path
 •   Use Files to do stuff


                                                                             18
File Navigation Helpers
 1:   Path   p1   =   Paths.get("/tmp/foo");
 2:   Path   p2   =   Paths.get(URI.create("file:///Users/joe/FileTest.java"));
 3:   Path   p3   =   Paths.get(System.getProperty("user.home"),"logs", "foo.log");
 4:   Path   p4   =   Paths.get("/home/joe/foo");
 5:   Path   p5   =   ("c:datatest.dta");
 6:   Path   p6   =   Paths.get("Test.java").toAbsolutePath();
 7:
 8:   Path   fileName = listing.geFileName();
 9:   Path   parent = p2.getParent();
10:   Path   root = p2.getRoot();
11:   Path   subRep = p2.subPath(0,2);
12:
11:   File file = aPathPath.toFile(); // ‘legacy’ java.io.File



                                                                                      19
Files
java.nio.file.Files class
 • Static methods to operate on files, directories and other types of files
  - Read/Write, Copy, & Delete
  - Create Files, Directories & Links
  - Use of system “temp” directory
  - Attributes – Modified/Owner/Permissions/Size
  - Determining the file content type
  - Determining the file type (ex. isExecutable, isSymLink)
  - etc.
   1: Files.move(src, dst, StandardCopyOption.ATOMIC_MOVE);
   2: Files.copy(src, dst,
   3: !! StandardCopyOption.COPY_ATTRIBUTES,
   4: !! StandardCopyOption.REPLACE_EXISTING);
   5: String type = Files.probeContentType(path);
                                                                            20
Files Helper Class
DirectoryStream iterate over entries
  • Scales to large directories
  • Uses less resources
  • Smooth out response time for remote file systems
  • Implements Iterable and Closeable for productivity
Filtering support
  • Build-in support for glob, regex and custom filters Class

1:   Path srcPath = Paths.get(“/home/regis/src”);
2:
3:   try (DirectoryStream<Path> dir =
4:   ! ! srcPath.newDirectoryStream(“*.java”)) {
5:   ! for (Path file : dir)
6:   ! ! System.out.println(file.getName());
7:   }
                                                               21
Symbolic Links
Path and Files are “link aware”

 1:   Path newLink = Paths.get(...);
 2:   Path existingFile = Paths.get(...);
 3:   try {
 4:       Files.createLink(newLink, existingFile);
 5:   } catch (IOException x) {
 6:       System.err.println(x);
 7:   } catch (UnsupportedOperationException x) {
 8:       ! //Some file systems or some configurations
 9:   !! ! //may not support links
10:       System.err.println(x);
11:   }




                                                         22
Walking A File Tree
• FileVisitor interface makes walking a file tree for search, or performing
  actions, trivial.
• SimpleFileVisitor implements
     preVisitDirectory(T dir, BasicFileAttributes attrs);
     visitFile(T dir, BasicFileAttributes attrs);
     visitFileFailed(T dir, IOException exc);
     postVisitDirectory(T dir, IOException exc);




                                                                             23
Walking A File Tree
public static class PrintFiles extends SimpleFileVisitor<Path> {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attr) {
    if (attr.attr.isRegularFile()) {
         System.out.format("Regular file: %s ", file);
    } else if {
         System.out.format("Not a regular file: %s ", file);
    }
    return CONTINUE;
}
}

Path startingDir = ...;
PrintFiles pf = new PrintFiles();
Files.walkFileTree(startingDir, pf);
                                                                          24
Watching a Directory
• Create a WatchService “watcher” for the filesystem
• Register a directory with the watcher
• “Watcher” can be polled or waited on for events
 - Events raised in the form of Keys
 - Retrieve the Key from the Watcher
 - Key has filename and events within it for create/delete/modify
• Ability to detect event overflows




                                                                   25
Custom FileSystems
• FileSystems class is factory to FileSystem (interface)
• Java 7 allows for developing custom FileSystems:
 - Memory based based file systems
 - Fault tolerant distributed file systems
 - Replacing or supplementing the default file system provider
 - etc.
• Two steps:
 - Implement java.nio.file.spi.FileSystemProvider 
  - URI, Caching, File Handling, etc.
 - Implement java.nio.file.FileSystem
  - Roots, RW access, file store, etc.
                                                                26
zip FileSystem Provider
 Fully-functional and supported NIO.2 filesystem provider for zip and jar files

 1:   Map<String, String> env = new HashMap<>();
 2:   !env.put("create", "true");
 3:   !// locate file system by using the syntax
 4:   !// defined in java.net.JarURLConnection
 5:   !URI u= URI.create("jar:file:/foo/zipfs/zipfstest.zip");
 6:   !try (FileSystem z = FileSystems.newFileSystem(u, env)) {
 7:   !! Path externalFile = Paths.get("/foo/sample.txt");
 8:   !! Path pathInZipfile = z.getPath("/sample.txt");
 9:   !// copy a file into the zip file
10:   !externalTxtFile.copyTo(pathInZipfile);
11:   }
12:   ...


                                                                                27
URLClassLoader.close()
 1:   // create a class loader loading from "foo.jar"
 2:   URL url = new URL("file:foo.jar");
 3:   URLClassLoader loader = new URLClassLoader (new URL[] {url});
 4:   Class cl = Class.forName ("Foo", true, loader);
 5:   Runnable foo = (Runnable) cl.newInstance();
 6:   foo.run();
 7:   loader.close();
 8:
 9:   // foo.jar gets updated somehow
10:   loader = new URLClassLoader (new URL[] {url});
11:   cl = Class.forName ("Foo", true, loader);
12:   foo = (Runnable) cl.newInstance();
13:
14:   // run the new implementation of Foo
15:   foo.run();

                                                                      28
SDP & SCTP
• Infiniband
 - High throughput, low latency streamed connections
 - Remote Direct Memory Access
 - Solaris & Linux




                                                       29
Concurrency
  JSR166y



              30
Divide and Conquer


if (my portion of the work is small enough)
     do the work directly
else
     split my work into two pieces
     invoke the two pieces




                                              31
Fork Join Framework - Pools
ForkJoinPool - Service for running ForkJoinTasks
 • aFjp.execute(aTask); // async
 • aFjp.invoke(aTask); // wait
 • aFjp.submit(aTask); // async + future

 • ForkJoinPool(); // default to platform
 • ForkJoinPool(int n); // # concurrent threads
 • ForJoinPool(n,aThreadFactory,exHandler,FIFOtasks); //
   Create your own thread handler, exception handler, and
   boolean on task ordering (default LIFO)



                                                            32
Fork Join Framework - Tasks
ForkJoinTask - The abstract base class for:
 • RecursiveAction
  - A recursive resultless task
  - Implements compute() abstract method
 • RecursiveTask
  - Similar to RecursiveAction but returns a result
1: ForkJoinPool p = new ForkJoinPool();
2:     MyTask mt = new MyTask(n); // implements compute
3:     p.submit(mt);
4: while (!mt.isDone()) {/*THUMPER!*/ }
5: System.out.println(mt.get());



                                                          33
Fork Join Framework - Compute()
• RecursiveAction - ex. increment an entire array
  1: protected void compute() {
  2:     if (hi - lo < THRESHOLD) {
  3:        for (int i = lo; i < hi; ++i) array[i]++; }
  4:     else {
  5:        int mid = (lo + hi) >>> 1;
  6:        invokeAll(new IncrementTask(array, lo, mid),
  7:                  new IncrementTask(array, mid, hi));}
• RecursiveTask - ex. Fibonacci numbers
  1: protected Integer compute() {
  2:      if (n <= 1) return n;
  3:      Fibonacci f1 = new Fibonacci(n - 1);
  4:      Fibonacci f2 = new Fibonacci(n - 2);
  5:      f1.fork(); f2.fork();
  6:      return f2.join() + f1.join();}
                                                             34
TransferQueue
• TransferQueue interface
• Extension to BlockingQueue
• Implemented by LinkedTransferQueue
• Additional Benefits:
 - Adds methods:
    transfer(E e), tryTransfer(E e),
    tryTransfer(E e, long timeout),
    hasWaitingConsumer(), getWaitingConsumerCount()
 - Allows for smarter queues to be built – sidestep the data structure if it’s
    known there are consumers waiting.


                                                                                 35
ConcurrentLinkedDeque
• Unbound concurrent deque based on linked nodes
 - Like a Queue, but allows front and rear removal of elements
• Concurrent insert, remove and access on multiple threads
• Iterators are weakly consistent




                                                                 36
Concurrent Random Numbers
• Existing RNG becomes unwitting source of contention between threads in
    concurrent apps
•   Expected more needs of concurrent RNG with advent of Fork Join Framework


Class java.util.ThreadLocalRandom
    ThreadLocalRandom.current().nextDouble(…)
    ThreadLocalRandom.current().nextInt (…)
    ThreadLocalRandom.current().nextLong(…)



                                                                               37
Phasers
• Barrier similar to CountDownLatch and CyclicBarrier
• Used for many threads to wait at common barrier point
• How is Phaser an improvement?
 - Dynamic add/remove “parties” to be sync’d
 - Better deadlock avoidance
 - Arrival “counting” and phase advance options, etc
 - Termination api’s
 - Tiering (tree structure)
  - Rather than sync 100 threads, sync 2x50 then 2x.


                                                          38
ClassLoader – Deadlock Avoidance
• Acyclic class loader delegation model
 • Custom classLoaders were prone to deadlock
• Java 7 new locking mechanism to avoid deadlock
• Java 7 “parallel capable” classloader




                                                   39
Client



         40
Standardize Nimbus Look and Feel
•   Better than Metal for cross platform look-and-feel
•   Introduced in Java SE 6u10, now part of Swing
•   Not the default L&F
•   Scalable Java 2D impl




                                                         41
JLayer



1:   // wrap your component with JLayer
2:   JLayer<JPanel> layer = new JLayer<JPanel>(panel);
3:   // custom ui provides all extra functionality
4:   layer.setUI(myLayerUI);
5:   // add the layer as usual component
6:   frame.add(layer);




                                                         42
Mixing of AWT and Swing                                   (*)




 (*) As   of 6u12 and 7u1, some caveats for scroll bars


                                                                43
Translucent Windows
     • Private API added in 6u10, made public in Java 7
     • Support (based on platform) for:
      - Uniform Translucency
      - Per Pixel Translucency
      - Per Pixel Transparency
1:   // simple uniform:
2:   aWindow.setOpacity(0.5f);
3:
4: // Per pixel g2d is the g2d of a Jpanel on paintComponent(g)
5: Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B,0), 0.0f,
          6: getHeight(), new Color(R, G, B, 255), true);
7: g2d.setPaint(p);
8: g2d.fillRect(0, 0, getWidth(), getHeight());


                                                                         44
Xrender-based Java 2D
• Improved Graphics Performance, modern X11
• Off by default (backward compatibility)
• Quiet:
 " -Dsun.java2d.xrender=true

• Verbose (log on stdout if successful or not)
 	

   -Dsun.java2d.xrender=true




                                                 45
OpenType/CFF Fonts
• Java Platform must support TrueType fonts, other font technologies is
    implementation dependent
•   Java 7 adds support for “Compact Font Format” - OpenType/CFF




                                                                          46
Better Support for Linux Fonts
• Five logical fonts since Java 1.0:
 - Serif, Sans-serif, Monospaced, Dialog, and DialogInput
 - Must map to physical font on your system
• No consistency in fonts in Linux
• Required editing fontconfig.properties
• Java 7 on Linux (and Solaris 11) uses system “libfontconfig”




                                                                47
HSV/HSL on JColorChooser




                           48
Other Client Stuff
• Shaped windows
• Handling multiple files selection in the FileDialog class
• Mouse
 - java.awt.Toolkit.areExtraMouseButtonsEnabled()
 - java.awt.event.MouseWheelEvent.getPreciseWheelRotation()
• java.awt.PrintJob dialogbox
• ...




                                                              49
Deployment



             50
Embedding JNLP File in Applet Tag
• Saves a network round trip first time applet is loaded
• Base64 Encode the JNLP contents into a Javascript call
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
  var attributes = {} ;
       <!-- Base64 encoded string trunc’d below for readability -->
       var parameters =
          {jnlp_href: 'dynamictree-applet.jnlp',
          jnlp_embedded: 'PCEtLSAKLyoKICogQ29weX ... HA+Cg==' } ;
          deployJava.runApplet(attributes, parameters, '1.7');
</script>




                                                                      51
Ability to detect applet init status on load
 1:   <script>
 2:   function registerAppletStateHandler() {
 3:   !switch (drawApplet.status) {
 4:   !case 1: <!–- applet is loading -->        1:   function onLoadHandler(){
 5:   !! drawApplet.onLoad = onLoadHandler;      2:   ! document.getElementById("mydiv“)
 6:   !case 2: <!–- applet is loaded -->         3:   ! .innerHTML = "Applet loaded";
 7:   !case 3: <!–- error -->                    4:   ! draw();
 8:   !! document.getElementById("mydiv")        5:   }
 9:   !! ! .innerHTML =“No need to onload";
10:   !}
11:   }

           1:   <!–- assume java.com/js/deployJava.js is loaded ->
           2:   var parameters = {java_status_events: 'true'};
           3:   <!–- set other params like jnlp->
           4:   deployJava.runApplet(attributes, parameters, '1.7');
           5:   ...
           6:   </script>
                                                                                           52
Draggable Applet Decoration
• Applet decoration settings apply equally to in browser and out of browser
  launches – borderless, etc.




                                                                              53
Other JNLP New Stuff
• Partially signed JNLP
 - Simplifies build and deployment in some scenarios
 - External JNLP file may differ from one embedded in jar
• Targeting resources to particular version of OS
     <resources os="Windows Vista Windows 7">
     <jar href=“legacySound.jar"/> </resources>
• Better “install” preferences of an application
 - For example, attribute to determine if app appears on “Add or Remove
    Programs panel”




                                                                          54
VM



     55
Updates to Experimental GC – G1
• “Garbage First” intended to replace(*) Concurrent Mark-Sweep (CMS) in
  Hotspot at some future release
• G1 is included for experimentation in Java 7
• Key benefits:
 - More predictably “soft real-time” – temporal configuration
 - High throughput
• Basics:
 - Heap partitioned into equal-sized heap regions
 - Compacts as it proceeds – looks for regions with no live objects for
   immediate reclamation

 (*) not an official forward looking statement



                                                                          56
Tiered Compilation
• Hotspot has 2 JIT’s “client” and “server”
 - Client starts fast, but let optimizations – best for clients
 - Server starts slower, but provides better optimizations
• Java 7 adds Tiered Compiliation
 - JIT the code first with “client”, and if it’s really hot code, recompile with “server”
 - Has been around for a while, but not with a great implementation
 -server -XX:+TieredCompilation

• Image from Rémi Forax showing the DaCapo Jython benchmark.
 http://www.java.net/blogs/forax


                                                                                           57
Compressed OOPS by default

• From 32bit to 64bit system grow the heap by ~1.5x due to bigger
  ordinary object pointers
• Memory is cheap, bandwidth and cache is not!
• Compressed OOPS:
 - Managed 32 bit pointers (similar heap sizes for 32/64 bit apps)
 - Scaled (8 x 4GB chunks) added to a 64 bit base
• Useful for heaps up to 32GB
 - Turned off when –Xmx > 32g



                                                                     58
Support for Dynamically Typed Languages
 • JSR 292: Supporting Dynamically Typed Languages on the Java Platform
  - invokedynamic
 • Method Handle
  - Ability to call a method
  - Implement a subclass of java.lang.invoke.MethodHandle
  - Typesafe!




                                                                          59
I10N & L8N



             60
Unicode 4                         Unicode 6
• Unicode standard was originally 16 bit
• 16 bits not sufficient for Unicode 6, but backward compatibility needs to be
    maintained
•   Use String “U+hex” to express char in Unicode
•   Unicode 6.0 adds thousands of new characters
•   Support for properties and data files (mostly interesting to Japanese Telcos and
    Indic scripts)
•   Full Unicode 6.0 REGEX support!




                                                                                      61
Extensible Currency Codes
• ISO 4217 Defines Currency Codes
• Possible to supersede default currencies with <JAVA_HOME>/lib/
  currency.properties file
• Allows for supporting global changes without updating Java
• Format: ISO 3166 Country code = ISO 4217 Codes

 # Sample currency property if Canada adopts USD
 # CA=CAD,124,2 is default ISO 4217 code
 CA=USD,840,2




                                                                   62
Number Shaper Enhancements
• NumericShaper used to map numbers to non Latin char sets (since 1.4)
• NumericShaper traditionally used an int bitmask for defaults
 - Fine when there were only 19 defaults
 - In Java 7 there are 34 (> 32 bits!!)
• Java 7 now has an Enum NumericShaper.Range
• Backward compatibility maintained, new API’s added for Enum use where
  desired




                                                                          63
Locale – Categories
• Default Locale can be set independently for format resources (dates,
   numbers, currencies) and display resources (menus and dialogs)

• Ex. Application for Japanese audience who deal with US financial transactions:
   //Enum Locale.Category – DISPLAY and FORMAT
   //Default no arg get/set is DISPLAY
   Locale.setDefault(DISPLAY, Locale.JAPAN);
   Locale.setDefault(FORMAT, Locale.US);




                                                                                  64
Locale – BCP47 extensions
Java 7 confirms to IETF BCP 47 (refs UTS #35)
   • Specify extensions to a Locale (get/set)
   • i.e., de-DE-co-phonebk
   • No guarantee the underlying platform can honor extension
         Key          Description      Example          Example Description
          ca   calendar algorithm     ca-buddhist   Thai Buddhist calendar
          co   collation type         co-pinyin     Pinyin ordering for Latin
          k*   collation parameters   kf-upper      Donald before donald
          cu   currency type          cu-usd        U.S. dollars
          nu   number type            nu-jpanfin     Japanese financial numerals
          tz   timezone               tz-aldav      Europe/Andorra
          va   common variant type    va-posix      POSIX style locale variant


                                                                                 65
Miscellaneous



                66
JDBC 4.1
• Try-with-resources statement to automatically close resources of
  type Connection, ResultSet, and Statement
  try (Statement stmt = con.createStatement()) { //... }

• RowSet 1.1 introduces RowSetFactory and RowSetProvider
 //Factory options (impl) set on cmd line or metainf
 myRowSetFactory = RowSetProvider.newFactory();
 myRs = myRowSetFactory.createJdbcRowSet();
 myRs.setUrl("jdbc:myDriver:myAttribute"); //etc
 myRs.setCommand("select COF_NAME, SUP_ID, PRICE, SALES from COFFEES");
 myRs.execute();



                                                                          67
Java DB Enhancements
• JDK 7 includes Java DB 10.8.1.2
• New Since JDK 6
 - BOOLEAN data type
 - Table truncation
 - Query plan browsing
  - Automatic calc of index stats
 - Unicode database names
 - Improved interrupt handling
  - Can now interrupt connection threads
 - MAX optimization (faster!)
 - XML operator portability

                                           68
Security
• Native Elliptic Curve Cryptography provider (ECDSA/ECDH)
 - ECC offers equivalent security with smaller key sizes, faster computations
   and lower power consumption.
• Transport Layer Security Updates
 - TLS 1.1 (RFC 4346) & TLS 1.2 (RFC 5246 ) support
 - TLS Renegotiation
 - CertPath and TLS algorithm disabling
• etc.



                                                                                69
Java XML Technology Enhancements

• JAXP 1.4.5
 - Bug fixes and performance improvements
• JAX-WS 2.2.4
 - Bug fixes and performance improvements
• JAXB 2.2.3
 - Bug fixes and performance improvements



                                           70
JavaDoc Improvements
• Section 508 accessibility guidelines
 - Captions, headings, etc.
• Previously, JavaDoc wrote to an OutputStream on the fly meaning it built
  the document sequentially, imposing limitations
• Now uses internal “HTMLTree” classes
 - Generates compliant HTML
 - Allows for more advancements in the future
• Removes limitation of only being able to execute only once in any VM
 - Was fine when used as a command line tool
 - Continuous build, etc, made it necessary to address this!


                                                                            71
CSS for JavaDoc




                  72
73

Weitere ähnliche Inhalte

Was ist angesagt?

Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)CODE WHITE GmbH
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Christian Schneider
 
Understanding ClassLoaders
Understanding ClassLoadersUnderstanding ClassLoaders
Understanding ClassLoadersMartin Skurla
 
Java class loader
Java class loaderJava class loader
Java class loaderbenewu
 
Great cup of java
Great  cup of javaGreat  cup of java
Great cup of javaCIB Egypt
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...Christopher Frohoff
 
Ahead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java ApplicationsAhead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java ApplicationsNikita Lipsky
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)CODE WHITE GmbH
 
Let's talk about java class loader
Let's talk about java class loaderLet's talk about java class loader
Let's talk about java class loaderYongqiang Li
 
Objective c runtime
Objective c runtimeObjective c runtime
Objective c runtimeInferis
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you pownedDinis Cruz
 
Java class loading tips and tricks - Java Colombo Meetup, January, 2014
Java class loading  tips and tricks - Java Colombo Meetup, January, 2014Java class loading  tips and tricks - Java Colombo Meetup, January, 2014
Java class loading tips and tricks - Java Colombo Meetup, January, 2014Sameera Jayasoma
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureAndrew Petukhov
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...joaomatosf_
 
JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers
JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers
JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers Nikita Lipsky
 

Was ist angesagt? (20)

Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
Understanding ClassLoaders
Understanding ClassLoadersUnderstanding ClassLoaders
Understanding ClassLoaders
 
Java class loader
Java class loaderJava class loader
Java class loader
 
Great cup of java
Great  cup of javaGreat  cup of java
Great cup of java
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
 
Ahead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java ApplicationsAhead-Of-Time Compilation of Java Applications
Ahead-Of-Time Compilation of Java Applications
 
testing ppt
testing ppttesting ppt
testing ppt
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
 
Let's talk about java class loader
Let's talk about java class loaderLet's talk about java class loader
Let's talk about java class loader
 
Objective c runtime
Objective c runtimeObjective c runtime
Objective c runtime
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
 
Java class loading tips and tricks - Java Colombo Meetup, January, 2014
Java class loading  tips and tricks - Java Colombo Meetup, January, 2014Java class loading  tips and tricks - Java Colombo Meetup, January, 2014
Java class loading tips and tricks - Java Colombo Meetup, January, 2014
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
 
Java Class Loader
Java Class LoaderJava Class Loader
Java Class Loader
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
 
JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers
JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers
JIT vs. AOT: Unity And Conflict of Dynamic and Static Compilers
 
Java Class Loading
Java Class LoadingJava Class Loading
Java Class Loading
 
What's new in Java 11
What's new in Java 11What's new in Java 11
What's new in Java 11
 
Java Classloaders
Java ClassloadersJava Classloaders
Java Classloaders
 

Ähnlich wie 55 new things in Java 7 - Devoxx France

Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Martijn Verburg
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy PluginsPaul King
 
Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8Wilson Su
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojureAbbas Raza
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaHenri Tremblay
 
Spock: Test Well and Prosper
Spock: Test Well and ProsperSpock: Test Well and Prosper
Spock: Test Well and ProsperKen Kousen
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
Don't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesDon't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesJamund Ferguson
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with ClojureJohn Stevenson
 
React Native Evening
React Native EveningReact Native Evening
React Native EveningTroy Miles
 
5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системеDEVTYPE
 

Ähnlich wie 55 new things in Java 7 - Devoxx France (20)

55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
 
55j7
55j755j7
55j7
 
Java
JavaJava
Java
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
 
What`s new in Java 7
What`s new in Java 7What`s new in Java 7
What`s new in Java 7
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
 
Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8Practical JavaScript Programming - Session 8/8
Practical JavaScript Programming - Session 8/8
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
Spock: Test Well and Prosper
Spock: Test Well and ProsperSpock: Test Well and Prosper
Spock: Test Well and Prosper
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Modern Java Development
Modern Java DevelopmentModern Java Development
Modern Java Development
 
Full Stack Clojure
Full Stack ClojureFull Stack Clojure
Full Stack Clojure
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
 
Don't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax TreesDon't Be Afraid of Abstract Syntax Trees
Don't Be Afraid of Abstract Syntax Trees
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with Clojure
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Java 7
Java 7Java 7
Java 7
 
5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе5. Ввод-вывод, доступ к файловой системе
5. Ввод-вывод, доступ к файловой системе
 

Mehr von David Delabassee

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best PracticesDavid Delabassee
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsDavid Delabassee
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsDavid Delabassee
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessDavid Delabassee
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffDavid Delabassee
 
Java EE 8 - February 2017 update
Java EE 8 - February 2017 updateJava EE 8 - February 2017 update
Java EE 8 - February 2017 updateDavid Delabassee
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016David Delabassee
 
Java EE 8 - Work in progress
Java EE 8 - Work in progressJava EE 8 - Work in progress
Java EE 8 - Work in progressDavid Delabassee
 
HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)David Delabassee
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyDavid Delabassee
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontDavid Delabassee
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8David Delabassee
 

Mehr von David Delabassee (20)

JVMs in Containers - Best Practices
JVMs in Containers - Best PracticesJVMs in Containers - Best Practices
JVMs in Containers - Best Practices
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - Serverless
 
Java Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed BanffJava Serverless in Action - Voxxed Banff
Java Serverless in Action - Voxxed Banff
 
Serverless Kotlin
Serverless KotlinServerless Kotlin
Serverless Kotlin
 
REST in an Async World
REST in an Async WorldREST in an Async World
REST in an Async World
 
JAX-RS 2.1 Reloaded
JAX-RS 2.1 ReloadedJAX-RS 2.1 Reloaded
JAX-RS 2.1 Reloaded
 
Java EE 8 - February 2017 update
Java EE 8 - February 2017 updateJava EE 8 - February 2017 update
Java EE 8 - February 2017 update
 
Java EE Next
Java EE NextJava EE Next
Java EE Next
 
Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016Java EE Next - BeJUG JavaOne Afterglow 2016
Java EE Next - BeJUG JavaOne Afterglow 2016
 
HTTP/2 comes to Java
HTTP/2 comes to JavaHTTP/2 comes to Java
HTTP/2 comes to Java
 
Java EE 8 - Work in progress
Java EE 8 - Work in progressJava EE 8 - Work in progress
Java EE 8 - Work in progress
 
HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)HTTP/2 comes to Java (Dec. 2015 version)
HTTP/2 comes to Java (Dec. 2015 version)
 
EJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and StrategyEJB and CDI - Alignment and Strategy
EJB and CDI - Alignment and Strategy
 
HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
Java EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web frontJava EE 8 - What’s new on the Web front
Java EE 8 - What’s new on the Web front
 
HTTP/2 Comes to Java
HTTP/2 Comes to JavaHTTP/2 Comes to Java
HTTP/2 Comes to Java
 
What's coming in Java EE 8
What's coming in Java EE 8What's coming in Java EE 8
What's coming in Java EE 8
 

Kürzlich hochgeladen

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Kürzlich hochgeladen (20)

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

55 new things in Java 7 - Devoxx France

  • 1. (+) 55 fonctionnalités de Java 7 dont vous n'avez (probablement) pas encore entendu parler par David Delabassée @delabassee 1
  • 2. About me... • David Delabassée - ... Sun, Oracle - Devoxx (Belgium) Steering • @delabassee 2
  • 3. The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 3
  • 4. Java 7 • InvokeDynamic • Fork/Join • NIO.2 • Project Coin • ... 4
  • 6. Binary Literals 1: int mask = 0b101010101010; 2: aShort = (short)0b1010000101000101; 3: long aLong = 0b1010000101000101101000010100010110100001010001011010000101000101L; 1: HAPPY_FACE = { 2: (short)0b0000011111100000; 3: (short)0b0000100000010000; 4: (short)0b0001000000001000; 5: (short)0b0010000000000100; 6: (short)0b0100000000000010; 7: (short)0b1000011001100001; 8: (short)0b1000011001100001; 9: (short)0b1000000000000001; 10: (short)0b1000000000000001; 11: (short)0b1001000000001001; 12: (short)0b1000100000010001; 13: (short)0b0100011111100010; 14: (short)0b0010000000000100; 15: (short)0b0001000000001000; 16: (short)0b0000100000010000; 17: (short)0b0000011111100000; } 6
  • 7. Underscores in Numeric Literals • Valid int mask = 0b1010_1010_1010; long big = 9_223_783_036_967_937L; long creditCardNumber = 1234_5678_9012_3456L; long socialSecurityNumber = 999_99_9999L; float pi = ! 3.14_15F; long hexBytes = 0xFF_EC_DE_5E; long hexWords = 0xCAFE_BFFE; • Invalid float pi1 = 3_.1415F; float pi2 = 3._1415F; long ssn = 999_99_9999_L; int x1 = _52; int x1 = 52_; int x2 = 0_x52; int x2 = 0x_52; 7
  • 8. Strings in Switch 1: int NbrDay(String s, int year) { 2: switch(s) { 3: case "April": case "June": 4: case "September": case "November": 5: return 30; 6: 7: case "January": case "March": case "May": 8: case "July": case "August": case "December": 9: return 31; 10: 11: case "February”: 12: ... 13: default: 14: ... 15: } 8
  • 9. Automatic Resource Management 1: try (InputStream in = new FileInputStream(src); 2: OutputStream out = new FileOutputStream(dest)) 3: { 4: byte[] buf = new byte[8192]; 5: int n; 6: while (n = in.read(buf)) >= 0) 7: out.write(buf, 0, n); 8: } • New java.lang.AutoCloseable interface • Anything with a void close() method is a candidate 9
  • 10. 10
  • 11. Suppressed Exceptions New Throwable.getSupressed() method 1: java.io.IOException 2: at Suppress.write(Suppress.java:19) 3: at Suppress.main(Suppress.java:8) 4: Suppressed:  java.io.IOException 5: at Suppress.close(Suppress.java:24) 6: at Suppress.main(Suppress.java:9) 7: Suppressed:  java.io.IOException 8: at  Suppress.close(Suppress.java:24) 9: at  Suppress.main(Suppress.java:9) 11
  • 12. Multi Catch 1: //... 2: catch (IOException ex) { 3: logger.log(ex); 4: throw ex; 5: } catch (SQLException ex) { 6: logger.log(ex); 7: throw ex; 8: } 1: //... 2: catch (IOException|SQLException ex) { 3: logger.log(ex); 4: throw ex; 5: } 12
  • 13. Multi Catch 1: try { 2: !... 3: } catch (SpecificException ex) { 4: // Do something very specific! 5: throw ex; 6: } catch (AnException | MyException | ZeException ex) { 9: ! // Do something more generic... 10: ! throw ex; 11: } 13
  • 14. More Precise Rethrow 1: // pre Java 7 "imprecise rethrow" 2: // must use "throws Exception" 3: public static void imprecise() throws Exception { 4: try { 5: ! ! // Code that may throw either 6: !! // FirstException or SecondException 7: ! } catch (Exception e) { 8: throw e; 9: } 10: } 14
  • 15. More Precise Rethrow 1: // Java 7 precise rethrow. 2: // No longer "throws Exception" 3: public static void precise() throws FirstException, SecondException { 4: try { 5: !! // Code that may throw either 6: !! // FirstException or SecondException 7: } catch (Exception e) { 8: throw e; 9: } 10: } 15
  • 16. Diamond <> Map<Ville,List<Client>> map = new HashMap<Ville,List<Client>>(); Map<Ville,List<Client>> map = new HashMap<>(); Map<Dep,Map<Ville,List<Client>>> map = new HashMap<Dep,Map<Ville,List<Client>>>(); Map<Dep,Map<Ville,List<Client>>> map = new HashMap<>(); Map<Pays,Map<Dep,Map<Ville,List<Client>>>> map = new HashMap<Pays,Map<Dep,Map<Ville,List<Client>>>>(); Map<Pays,Map<Dep,Map<Ville,List<Client>>>> map = new HashMap<>(); 16
  • 17. NIO.2 IO 17
  • 18. File Navigation Helpers Key navigation Helper Types: • Class java.nio.file.Files - Static methods to operate on files, directories and other types of files • Class java.nio.file.Paths - Static methods to return a Path by converting a string or URI • Interface java.nio.file.Path - Used for objects that represent the location of a file in a file system Typical use case: • Use Paths to get a Path • Use Files to do stuff 18
  • 19. File Navigation Helpers 1: Path p1 = Paths.get("/tmp/foo"); 2: Path p2 = Paths.get(URI.create("file:///Users/joe/FileTest.java")); 3: Path p3 = Paths.get(System.getProperty("user.home"),"logs", "foo.log"); 4: Path p4 = Paths.get("/home/joe/foo"); 5: Path p5 = ("c:datatest.dta"); 6: Path p6 = Paths.get("Test.java").toAbsolutePath(); 7: 8: Path fileName = listing.geFileName(); 9: Path parent = p2.getParent(); 10: Path root = p2.getRoot(); 11: Path subRep = p2.subPath(0,2); 12: 11: File file = aPathPath.toFile(); // ‘legacy’ java.io.File 19
  • 20. Files java.nio.file.Files class • Static methods to operate on files, directories and other types of files - Read/Write, Copy, & Delete - Create Files, Directories & Links - Use of system “temp” directory - Attributes – Modified/Owner/Permissions/Size - Determining the file content type - Determining the file type (ex. isExecutable, isSymLink) - etc. 1: Files.move(src, dst, StandardCopyOption.ATOMIC_MOVE); 2: Files.copy(src, dst, 3: !! StandardCopyOption.COPY_ATTRIBUTES, 4: !! StandardCopyOption.REPLACE_EXISTING); 5: String type = Files.probeContentType(path); 20
  • 21. Files Helper Class DirectoryStream iterate over entries • Scales to large directories • Uses less resources • Smooth out response time for remote file systems • Implements Iterable and Closeable for productivity Filtering support • Build-in support for glob, regex and custom filters Class 1: Path srcPath = Paths.get(“/home/regis/src”); 2: 3: try (DirectoryStream<Path> dir = 4: ! ! srcPath.newDirectoryStream(“*.java”)) { 5: ! for (Path file : dir) 6: ! ! System.out.println(file.getName()); 7: } 21
  • 22. Symbolic Links Path and Files are “link aware” 1: Path newLink = Paths.get(...); 2: Path existingFile = Paths.get(...); 3: try { 4: Files.createLink(newLink, existingFile); 5: } catch (IOException x) { 6: System.err.println(x); 7: } catch (UnsupportedOperationException x) { 8: ! //Some file systems or some configurations 9: !! ! //may not support links 10: System.err.println(x); 11: } 22
  • 23. Walking A File Tree • FileVisitor interface makes walking a file tree for search, or performing actions, trivial. • SimpleFileVisitor implements preVisitDirectory(T dir, BasicFileAttributes attrs); visitFile(T dir, BasicFileAttributes attrs); visitFileFailed(T dir, IOException exc); postVisitDirectory(T dir, IOException exc); 23
  • 24. Walking A File Tree public static class PrintFiles extends SimpleFileVisitor<Path> { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attr) { if (attr.attr.isRegularFile()) { System.out.format("Regular file: %s ", file); } else if { System.out.format("Not a regular file: %s ", file); } return CONTINUE; } } Path startingDir = ...; PrintFiles pf = new PrintFiles(); Files.walkFileTree(startingDir, pf); 24
  • 25. Watching a Directory • Create a WatchService “watcher” for the filesystem • Register a directory with the watcher • “Watcher” can be polled or waited on for events - Events raised in the form of Keys - Retrieve the Key from the Watcher - Key has filename and events within it for create/delete/modify • Ability to detect event overflows 25
  • 26. Custom FileSystems • FileSystems class is factory to FileSystem (interface) • Java 7 allows for developing custom FileSystems: - Memory based based file systems - Fault tolerant distributed file systems - Replacing or supplementing the default file system provider - etc. • Two steps: - Implement java.nio.file.spi.FileSystemProvider  - URI, Caching, File Handling, etc. - Implement java.nio.file.FileSystem - Roots, RW access, file store, etc. 26
  • 27. zip FileSystem Provider Fully-functional and supported NIO.2 filesystem provider for zip and jar files 1: Map<String, String> env = new HashMap<>(); 2: !env.put("create", "true"); 3: !// locate file system by using the syntax 4: !// defined in java.net.JarURLConnection 5: !URI u= URI.create("jar:file:/foo/zipfs/zipfstest.zip"); 6: !try (FileSystem z = FileSystems.newFileSystem(u, env)) { 7: !! Path externalFile = Paths.get("/foo/sample.txt"); 8: !! Path pathInZipfile = z.getPath("/sample.txt"); 9: !// copy a file into the zip file 10: !externalTxtFile.copyTo(pathInZipfile); 11: } 12: ... 27
  • 28. URLClassLoader.close() 1: // create a class loader loading from "foo.jar" 2: URL url = new URL("file:foo.jar"); 3: URLClassLoader loader = new URLClassLoader (new URL[] {url}); 4: Class cl = Class.forName ("Foo", true, loader); 5: Runnable foo = (Runnable) cl.newInstance(); 6: foo.run(); 7: loader.close(); 8: 9: // foo.jar gets updated somehow 10: loader = new URLClassLoader (new URL[] {url}); 11: cl = Class.forName ("Foo", true, loader); 12: foo = (Runnable) cl.newInstance(); 13: 14: // run the new implementation of Foo 15: foo.run(); 28
  • 29. SDP & SCTP • Infiniband - High throughput, low latency streamed connections - Remote Direct Memory Access - Solaris & Linux 29
  • 31. Divide and Conquer if (my portion of the work is small enough) do the work directly else split my work into two pieces invoke the two pieces 31
  • 32. Fork Join Framework - Pools ForkJoinPool - Service for running ForkJoinTasks • aFjp.execute(aTask); // async • aFjp.invoke(aTask); // wait • aFjp.submit(aTask); // async + future • ForkJoinPool(); // default to platform • ForkJoinPool(int n); // # concurrent threads • ForJoinPool(n,aThreadFactory,exHandler,FIFOtasks); // Create your own thread handler, exception handler, and boolean on task ordering (default LIFO) 32
  • 33. Fork Join Framework - Tasks ForkJoinTask - The abstract base class for: • RecursiveAction - A recursive resultless task - Implements compute() abstract method • RecursiveTask - Similar to RecursiveAction but returns a result 1: ForkJoinPool p = new ForkJoinPool(); 2: MyTask mt = new MyTask(n); // implements compute 3: p.submit(mt); 4: while (!mt.isDone()) {/*THUMPER!*/ } 5: System.out.println(mt.get()); 33
  • 34. Fork Join Framework - Compute() • RecursiveAction - ex. increment an entire array 1: protected void compute() { 2: if (hi - lo < THRESHOLD) { 3: for (int i = lo; i < hi; ++i) array[i]++; } 4: else { 5: int mid = (lo + hi) >>> 1; 6: invokeAll(new IncrementTask(array, lo, mid), 7: new IncrementTask(array, mid, hi));} • RecursiveTask - ex. Fibonacci numbers 1: protected Integer compute() { 2: if (n <= 1) return n; 3: Fibonacci f1 = new Fibonacci(n - 1); 4: Fibonacci f2 = new Fibonacci(n - 2); 5: f1.fork(); f2.fork(); 6: return f2.join() + f1.join();} 34
  • 35. TransferQueue • TransferQueue interface • Extension to BlockingQueue • Implemented by LinkedTransferQueue • Additional Benefits: - Adds methods: transfer(E e), tryTransfer(E e), tryTransfer(E e, long timeout), hasWaitingConsumer(), getWaitingConsumerCount() - Allows for smarter queues to be built – sidestep the data structure if it’s known there are consumers waiting. 35
  • 36. ConcurrentLinkedDeque • Unbound concurrent deque based on linked nodes - Like a Queue, but allows front and rear removal of elements • Concurrent insert, remove and access on multiple threads • Iterators are weakly consistent 36
  • 37. Concurrent Random Numbers • Existing RNG becomes unwitting source of contention between threads in concurrent apps • Expected more needs of concurrent RNG with advent of Fork Join Framework Class java.util.ThreadLocalRandom ThreadLocalRandom.current().nextDouble(…) ThreadLocalRandom.current().nextInt (…) ThreadLocalRandom.current().nextLong(…) 37
  • 38. Phasers • Barrier similar to CountDownLatch and CyclicBarrier • Used for many threads to wait at common barrier point • How is Phaser an improvement? - Dynamic add/remove “parties” to be sync’d - Better deadlock avoidance - Arrival “counting” and phase advance options, etc - Termination api’s - Tiering (tree structure) - Rather than sync 100 threads, sync 2x50 then 2x. 38
  • 39. ClassLoader – Deadlock Avoidance • Acyclic class loader delegation model • Custom classLoaders were prone to deadlock • Java 7 new locking mechanism to avoid deadlock • Java 7 “parallel capable” classloader 39
  • 40. Client 40
  • 41. Standardize Nimbus Look and Feel • Better than Metal for cross platform look-and-feel • Introduced in Java SE 6u10, now part of Swing • Not the default L&F • Scalable Java 2D impl 41
  • 42. JLayer 1: // wrap your component with JLayer 2: JLayer<JPanel> layer = new JLayer<JPanel>(panel); 3: // custom ui provides all extra functionality 4: layer.setUI(myLayerUI); 5: // add the layer as usual component 6: frame.add(layer); 42
  • 43. Mixing of AWT and Swing (*) (*) As of 6u12 and 7u1, some caveats for scroll bars 43
  • 44. Translucent Windows • Private API added in 6u10, made public in Java 7 • Support (based on platform) for: - Uniform Translucency - Per Pixel Translucency - Per Pixel Transparency 1: // simple uniform: 2: aWindow.setOpacity(0.5f); 3: 4: // Per pixel g2d is the g2d of a Jpanel on paintComponent(g) 5: Paint p = new GradientPaint(0.0f, 0.0f, new Color(R, G, B,0), 0.0f, 6: getHeight(), new Color(R, G, B, 255), true); 7: g2d.setPaint(p); 8: g2d.fillRect(0, 0, getWidth(), getHeight()); 44
  • 45. Xrender-based Java 2D • Improved Graphics Performance, modern X11 • Off by default (backward compatibility) • Quiet: " -Dsun.java2d.xrender=true • Verbose (log on stdout if successful or not) -Dsun.java2d.xrender=true 45
  • 46. OpenType/CFF Fonts • Java Platform must support TrueType fonts, other font technologies is implementation dependent • Java 7 adds support for “Compact Font Format” - OpenType/CFF 46
  • 47. Better Support for Linux Fonts • Five logical fonts since Java 1.0: - Serif, Sans-serif, Monospaced, Dialog, and DialogInput - Must map to physical font on your system • No consistency in fonts in Linux • Required editing fontconfig.properties • Java 7 on Linux (and Solaris 11) uses system “libfontconfig” 47
  • 49. Other Client Stuff • Shaped windows • Handling multiple files selection in the FileDialog class • Mouse - java.awt.Toolkit.areExtraMouseButtonsEnabled() - java.awt.event.MouseWheelEvent.getPreciseWheelRotation() • java.awt.PrintJob dialogbox • ... 49
  • 51. Embedding JNLP File in Applet Tag • Saves a network round trip first time applet is loaded • Base64 Encode the JNLP contents into a Javascript call <script src="http://www.java.com/js/deployJava.js"></script> <script> var attributes = {} ; <!-- Base64 encoded string trunc’d below for readability --> var parameters = {jnlp_href: 'dynamictree-applet.jnlp', jnlp_embedded: 'PCEtLSAKLyoKICogQ29weX ... HA+Cg==' } ; deployJava.runApplet(attributes, parameters, '1.7'); </script> 51
  • 52. Ability to detect applet init status on load 1: <script> 2: function registerAppletStateHandler() { 3: !switch (drawApplet.status) { 4: !case 1: <!–- applet is loading --> 1: function onLoadHandler(){ 5: !! drawApplet.onLoad = onLoadHandler; 2: ! document.getElementById("mydiv“) 6: !case 2: <!–- applet is loaded --> 3: ! .innerHTML = "Applet loaded"; 7: !case 3: <!–- error --> 4: ! draw(); 8: !! document.getElementById("mydiv") 5: } 9: !! ! .innerHTML =“No need to onload"; 10: !} 11: } 1: <!–- assume java.com/js/deployJava.js is loaded -> 2: var parameters = {java_status_events: 'true'}; 3: <!–- set other params like jnlp-> 4: deployJava.runApplet(attributes, parameters, '1.7'); 5: ... 6: </script> 52
  • 53. Draggable Applet Decoration • Applet decoration settings apply equally to in browser and out of browser launches – borderless, etc. 53
  • 54. Other JNLP New Stuff • Partially signed JNLP - Simplifies build and deployment in some scenarios - External JNLP file may differ from one embedded in jar • Targeting resources to particular version of OS <resources os="Windows Vista Windows 7"> <jar href=“legacySound.jar"/> </resources> • Better “install” preferences of an application - For example, attribute to determine if app appears on “Add or Remove Programs panel” 54
  • 55. VM 55
  • 56. Updates to Experimental GC – G1 • “Garbage First” intended to replace(*) Concurrent Mark-Sweep (CMS) in Hotspot at some future release • G1 is included for experimentation in Java 7 • Key benefits: - More predictably “soft real-time” – temporal configuration - High throughput • Basics: - Heap partitioned into equal-sized heap regions - Compacts as it proceeds – looks for regions with no live objects for immediate reclamation (*) not an official forward looking statement 56
  • 57. Tiered Compilation • Hotspot has 2 JIT’s “client” and “server” - Client starts fast, but let optimizations – best for clients - Server starts slower, but provides better optimizations • Java 7 adds Tiered Compiliation - JIT the code first with “client”, and if it’s really hot code, recompile with “server” - Has been around for a while, but not with a great implementation -server -XX:+TieredCompilation • Image from Rémi Forax showing the DaCapo Jython benchmark. http://www.java.net/blogs/forax 57
  • 58. Compressed OOPS by default • From 32bit to 64bit system grow the heap by ~1.5x due to bigger ordinary object pointers • Memory is cheap, bandwidth and cache is not! • Compressed OOPS: - Managed 32 bit pointers (similar heap sizes for 32/64 bit apps) - Scaled (8 x 4GB chunks) added to a 64 bit base • Useful for heaps up to 32GB - Turned off when –Xmx > 32g 58
  • 59. Support for Dynamically Typed Languages • JSR 292: Supporting Dynamically Typed Languages on the Java Platform - invokedynamic • Method Handle - Ability to call a method - Implement a subclass of java.lang.invoke.MethodHandle - Typesafe! 59
  • 61. Unicode 4 Unicode 6 • Unicode standard was originally 16 bit • 16 bits not sufficient for Unicode 6, but backward compatibility needs to be maintained • Use String “U+hex” to express char in Unicode • Unicode 6.0 adds thousands of new characters • Support for properties and data files (mostly interesting to Japanese Telcos and Indic scripts) • Full Unicode 6.0 REGEX support! 61
  • 62. Extensible Currency Codes • ISO 4217 Defines Currency Codes • Possible to supersede default currencies with <JAVA_HOME>/lib/ currency.properties file • Allows for supporting global changes without updating Java • Format: ISO 3166 Country code = ISO 4217 Codes # Sample currency property if Canada adopts USD # CA=CAD,124,2 is default ISO 4217 code CA=USD,840,2 62
  • 63. Number Shaper Enhancements • NumericShaper used to map numbers to non Latin char sets (since 1.4) • NumericShaper traditionally used an int bitmask for defaults - Fine when there were only 19 defaults - In Java 7 there are 34 (> 32 bits!!) • Java 7 now has an Enum NumericShaper.Range • Backward compatibility maintained, new API’s added for Enum use where desired 63
  • 64. Locale – Categories • Default Locale can be set independently for format resources (dates, numbers, currencies) and display resources (menus and dialogs) • Ex. Application for Japanese audience who deal with US financial transactions: //Enum Locale.Category – DISPLAY and FORMAT //Default no arg get/set is DISPLAY Locale.setDefault(DISPLAY, Locale.JAPAN); Locale.setDefault(FORMAT, Locale.US); 64
  • 65. Locale – BCP47 extensions Java 7 confirms to IETF BCP 47 (refs UTS #35) • Specify extensions to a Locale (get/set) • i.e., de-DE-co-phonebk • No guarantee the underlying platform can honor extension Key Description Example Example Description ca calendar algorithm ca-buddhist Thai Buddhist calendar co collation type co-pinyin Pinyin ordering for Latin k* collation parameters kf-upper Donald before donald cu currency type cu-usd U.S. dollars nu number type nu-jpanfin Japanese financial numerals tz timezone tz-aldav Europe/Andorra va common variant type va-posix POSIX style locale variant 65
  • 67. JDBC 4.1 • Try-with-resources statement to automatically close resources of type Connection, ResultSet, and Statement try (Statement stmt = con.createStatement()) { //... } • RowSet 1.1 introduces RowSetFactory and RowSetProvider //Factory options (impl) set on cmd line or metainf myRowSetFactory = RowSetProvider.newFactory(); myRs = myRowSetFactory.createJdbcRowSet(); myRs.setUrl("jdbc:myDriver:myAttribute"); //etc myRs.setCommand("select COF_NAME, SUP_ID, PRICE, SALES from COFFEES"); myRs.execute(); 67
  • 68. Java DB Enhancements • JDK 7 includes Java DB 10.8.1.2 • New Since JDK 6 - BOOLEAN data type - Table truncation - Query plan browsing - Automatic calc of index stats - Unicode database names - Improved interrupt handling - Can now interrupt connection threads - MAX optimization (faster!) - XML operator portability 68
  • 69. Security • Native Elliptic Curve Cryptography provider (ECDSA/ECDH) - ECC offers equivalent security with smaller key sizes, faster computations and lower power consumption. • Transport Layer Security Updates - TLS 1.1 (RFC 4346) & TLS 1.2 (RFC 5246 ) support - TLS Renegotiation - CertPath and TLS algorithm disabling • etc. 69
  • 70. Java XML Technology Enhancements • JAXP 1.4.5 - Bug fixes and performance improvements • JAX-WS 2.2.4 - Bug fixes and performance improvements • JAXB 2.2.3 - Bug fixes and performance improvements 70
  • 71. JavaDoc Improvements • Section 508 accessibility guidelines - Captions, headings, etc. • Previously, JavaDoc wrote to an OutputStream on the fly meaning it built the document sequentially, imposing limitations • Now uses internal “HTMLTree” classes - Generates compliant HTML - Allows for more advancements in the future • Removes limitation of only being able to execute only once in any VM - Was fine when used as a command line tool - Continuous build, etc, made it necessary to address this! 71
  • 73. 73