SlideShare ist ein Scribd-Unternehmen logo
1 von 146
JAVA, UP TO DATE
    JavaSE7 & JavaEE6




                Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaOne Tokyo 2012
           April 4-5




2                  Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaOne Tokyo 2012
           April 4-5




2                  Copyright © 2012 Akira Koyasu. Some rights reserved.
今使える、Javaの最新技術




3          Copyright © 2012 Akira Koyasu. Some rights reserved.
今使える、Javaの最新技術


    JavaSE7
     Project Coin

     Fork/Join Framework

     InvokeDynamic

     More New I/O


3                          Copyright © 2012 Akira Koyasu. Some rights reserved.
今使える、Javaの最新技術


    JavaSE7                JavaEE6
     Project Coin               Simplified Packaging

     Fork/Join Framework        ManagedBean

     InvokeDynamic              CDI

     More New I/O


3                          Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaSE7




     Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaSE Roadmap

                2011                   2012                                        2013

    2011/7/28                     2012 later                           2013 Summer


     JavaSE7                      JavaSE7u6                                   JavaSE8
                                  JRE for MacOSX                                 Jigsaw
                2012/4/27           Auto-update                                 Lambda
                                                                               JavaFX3.0
                  JavaSE7u4                                                    HotRockit
                 JDK for MacOSX                                                 Nashorn
                    JavaFX2.1                  2012/11
                      G1GC
                   JRE default                      JavaSE6
                                               Last public update

5                                                 Copyright © 2012 Akira Koyasu. Some rights reserved.
Themes of JavaSE7
         (from JSR 336)




6                   Copyright © 2012 Akira Koyasu. Some rights reserved.
Themes of JavaSE7
         (from JSR 336)




       Compatiblity



6                   Copyright © 2012 Akira Koyasu. Some rights reserved.
Themes of JavaSE7
              (from JSR 336)




          Compatiblity

    Productivity            Universality
    Performance             Integration

6                        Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaSE7


    Project Coin
    Fork/Join Framework
    InvokeDynamic
    More New I/O

7                  Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更




                                                                 photo.1



8                Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更   Small Change = Coin




                                                                 photo.1



8                Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更           Small Change = Coin

     Strings in switch




                                                                         photo.1



8                        Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更            Small Change = Coin

     Strings in switch
     Numeric literal improvements




                                                                           photo.1



8                          Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更             Small Change = Coin

     Strings in switch
     Numeric literal improvements
     Multi-catch with more precise rethrow




                                                                            photo.1



8                           Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更             Small Change = Coin

     Strings in switch
     Numeric literal improvements
     Multi-catch with more precise rethrow
     try-with-resources



                                                                            photo.1



8                           Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更             Small Change = Coin

     Strings in switch
     Numeric literal improvements
     Multi-catch with more precise rethrow
     try-with-resources
     Diamond

                                                                            photo.1



8                           Copyright © 2012 Akira Koyasu. Some rights reserved.
Project Coin

    言語仕様の小さな変更             Small Change = Coin

     Strings in switch
     Numeric literal improvements
     Multi-catch with more precise rethrow
     try-with-resources
     Diamond
     Safe varargs
                                                                            photo.1



8                           Copyright © 2012 Akira Koyasu. Some rights reserved.
Strings in switch




9             Copyright © 2012 Akira Koyasu. Some rights reserved.
Strings in switch

    String flag = "aaa";
    switch (flag) {
    	 case "aaa":
    	 	 System.out.println("aaa");
    	 	 break;
    	 case "bbb":
    	 	 System.out.println("bbb");
    	 	 break;
    	 case "ccc":
    	 	 System.out.println("ccc");
    	 	 break;
    }



9                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Strings in switch

    String flag = "aaa";                      コンパイル時に
    switch (flag) {
                                          hashCode()などを
    	 case "aaa":
    	 	 System.out.println("aaa");           使用した比較に
    	 	 break;
    	 case "bbb":                            書き換えられる
    	 	 System.out.println("bbb");
    	 	 break;
    	 case "ccc":
    	 	 System.out.println("ccc");
    	 	 break;
    }



9                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Strings in switch

    String flag = "aaa";                      コンパイル時に
    switch (flag) {
                                          hashCode()などを
    	 case "aaa":
    	 	 System.out.println("aaa");           使用した比較に
    	 	 break;
    	 case "bbb":                            書き換えられる
    	 	 System.out.println("bbb");
    	 	 break;
    	 case "ccc":
    	 	 System.out.println("ccc");
    	 	 break;
    }                                              nullに注意


9                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Numeric literal
     improvements




10            Copyright © 2012 Akira Koyasu. Some rights reserved.
Numeric literal
     improvements
           Binary literals
     int b = 0b1110;    // binary (new!)

     int o = 016;       // octal
     int d = 14;        // decimal
     int x = 0xE;       // hexadecimal




10                     Copyright © 2012 Akira Koyasu. Some rights reserved.
Numeric literal
      improvements
             Binary literals
       int b = 0b1110;    // binary (new!)

       int o = 016;       // octal
       int d = 14;        // decimal
       int x = 0xE;       // hexadecimal



     Underscores in numeric literals
            int m = 1_000_000;



10                       Copyright © 2012 Akira Koyasu. Some rights reserved.
Multi-catch with more
       precise rethrow




11               Copyright © 2012 Akira Koyasu. Some rights reserved.
Multi-catch with more
        precise rethrow
                  try {
     “|”で複数の例外を   	   foo();	 	  // throws Exception1, Exception2
                  } catch (Exception1 | Exception2 e) {
          catch   	
                  }
                      e.printStackTrace();




11                          Copyright © 2012 Akira Koyasu. Some rights reserved.
Multi-catch with more
        precise rethrow
                              try {
     “|”で複数の例外を               	   foo();	 	  // throws Exception1, Exception2
                              } catch (Exception1 | Exception2 e) {
          catch               	
                              }
                                  e.printStackTrace();




     スーパータイプでcatch
     → 実際のサブタイプでthrows宣言可能
        void callBar() throws SubException1, SubException2 {
        	   try {
        	   	   bar();	 	  // throws SubException1, SubException2
        	   } catch (SuperException e) {
        	   	   throw e;
        	   }
        }



11                                       Copyright © 2012 Akira Koyasu. Some rights reserved.
try-with-resources




12             Copyright © 2012 Akira Koyasu. Some rights reserved.
try-with-resources

     tryに続けて宣言したリソースが
         自動的にclose()される




12             Copyright © 2012 Akira Koyasu. Some rights reserved.
try-with-resources

         tryに続けて宣言したリソースが
             自動的にclose()される
     try (Writer writer = new FileWriter(file)) {
     	 writer.write("hello!!");
     } catch (IOException e) {
     	 e.printStackTrace();
     }




12                               Copyright © 2012 Akira Koyasu. Some rights reserved.
try-with-resources

           tryに続けて宣言したリソースが
               自動的にclose()される
       try (Writer writer = new FileWriter(file)) {
       	 writer.write("hello!!");
       } catch (IOException e) {
       	 e.printStackTrace();
       }

     java.lang.AutoCloseable / java.io.Closeable
     “;”で複数リソースを宣言可

12                                 Copyright © 2012 Akira Koyasu. Some rights reserved.
Diamond




13       Copyright © 2012 Akira Koyasu. Some rights reserved.
Diamond

           型推論により、 コンストラクタの
           ジェネリクスパラメータを省略可能
     Map<String, List<Integer>> map = new HashMap<>();




13                               Copyright © 2012 Akira Koyasu. Some rights reserved.
Diamond

            型推論により、 コンストラクタの
            ジェネリクスパラメータを省略可能
     Map<String, List<Integer>> map = new HashMap<>();



                      省略できないケース
      // 匿名クラス
      List<String> list = new ArrayList<>(){};

      void call() {
      	 doSomething(new ArrayList<>());	 	        // メソッド呼び出し
      }



13                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Safe Varargs (1)




14            Copyright © 2012 Akira Koyasu. Some rights reserved.
Safe Varargs (1)

     ジェネリック型の可変長引数をもつメソッド
      static void pol(List<String>... strLists) {
      	 // ...
      }




14                             Copyright © 2012 Akira Koyasu. Some rights reserved.
Safe Varargs (1)

     ジェネリック型の可変長引数をもつメソッド
      static void pol(List<String>... strLists) {
      	 // ...
      }


         呼び出し側に警告(今まで通り)
      List<String> b = ...
      List<String> s = ...
      // WARNING: Type safety: A generic array of List<String>
      //          is created for a varargs parameter
      pol(b, s);




14                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Safe Varargs (1)

     ジェネリック型の可変長引数をもつメソッド
      static void pol(List<String>... strLists) {
      	 // ...
      }


       加えて定義側にも警告が出るように
         // WARNING: Type safety: Potential heap pollution
         //          via varargs parameter strLists
         static void pol(List<String>... strLists) {
         	 // ...
         }




14                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Safe Varargs (2)




15            Copyright © 2012 Akira Koyasu. Some rights reserved.
Safe Varargs (2)

                   @SafeVarargs
         このメソッドは安全であるという表明
     @SafeVarargs
     static void notpol(List<String>... strLists) {
     	 // ...
     }




15                             Copyright © 2012 Akira Koyasu. Some rights reserved.
Safe Varargs (2)

                   @SafeVarargs
         このメソッドは安全であるという表明
     @SafeVarargs
     static void notpol(List<String>... strLists) {
     	 // ...
     }

                  呼び出し側の警告も抑制される
                         List<String> b = ...
                         List<String> s = ...
                         notpol(b, s);



15                              Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaSE7


     Project Coin
     Fork/Join Framework
     InvokeDynamic
     More New I/O

16                  Copyright © 2012 Akira Koyasu. Some rights reserved.
Fork/Join Framework




                                 photo.2




17              Copyright © 2012 Akira Koyasu. Some rights reserved.
Fork/Join Framework


     並列処理のためのフレームワーク




                                 photo.2




17              Copyright © 2012 Akira Koyasu. Some rights reserved.
Fork/Join Framework


     並列処理のためのフレームワーク




           ?
                                 photo.2




17              Copyright © 2012 Akira Koyasu. Some rights reserved.
Concurrency Utilities




18               Copyright © 2012 Akira Koyasu. Some rights reserved.
Concurrency Utilities

      java.util.concurrent.ExecutorService
                                                   (since: JavaSE5)




18                         Copyright © 2012 Akira Koyasu. Some rights reserved.
Concurrency Utilities

          java.util.concurrent.ExecutorService
                                                                (since: JavaSE5)

     ExecutorService executor = Executors.newCachedThreadPool();

     executor.submit(new Runnable() {
     	 @Override
     	 public void run() {
     	 	 // ...
     	 }
     });

     executor.shutdown();




18                                      Copyright © 2012 Akira Koyasu. Some rights reserved.
Concurrency Utilities

          java.util.concurrent.ExecutorService
                                                                (since: JavaSE5)

     ExecutorService executor = Executors.newCachedThreadPool();

     executor.submit(new Runnable() {
     	 @Override
     	 public void run() {
     	 	 // ...
     	 }
     });

     executor.shutdown();


               1つのタスクの粒度が大きい

18                                      Copyright © 2012 Akira Koyasu. Some rights reserved.
分割統治法
     (Divide and Conquer Algorithm)




19                    Copyright © 2012 Akira Koyasu. Some rights reserved.
分割統治法
          (Divide and Conquer Algorithm)

     (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク


                      Task




19                           Copyright © 2012 Akira Koyasu. Some rights reserved.
分割統治法
          (Divide and Conquer Algorithm)

     (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク


                      Task


                     fork()
            Task                            Task




19                            Copyright © 2012 Akira Koyasu. Some rights reserved.
分割統治法
          (Divide and Conquer Algorithm)

     (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク


                             Task


                         fork()
               Task                               Task



        Task          Task           Task                       Task
19                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
分割統治法
          (Divide and Conquer Algorithm)

     (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク


                             Task


                         fork()
               Task                               Task



        Task          Task           Task                       Task
19                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
分割統治法
          (Divide and Conquer Algorithm)

     (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク


                               Task
               join()
                           fork()
                Task                                Task



        Task            Task           Task                       Task
19                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Fork/Join Framework




20              Copyright © 2012 Akira Koyasu. Some rights reserved.
Fork/Join Framework
      ForkJoinPool pool = new ForkJoinPool();
      Integer r = pool.invoke(new MyTask());
      pool.shutdown();

      static class MyTask extends RecursiveTask<Integer> {
      	   private static final long serialVersionUID = 1L;
      	   @Override
      	   protected Integer compute() {
      	   	   if (size <= SMALL_ENOUGH) {
      	   	   	   return computeDirect();    // 直接処理
      	   	   }
      	   	   MyTask task1 = divideTask();        // 分割
      	   	   MyTask task2 = divideTask();
      	   	   task1.fork();
      	   	   Integer i2 = task2.compute();
      	   	   Integer i1 = task1.join();
      	   	   return combine(i1, i2);             // 統合
      	   }
      }



20                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
ワークスレッドの動き(1)

     WorkThread-1
         processing push            Deque

            task            task   task              task
                      pop

                                                        take(steal)
     WorkThread-2
         processing                 Deque

              task



21                                   Copyright © 2012 Akira Koyasu. Some rights reserved.
ワークスレッドの動き(2)

     ワークスレッドはタスクを各々のDequeに持つ

     fork()したタスクをDequeの先頭にpushする

     join()してタスクの結果を取得する。
     まだ結果が出ていない場合は、Dequeの先頭から
     次のタスクをpopして処理を行う(LIFO)

     Dequeにタスクが無くなった場合、
     他のワークスレッドのDequeの末尾からタスクを
     takeして処理を行う(work-stealing)


22                       Copyright © 2012 Akira Koyasu. Some rights reserved.
Merge Sort

        マージソートを
     Fork/Join Frameworkで
      実装してみましょう




23                           Copyright © 2012 Akira Koyasu. Some rights reserved.
Merge Sort

        マージソートを             2   7   6        4       8       1       3        5
     Fork/Join Frameworkで
      実装してみましょう




23                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
Merge Sort

        マージソートを                 2       7       6        4       8       1       3        5
     Fork/Join Frameworkで
                            2       7       6        4               8       1       3        5
      実装してみましょう




23                                              Copyright © 2012 Akira Koyasu. Some rights reserved.
Merge Sort

        マージソートを                     2       7       6        4       8       1       3        5
     Fork/Join Frameworkで
                                2       7       6        4               8       1       3        5
      実装してみましょう

                            2       7           6        4               8       1            3       5




23                                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
Merge Sort

        マージソートを                     2       7       6        4       8       1       3        5
     Fork/Join Frameworkで
                                2       7       6        4               8       1       3        5
      実装してみましょう

                            2       7           6        4               8       1            3       5


                            2       7           4        6               1       8            3       5




23                                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
Merge Sort

        マージソートを                     2       7       6        4       8       1       3        5
     Fork/Join Frameworkで
                                2       7       6        4               8       1       3        5
      実装してみましょう

                            2       7           6        4               8       1            3       5


                            2       7           4        6               1       8            3       5


                                2       4       6        7               1       3       5        8




23                                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
Merge Sort

        マージソートを                     2       7       6        4       8       1       3        5
     Fork/Join Frameworkで
                                2       7       6        4               8       1       3        5
      実装してみましょう

                            2       7           6        4               8       1            3       5


                            2       7           4        6               1       8            3       5


                                2       4       6        7               1       3       5        8


                                    1       2       3        4       5       6       7        8


23                                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaSE7


     Project Coin
     Fork/Join Framework
     InvokeDynamic
     More New I/O

24                  Copyright © 2012 Akira Koyasu. Some rights reserved.
InvokeDynamic (indy)

        動的型付け言語向けの新たなサポート


     invokedynamic
         新しいJavaバイトコード命令(メソッド呼び出し)



     MethodHandle
         新しいメソッド・リンケージ・メカニズム



25                    Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaSE7


     Project Coin
     Fork/Join Framework
     InvokeDynamic
     More New I/O

26                  Copyright © 2012 Akira Koyasu. Some rights reserved.
More New I/O

     JavaSE1.4で導入されたNIOの積み残し
          NIO.2と呼ばれます




27                Copyright © 2012 Akira Koyasu. Some rights reserved.
More New I/O

     JavaSE1.4で導入されたNIOの積み残し
          NIO.2と呼ばれます


       新しいファイルシステムAPI

       非同期I/O

       ソケットチャネルの機能追加


27                Copyright © 2012 Akira Koyasu. Some rights reserved.
新しいファイルシステムAPI

                java.nio.fileパッケージ以下

                             FileSystem
                             ファイルシステム



                                                              Attribute
       Files                   Path
                                                               View
      ユーティリティ                  ファイル                             メタデータ
                              ディレクトリ
                                リンク

                                                 Watch
               FileVisitor                       Service
                ツリー走査                                監視

28                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Basic Use

     FileSystem fs = FileSystems.getDefault();
     Path path = fs.getPath("/path", "to", "file");

     try (BufferedWriter bw = Files.newBufferedWriter(path,
     	 	 StandardCharsets.UTF_8,
     	 	 StandardOpenOption.CREATE)) {
     	
     	 bw.write("Oh, NIO.2 !!");
     	
     } catch (IOException e) {
     	 e.printStackTrace();
     }




29                                 Copyright © 2012 Akira Koyasu. Some rights reserved.
Files

     Files.createFile(path1);
     Files.createSymbolicLink(link, path1);
     Files.copy(path1, path2,
     	   	   StandardCopyOption.COPY_ATTRIBUTES);
     Files.move(path1, path2,
     	   	   StandardCopyOption.ATOMIC_MOVE);
     byte[] bytes = Files.readAllBytes(path2);


     try (DirectoryStream<Path> ds
                  = Files.newDirectoryStream(dir)) {
     	   for (Path path : ds) {
     	   	   System.out.println(path);
     	   }
     }



30                                Copyright © 2012 Akira Koyasu. Some rights reserved.
AttributeView
     Path path = Paths.get("/path", "to", "file");
     BasicFileAttributeView view
     	   = Files.getFileAttributeView(path, BasicFileAttributeView.class);
     PosixFileAttributeView view2
     	   = Files.getFileAttributeView(path, PosixFileAttributeView.class);
     try {
     	   if (view != null) {
     	   	   BasicFileAttributes attributes = view.readAttributes();
     	   	   System.out.println(attributes.creationTime());
     	   	   System.out.println(attributes.lastModifiedTime());
     	   	   System.out.println(attributes.lastAccessTime());
     	   }
     	   if (view2 != null) {
     	   	   PosixFileAttributes attributes2 = view2.readAttributes();
     	   	   System.out.println(attributes2.owner());
     	   	   System.out.println(attributes2.group());
     	   	   System.out.println(attributes2.permissions());
     	   }
     } catch (IOException e) {
     	   e.printStackTrace();
     }



31                                          Copyright © 2012 Akira Koyasu. Some rights reserved.
FileVisitor

     ディレクトリツリーを深さ優先探索
          Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){
          	   @Override
          	   public FileVisitResult preVisitDirectory(Path dir,
          	   	    	   BasicFileAttributes attrs) throws IOException {
          	   	    System.out.println("preVisitDir: " + dir);
          	   	    return FileVisitResult.CONTINUE;
          	   }
          	   @Override
          	   public FileVisitResult postVisitDirectory(Path dir,
          	   	    	   IOException exc) throws IOException {
          	   	    System.out.println("postVisitDir: " + dir);
          	   	    return FileVisitResult.CONTINUE;
          	   }
          	   @Override
          	   public FileVisitResult visitFile(Path file,
          	   	    	   BasicFileAttributes attrs) throws IOException {
          	   	    System.out.println("visitFile: " + file);
          	   	    return FileVisitResult.CONTINUE;
          	   }
          });


32                      Copyright © 2012 Akira Koyasu. Some rights reserved.
FileVisitor

          ディレクトリツリーを深さ優先探索
                       Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){

     Visitor Pattern   	
                       	
                           @Override
                           public FileVisitResult preVisitDirectory(Path dir,
                       	   	    	   BasicFileAttributes attrs) throws IOException {
                       	   	    System.out.println("preVisitDir: " + dir);
                       	   	    return FileVisitResult.CONTINUE;
                       	   }
                       	   @Override
                       	   public FileVisitResult postVisitDirectory(Path dir,
                       	   	    	   IOException exc) throws IOException {
                       	   	    System.out.println("postVisitDir: " + dir);
                       	   	    return FileVisitResult.CONTINUE;
                       	   }
                       	   @Override
                       	   public FileVisitResult visitFile(Path file,
                       	   	    	   BasicFileAttributes attrs) throws IOException {
                       	   	    System.out.println("visitFile: " + file);
                       	   	    return FileVisitResult.CONTINUE;
                       	   }
                       });


32                                   Copyright © 2012 Akira Koyasu. Some rights reserved.
FileVisitor

          ディレクトリツリーを深さ優先探索
                       Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){

     Visitor Pattern   	
                       	
                           @Override
                           public FileVisitResult preVisitDirectory(Path dir,
                       	   	    	   BasicFileAttributes attrs) throws IOException {
                       	   	    System.out.println("preVisitDir: " + dir);
                       	   	    return FileVisitResult.CONTINUE;
     コールバック            	   }
                       	   @Override
      メソッドを実装          	   public FileVisitResult postVisitDirectory(Path dir,
                       	   	    	   IOException exc) throws IOException {
                       	   	    System.out.println("postVisitDir: " + dir);
                       	   	    return FileVisitResult.CONTINUE;
                       	   }
                       	   @Override
                       	   public FileVisitResult visitFile(Path file,
                       	   	    	   BasicFileAttributes attrs) throws IOException {
                       	   	    System.out.println("visitFile: " + file);
                       	   	    return FileVisitResult.CONTINUE;
                       	   }
                       });


32                                   Copyright © 2012 Akira Koyasu. Some rights reserved.
FileVisitor

           ディレクトリツリーを深さ優先探索
                        Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){

     Visitor Pattern    	
                        	
                            @Override
                            public FileVisitResult preVisitDirectory(Path dir,
                        	   	    	   BasicFileAttributes attrs) throws IOException {
                        	   	    System.out.println("preVisitDir: " + dir);
                        	   	    return FileVisitResult.CONTINUE;
     コールバック             	   }
                        	   @Override
      メソッドを実装           	   public FileVisitResult postVisitDirectory(Path dir,
                        	   	    	   IOException exc) throws IOException {
                        	   	    System.out.println("postVisitDir: " + dir);
     戻り値4種類             	   	    return FileVisitResult.CONTINUE;
                        	   }
       •CONTINUE        	
                        	
                            @Override
                            public FileVisitResult visitFile(Path file,
       •TERMINATE       	   	    	   BasicFileAttributes attrs) throws IOException {
                        	   	    System.out.println("visitFile: " + file);
       •SKIP_SUBTREE    	   	    return FileVisitResult.CONTINUE;
       •SKIP_SIBLINGS   	
                        });
                            }




32                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
WatchService

            監視対象イベントの種類を指定して監視

     WatchService watcher = fs.newWatchService();
     dir.register(watcher,
     	   	   StandardWatchEventKinds.ENTRY_CREATE,
     	   	   StandardWatchEventKinds.ENTRY_MODIFY,
     	   	   StandardWatchEventKinds.ENTRY_DELETE);
     boolean valid;
     do {
     	   WatchKey key = watcher.take();	   // ブロック
     	   for(WatchEvent<?> event : key.pollEvents()) {
     	   	   if (event.kind() == StandardWatchEventKinds.OVERFLOW) {
     	   	   	   System.out.println("overflow!!");
     	   	   } else {
     	   	   	   System.out.println(
     	   	   	   	   	  event.kind() + " : " + event.context());
     	   	   }
     	   }
     	   valid = key.reset();
     } while (valid);



33                                       Copyright © 2012 Akira Koyasu. Some rights reserved.
非同期I/O

          java.nio.channelsパッケージに追加


            AsynchronousChannel

               Future<V> operation(...)
                           or
     void operation(..., CompletionHandler<V, A>)


34                            Copyright © 2012 Akira Koyasu. Some rights reserved.
Puzzle




    Copyright © 2012 Akira Koyasu. Some rights reserved.
Puzzle




36       Copyright © 2012 Akira Koyasu. Some rights reserved.
Puzzle

     次のコードは何を表示しますか?




36           Copyright © 2012 Akira Koyasu. Some rights reserved.
Puzzle

          次のコードは何を表示しますか?


     List<String>[] stringLists = new List<String>[10];
     stringLists[0] = Arrays.asList("first string!");
     Object[] array = stringLists;
     array[0] = Arrays.asList(0);
     System.out.println(stringLists[0].get(0));




36                              Copyright © 2012 Akira Koyasu. Some rights reserved.
Answer


                      コンパイルエラー
          通常、ジェネリック型の配列を生成することはできません。


     仮に1行目の記述が許されるとすれば、5行目
     でClassCastExceptionが発生することにな
                                    List<String>[] stringLists = new List<String>[10];
     り、結果としてジェネリクスの型安全性が損           stringLists[0] = Arrays.asList("first string!");
     なわれるためです。                      Object[] array = stringLists;
                                    array[0] = Arrays.asList(0);
     このように潜在的な危険性を持つジェネリッ
                                    System.out.println(stringLists[0].get(0));
     ク型の配列を生成できてしまうのが、ジェネ
     リック型の可変長引数を持つメソッドです。




37                                       Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaEE6




     Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaEE Roadmap

        2009            2010           2011                2012                    2013

     2009/12/10                                                       2013 Q2


       JavaEE6                                                              JavaEE7
      Extensibility                                                       Provisioning
         Profile                2011/2/28                                    Elasticity
        Pruning                                                           Multi-tenancy
                                  Glassfish                                Orchestration
                                  Server 3.1
                                    Clustering                             Glassfish
      Glassfish v3
      JavaEE6 support
                                                                           Server 4
                                                                        JavaEE7 support

39                                            Copyright © 2012 Akira Koyasu. Some rights reserved.
Themes of JavaEE6
                               (from JSR 316)



     In the past 8 years, the Java EE platform has grown and matured,
        and is now able to cover a wide range of enterprise and web
     application development needs. In addition, the Java EE platform
     has fostered a vibrant community and marketplace for additional
       technologies, frameworks, and applications that work with the
       platform. Some of these provide facilities that are missing from
     the platform. Others provide alternatives to platform facilities. A
        major theme for this release is to embrace and support those
      technologies as part of the overall Java EE landscape, while also
     continuing to simplify the platform to better target a wider range
     of developers. To that end we propose two goals for this release -
                           extensibility and profiles.

40                                        Copyright © 2012 Akira Koyasu. Some rights reserved.
Themes of JavaEE6
          (from JSR 316)




     Simplify
            and

          Embrace
40                   Copyright © 2012 Akira Koyasu. Some rights reserved.
What’s New in JavaEE6


     Servlet 3.0        CDI/DI
     JSF 2.0 / EL 2.2   Interceptors 1.1
     EJB 3.1 (+Lite)    Bean Validation
     Managed Beans      JAX-RS 2.1

41                      Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaEE6


     Simplified Packaging
     ManagedBean
     CDI
     Sample

42                 Copyright © 2012 Akira Koyasu. Some rights reserved.
Simplified Packaging




43              Copyright © 2012 Akira Koyasu. Some rights reserved.
Simplified Packaging

        javaee5.war
     WEB-INF/classes/
      MyServlet.class
      MyFilter.class
     WEB-INF/lib/
      someFramework.jar
     WEB-INF/
      web.xml
     index.html
     css/style.css
     js/jquery.js
     js/plugin/jplugin.js



43                          Copyright © 2012 Akira Koyasu. Some rights reserved.
Simplified Packaging

        javaee5.war                    javaee6.war
     WEB-INF/classes/            WEB-INF/classes/
      MyServlet.class             MyServlet.class
      MyFilter.class              MyFilter.class
     WEB-INF/lib/                WEB-INF/lib/
      someFramework.jar           someFramework.jar
                                  someResource.jar
     WEB-INF/
      web.xml
     index.html                  index.html
     css/style.css               css/style.css
     js/jquery.js
     js/plugin/jplugin.js



43                          Copyright © 2012 Akira Koyasu. Some rights reserved.
javax.servlet.annotation




44                Copyright © 2012 Akira Koyasu. Some rights reserved.
javax.servlet.annotation

                   @WebServlet(name="MyServlet",
                             urlPatterns="/myServlet")
     @WebServlet   public class MyServlet extends HttpServlet {
                   	 // ...
                   }




44                            Copyright © 2012 Akira Koyasu. Some rights reserved.
javax.servlet.annotation

                   @WebServlet(name="MyServlet",
                             urlPatterns="/myServlet")
     @WebServlet   public class MyServlet extends HttpServlet {
                   	 // ...
                   }


                   @WebFilter(filterName="MyFilter",
                             urlPatterns="/*")
     @WebFilter    public class MyFilter implements Filter {
                   	 // ...
                   }




44                            Copyright © 2012 Akira Koyasu. Some rights reserved.
javax.servlet.annotation

                    @WebServlet(name="MyServlet",
                              urlPatterns="/myServlet")
     @WebServlet    public class MyServlet extends HttpServlet {
                    	 // ...
                    }


                    @WebFilter(filterName="MyFilter",
                              urlPatterns="/*")
     @WebFilter     public class MyFilter implements Filter {
                    	 // ...
                    }


                    @WebListener
                    public class MyListener
     @WebListener          implements ServletContextListener {
                    	 // ...
                    }



44                             Copyright © 2012 Akira Koyasu. Some rights reserved.
web-fragment.xml

     someFramework.jar   com/fw/SomeFWServlet.class
                         com/fw/SomeFWFilter.class
                         META-INF/web-fragment.xml




45                          Copyright © 2012 Akira Koyasu. Some rights reserved.
web-fragment.xml

     someFramework.jar                     com/fw/SomeFWServlet.class
                                           com/fw/SomeFWFilter.class
                                           META-INF/web-fragment.xml

     web-fragment.xml
         <?xml version="1.0" encoding="UTF-8"?>
         <web-fragment xmlns="http://java.sun.com/xml/ns/javaee"
         	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         	   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                       http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
         	   version="3.0">

         	   <!-- servlet -->
         	   <!-- filter -->
         	   <!-- ... -->

         </web-fragment>


45                                              Copyright © 2012 Akira Koyasu. Some rights reserved.
Resource Jar

     app.war
     WEB-INF/lib/
      someResource.jar           http://serv.com:8080/app/
         META-INF/resources/              js/jquery.js
          js/jquery.js                    js/plugin/jplugin.js
          js/plugin/jplugin.js            css/jplugin.css
          css/jplugin.css                 images/jplugin.png
          images/jplugin.png




46                                  Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaEE6


     Simplified Packaging
     ManagedBean
     CDI
     Sample

47               Copyright © 2012 Akira Koyasu. Some rights reserved.
ManagedBean




      photo.3




48              Copyright © 2012 Akira Koyasu. Some rights reserved.
ManagedBean


     Plain Java Objects




        photo.3




48                Copyright © 2012 Akira Koyasu. Some rights reserved.
ManagedBean


       Plain Java Objects
     Lifecycle managed by container




            photo.3




48                    Copyright © 2012 Akira Koyasu. Some rights reserved.
ManagedBean


       Plain Java Objects
     Lifecycle managed by container

                      @ManagedBean
                          (javax.annotation)



            photo.3




48                        Copyright © 2012 Akira Koyasu. Some rights reserved.
Lifecycle




49         Copyright © 2012 Akira Koyasu. Some rights reserved.
Lifecycle



        Scope
     (javax.enterprise.context)




49                                 Copyright © 2012 Akira Koyasu. Some rights reserved.
Lifecycle

                                  @ApplicationScoped
                                  @SessionScoped
        Scope                     @ConversationScoped
     (javax.enterprise.context)

                                  @RequestScoped




49                                       Copyright © 2012 Akira Koyasu. Some rights reserved.
Lifecycle

                                  @ApplicationScoped
                                  @SessionScoped
        Scope                     @ConversationScoped
     (javax.enterprise.context)

                                  @RequestScoped



        Callbacks
        (javax.annotation)




49                                       Copyright © 2012 Akira Koyasu. Some rights reserved.
Lifecycle

                                  @ApplicationScoped
                                  @SessionScoped
        Scope                     @ConversationScoped
     (javax.enterprise.context)

                                  @RequestScoped


                                  @PostConstruct
        Callbacks                 @PreDestroy
        (javax.annotation)




49                                       Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaEE6


     Simplified Packaging
     ManagedBean
     CDI
     Sample

50                 Copyright © 2012 Akira Koyasu. Some rights reserved.
CDI




51     Copyright © 2012 Akira Koyasu. Some rights reserved.
CDI


     Context and Dependency
             Injection




51               Copyright © 2012 Akira Koyasu. Some rights reserved.
CDI


     Context and Dependency
             Injection

             @Inject
               (javax.annotation)




51                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Injection Points




52            Copyright © 2012 Akira Koyasu. Some rights reserved.
Injection Points

     Field         @Inject
                   private MyService myService;
       Injection




52                          Copyright © 2012 Akira Koyasu. Some rights reserved.
Injection Points

     Field         @Inject
                   private MyService myService;
       Injection

                   @Inject
     Constructor   private MyBean(MyService myService) {
                   	 // ...
       Injection   }




52                          Copyright © 2012 Akira Koyasu. Some rights reserved.
Injection Points

     Field         @Inject
                   private MyService myService;
       Injection

                   @Inject
     Constructor   private MyBean(MyService myService) {
                   	 // ...
       Injection   }


                   @Inject
     Parameter     void init(MyService myService) {
                   	 // ...
       Injection   }


52                          Copyright © 2012 Akira Koyasu. Some rights reserved.
javax.enterprise.inject.
            Produces

               Factory Method
           provides Injection Object

     public class Factory {
     	 @Produces
     	 public static ComplexObject getInstance() {
     	 	 return new ComplexObject("prop1", "prop2");
     	 }
     }



53                              Copyright © 2012 Akira Koyasu. Some rights reserved.
javax.inject.Qualifier

     @Qualifier
     @Retention(RetentionPolicy.RUNTIME)
     public @interface MyQualifier {
     }

                                                              SomeInterface
     @MyQualifier
     public class OneImpl
             implements SomeInterface {
     	 // ...
     }
                                                  OneImpl                    AnotherImpl



     @Inject @MyQualifier
     private SomeInterface some;




54                                         Copyright © 2012 Akira Koyasu. Some rights reserved.
JavaEE6


     Simplified Packaging
     ManagedBean
     CDI
     Sample

55                 Copyright © 2012 Akira Koyasu. Some rights reserved.
index.xhtml




56          Copyright © 2012 Akira Koyasu. Some rights reserved.
index.xhtml

     <?xml version="1.0" encoding="UTF-8" ?>
     <!DOCTYPE html>
     <html xmlns:h="http://java.sun.com/jsf/html">
     <head>
       <title>Greeting</title>
     </head>
     <h:body>
       #{myBean.greeting}
     </h:body>
     </html>



56                            Copyright © 2012 Akira Koyasu. Some rights reserved.
MyBean.java




57         Copyright © 2012 Akira Koyasu. Some rights reserved.
MyBean.java

     @Named
     public class MyBean {
     	 @Inject
     	 private MyService myService;

     	 public String getGreeting() {
     	 	 return myService.getGreeting();
     	 }
     }


57                       Copyright © 2012 Akira Koyasu. Some rights reserved.
MyService.java




58           Copyright © 2012 Akira Koyasu. Some rights reserved.
MyService.java


     @ManagedBean
     public class MyService {
     	 public String getGreeting() {
     	 	 return "Hello JavaEE6!!";
     	 }
     }



58                     Copyright © 2012 Akira Koyasu. Some rights reserved.
beans.xml




59         Copyright © 2012 Akira Koyasu. Some rights reserved.
beans.xml




       (empty)




59           Copyright © 2012 Akira Koyasu. Some rights reserved.
faces-config.xml




60            Copyright © 2012 Akira Koyasu. Some rights reserved.
faces-config.xml




          (empty)




60              Copyright © 2012 Akira Koyasu. Some rights reserved.
Packaging

     app.war
     	 	 	 	 `---WEB-INF/
     	 	 	 	 	 	 	 	 	 	 	 	 `---classes/
     	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 `---MyBean.class
     	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 `---MyService.class
     	 	 	 	 	 	 	 	 	 	 	 	 `---beans.xml
     	 	 	 	 	 	 	 	 	 	 	 	 `---faces-config.xml
     	 	 	 	 `---index.xhtml


61                                    Copyright © 2012 Akira Koyasu. Some rights reserved.
Deploy




62       Copyright © 2012 Akira Koyasu. Some rights reserved.
Deploy
     $ asadmin deploy /path/to/app.war




62                             Copyright © 2012 Akira Koyasu. Some rights reserved.
Deploy
     $ asadmin deploy /path/to/app.war
     appという名前のアプリケーションがデプロイされました。
     コマンドdeployは正常に実行されました。




62                      Copyright © 2012 Akira Koyasu. Some rights reserved.
Deploy
     $ asadmin deploy /path/to/app.war
     appという名前のアプリケーションがデプロイされました。
     コマンドdeployは正常に実行されました。

     $ curl "http://localhost:8080/app/index.jsf"




62                               Copyright © 2012 Akira Koyasu. Some rights reserved.
Deploy
     $ asadmin deploy /path/to/app.war
     appという名前のアプリケーションがデプロイされました。
     コマンドdeployは正常に実行されました。

     $ curl "http://localhost:8080/app/index.jsf"
     <?xml version="1.0" encoding="UTF-8" ?>
     <!DOCTYPE html>
     <html>
     <head>
      <title>Greeting</title>
     </head><body>
      Hello JavaEE6!!
     </body>
     </html>

62                               Copyright © 2012 Akira Koyasu. Some rights reserved.
Conclusion




      Copyright © 2012 Akira Koyasu. Some rights reserved.
Conclusion


     InvokeDynamic           Fork/Join Framework
                 Servlet 3.0 EJB 3.0 (+Lite)
           More New I/O
       G1GC                CDI/DI      Project Coin
           Bean Validation
                                       JAX-RS
                     Managed Bean



64                             Copyright © 2012 Akira Koyasu. Some rights reserved.
Conclusion

     InvokeDynamic           Fork/Join Framework
                  Servlet 3.0 EJB 3.0 (+Lite)
            More New I/O


      Your Java, Update now!!
       G1GC                CDI/DI                    Project Coin
           Bean Validation
                                                    JAX-RS
                      Managed Bean
64                              Copyright © 2012 Akira Koyasu. Some rights reserved.
Notes

     This work is licensed under the Creative Commons
     Attribution-NonCommercial 3.0 Unported License. To view
     a copy of this license, visit http://creativecommons.org/
     licenses/by-nc/3.0/.


     photo.1
             http://www.flickr.com/photos/brockli/475833924/
      from

     photo.2
             http://www.flickr.com/photos/29487767@N02/2866453076/
      from

     photo.3
             http://www.flickr.com/photos/amanda28192/6216031916/
      from

65                                      Copyright © 2012 Akira Koyasu. Some rights reserved.

Weitere ähnliche Inhalte

Ähnlich wie Java, Up to Date

The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGThe Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGArun Gupta
 
Enterprise Java in 2012 and Beyond, by Juergen Hoeller
Enterprise Java in 2012 and Beyond, by Juergen Hoeller Enterprise Java in 2012 and Beyond, by Juergen Hoeller
Enterprise Java in 2012 and Beyond, by Juergen Hoeller Codemotion
 
Java History - MyExamCloud Presentation
Java History - MyExamCloud PresentationJava History - MyExamCloud Presentation
Java History - MyExamCloud PresentationGanesh P
 
Backbone testing
Backbone testingBackbone testing
Backbone testingCrashlytics
 
What's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - WeaverWhat's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - WeaverCodemotion
 
Hello, Guava !
Hello, Guava !Hello, Guava !
Hello, Guava !輝 子安
 
The latest features coming to Java 12
The latest features coming to Java 12The latest features coming to Java 12
The latest features coming to Java 12NexSoftsys
 
Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)Logico
 
Java 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaJava 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaManjula Kollipara
 
Java EE7
Java EE7Java EE7
Java EE7Jay Lee
 
What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6Gal Marder
 
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...Edureka!
 
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB
 
Compile ahead of time. It's fine?
Compile ahead of time. It's fine?Compile ahead of time. It's fine?
Compile ahead of time. It's fine?Dmitry Chuyko
 
How Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentHow Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentBruno Borges
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Hirofumi Iwasaki
 
Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)Nati Shalom
 
Cloud Native 자바 플랫폼: Graalvm Overview
Cloud Native 자바 플랫폼: Graalvm OverviewCloud Native 자바 플랫폼: Graalvm Overview
Cloud Native 자바 플랫폼: Graalvm OverviewOracle Korea
 

Ähnlich wie Java, Up to Date (20)

The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUGThe Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
The Java EE 7 Platform: Productivity &amp; HTML5 at San Francisco JUG
 
Enterprise Java in 2012 and Beyond, by Juergen Hoeller
Enterprise Java in 2012 and Beyond, by Juergen Hoeller Enterprise Java in 2012 and Beyond, by Juergen Hoeller
Enterprise Java in 2012 and Beyond, by Juergen Hoeller
 
Java History - MyExamCloud Presentation
Java History - MyExamCloud PresentationJava History - MyExamCloud Presentation
Java History - MyExamCloud Presentation
 
Backbone testing
Backbone testingBackbone testing
Backbone testing
 
What's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - WeaverWhat's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - Weaver
 
Hello, Guava !
Hello, Guava !Hello, Guava !
Hello, Guava !
 
The latest features coming to Java 12
The latest features coming to Java 12The latest features coming to Java 12
The latest features coming to Java 12
 
Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)Java EE 8 Overview (Japanese)
Java EE 8 Overview (Japanese)
 
Java 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kolliparaJava 7 Dolphin manjula kollipara
Java 7 Dolphin manjula kollipara
 
Java EE7
Java EE7Java EE7
Java EE7
 
What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
 
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...
Java 9 New Features | Java Tutorial | What’s New in Java 9 | Java 9 Features ...
 
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011MongoDB for Java Devs with Spring Data - MongoPhilly 2011
MongoDB for Java Devs with Spring Data - MongoPhilly 2011
 
Compile ahead of time. It's fine?
Compile ahead of time. It's fine?Compile ahead of time. It's fine?
Compile ahead of time. It's fine?
 
How Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web DevelopmentHow Scala, Wicket, and Java EE Can Improve Web Development
How Scala, Wicket, and Java EE Can Improve Web Development
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
 
Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)Making cloud portability a practical reality (i pad)
Making cloud portability a practical reality (i pad)
 
Java7
Java7Java7
Java7
 
Cloud Native Java:GraalVM
Cloud Native Java:GraalVMCloud Native Java:GraalVM
Cloud Native Java:GraalVM
 
Cloud Native 자바 플랫폼: Graalvm Overview
Cloud Native 자바 플랫폼: Graalvm OverviewCloud Native 자바 플랫폼: Graalvm Overview
Cloud Native 자바 플랫폼: Graalvm Overview
 

Mehr von 輝 子安

Protractor under the hood
Protractor under the hoodProtractor under the hood
Protractor under the hood輝 子安
 
そろそろLambda(CI/CD編)
そろそろLambda(CI/CD編)そろそろLambda(CI/CD編)
そろそろLambda(CI/CD編)輝 子安
 
Dockerで構成するWebサービス 〜EmotionTechの場合〜
Dockerで構成するWebサービス 〜EmotionTechの場合〜Dockerで構成するWebサービス 〜EmotionTechの場合〜
Dockerで構成するWebサービス 〜EmotionTechの場合〜輝 子安
 
Workshop: Docker on Elastic Beanstalk
Workshop: Docker on Elastic BeanstalkWorkshop: Docker on Elastic Beanstalk
Workshop: Docker on Elastic Beanstalk輝 子安
 
PHP conference 2013 ja report
PHP conference 2013 ja reportPHP conference 2013 ja report
PHP conference 2013 ja report輝 子安
 
JavaOne Guide for the Petite Bourgeoisie
JavaOne Guide for the Petite BourgeoisieJavaOne Guide for the Petite Bourgeoisie
JavaOne Guide for the Petite Bourgeoisie輝 子安
 
Java, Up to Date Sources
Java, Up to Date SourcesJava, Up to Date Sources
Java, Up to Date Sources輝 子安
 
Hello, Guava ! samples
Hello, Guava ! samplesHello, Guava ! samples
Hello, Guava ! samples輝 子安
 
Tokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo TyrantTokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo Tyrant輝 子安
 

Mehr von 輝 子安 (9)

Protractor under the hood
Protractor under the hoodProtractor under the hood
Protractor under the hood
 
そろそろLambda(CI/CD編)
そろそろLambda(CI/CD編)そろそろLambda(CI/CD編)
そろそろLambda(CI/CD編)
 
Dockerで構成するWebサービス 〜EmotionTechの場合〜
Dockerで構成するWebサービス 〜EmotionTechの場合〜Dockerで構成するWebサービス 〜EmotionTechの場合〜
Dockerで構成するWebサービス 〜EmotionTechの場合〜
 
Workshop: Docker on Elastic Beanstalk
Workshop: Docker on Elastic BeanstalkWorkshop: Docker on Elastic Beanstalk
Workshop: Docker on Elastic Beanstalk
 
PHP conference 2013 ja report
PHP conference 2013 ja reportPHP conference 2013 ja report
PHP conference 2013 ja report
 
JavaOne Guide for the Petite Bourgeoisie
JavaOne Guide for the Petite BourgeoisieJavaOne Guide for the Petite Bourgeoisie
JavaOne Guide for the Petite Bourgeoisie
 
Java, Up to Date Sources
Java, Up to Date SourcesJava, Up to Date Sources
Java, Up to Date Sources
 
Hello, Guava ! samples
Hello, Guava ! samplesHello, Guava ! samples
Hello, Guava ! samples
 
Tokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo TyrantTokyo Cabinet & Tokyo Tyrant
Tokyo Cabinet & Tokyo Tyrant
 

Kürzlich hochgeladen

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Kürzlich hochgeladen (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

Java, Up to Date

  • 1. JAVA, UP TO DATE JavaSE7 & JavaEE6 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 2. JavaOne Tokyo 2012 April 4-5 2 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 3. JavaOne Tokyo 2012 April 4-5 2 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 4. 今使える、Javaの最新技術 3 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 5. 今使える、Javaの最新技術 JavaSE7 Project Coin Fork/Join Framework InvokeDynamic More New I/O 3 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 6. 今使える、Javaの最新技術 JavaSE7 JavaEE6 Project Coin Simplified Packaging Fork/Join Framework ManagedBean InvokeDynamic CDI More New I/O 3 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 7. JavaSE7 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 8. JavaSE Roadmap 2011 2012 2013 2011/7/28 2012 later 2013 Summer JavaSE7 JavaSE7u6 JavaSE8 JRE for MacOSX Jigsaw 2012/4/27 Auto-update Lambda JavaFX3.0 JavaSE7u4 HotRockit JDK for MacOSX Nashorn JavaFX2.1 2012/11 G1GC JRE default JavaSE6 Last public update 5 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 9. Themes of JavaSE7 (from JSR 336) 6 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 10. Themes of JavaSE7 (from JSR 336) Compatiblity 6 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 11. Themes of JavaSE7 (from JSR 336) Compatiblity Productivity Universality Performance Integration 6 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 12. JavaSE7 Project Coin Fork/Join Framework InvokeDynamic More New I/O 7 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 13. Project Coin 言語仕様の小さな変更 photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 14. Project Coin 言語仕様の小さな変更 Small Change = Coin photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 15. Project Coin 言語仕様の小さな変更 Small Change = Coin Strings in switch photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 16. Project Coin 言語仕様の小さな変更 Small Change = Coin Strings in switch Numeric literal improvements photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 17. Project Coin 言語仕様の小さな変更 Small Change = Coin Strings in switch Numeric literal improvements Multi-catch with more precise rethrow photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 18. Project Coin 言語仕様の小さな変更 Small Change = Coin Strings in switch Numeric literal improvements Multi-catch with more precise rethrow try-with-resources photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 19. Project Coin 言語仕様の小さな変更 Small Change = Coin Strings in switch Numeric literal improvements Multi-catch with more precise rethrow try-with-resources Diamond photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 20. Project Coin 言語仕様の小さな変更 Small Change = Coin Strings in switch Numeric literal improvements Multi-catch with more precise rethrow try-with-resources Diamond Safe varargs photo.1 8 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 21. Strings in switch 9 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 22. Strings in switch String flag = "aaa"; switch (flag) { case "aaa": System.out.println("aaa"); break; case "bbb": System.out.println("bbb"); break; case "ccc": System.out.println("ccc"); break; } 9 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 23. Strings in switch String flag = "aaa"; コンパイル時に switch (flag) { hashCode()などを case "aaa": System.out.println("aaa"); 使用した比較に break; case "bbb": 書き換えられる System.out.println("bbb"); break; case "ccc": System.out.println("ccc"); break; } 9 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 24. Strings in switch String flag = "aaa"; コンパイル時に switch (flag) { hashCode()などを case "aaa": System.out.println("aaa"); 使用した比較に break; case "bbb": 書き換えられる System.out.println("bbb"); break; case "ccc": System.out.println("ccc"); break; } nullに注意 9 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 25. Numeric literal improvements 10 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 26. Numeric literal improvements Binary literals int b = 0b1110; // binary (new!) int o = 016; // octal int d = 14; // decimal int x = 0xE; // hexadecimal 10 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 27. Numeric literal improvements Binary literals int b = 0b1110; // binary (new!) int o = 016; // octal int d = 14; // decimal int x = 0xE; // hexadecimal Underscores in numeric literals int m = 1_000_000; 10 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 28. Multi-catch with more precise rethrow 11 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 29. Multi-catch with more precise rethrow try { “|”で複数の例外を foo(); // throws Exception1, Exception2 } catch (Exception1 | Exception2 e) { catch } e.printStackTrace(); 11 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 30. Multi-catch with more precise rethrow try { “|”で複数の例外を foo(); // throws Exception1, Exception2 } catch (Exception1 | Exception2 e) { catch } e.printStackTrace(); スーパータイプでcatch → 実際のサブタイプでthrows宣言可能 void callBar() throws SubException1, SubException2 { try { bar(); // throws SubException1, SubException2 } catch (SuperException e) { throw e; } } 11 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 31. try-with-resources 12 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 32. try-with-resources tryに続けて宣言したリソースが 自動的にclose()される 12 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 33. try-with-resources tryに続けて宣言したリソースが 自動的にclose()される try (Writer writer = new FileWriter(file)) { writer.write("hello!!"); } catch (IOException e) { e.printStackTrace(); } 12 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 34. try-with-resources tryに続けて宣言したリソースが 自動的にclose()される try (Writer writer = new FileWriter(file)) { writer.write("hello!!"); } catch (IOException e) { e.printStackTrace(); } java.lang.AutoCloseable / java.io.Closeable “;”で複数リソースを宣言可 12 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 35. Diamond 13 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 36. Diamond 型推論により、 コンストラクタの ジェネリクスパラメータを省略可能 Map<String, List<Integer>> map = new HashMap<>(); 13 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 37. Diamond 型推論により、 コンストラクタの ジェネリクスパラメータを省略可能 Map<String, List<Integer>> map = new HashMap<>(); 省略できないケース // 匿名クラス List<String> list = new ArrayList<>(){}; void call() { doSomething(new ArrayList<>()); // メソッド呼び出し } 13 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 38. Safe Varargs (1) 14 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 39. Safe Varargs (1) ジェネリック型の可変長引数をもつメソッド static void pol(List<String>... strLists) { // ... } 14 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 40. Safe Varargs (1) ジェネリック型の可変長引数をもつメソッド static void pol(List<String>... strLists) { // ... } 呼び出し側に警告(今まで通り) List<String> b = ... List<String> s = ... // WARNING: Type safety: A generic array of List<String> // is created for a varargs parameter pol(b, s); 14 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 41. Safe Varargs (1) ジェネリック型の可変長引数をもつメソッド static void pol(List<String>... strLists) { // ... } 加えて定義側にも警告が出るように // WARNING: Type safety: Potential heap pollution // via varargs parameter strLists static void pol(List<String>... strLists) { // ... } 14 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 42. Safe Varargs (2) 15 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 43. Safe Varargs (2) @SafeVarargs このメソッドは安全であるという表明 @SafeVarargs static void notpol(List<String>... strLists) { // ... } 15 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 44. Safe Varargs (2) @SafeVarargs このメソッドは安全であるという表明 @SafeVarargs static void notpol(List<String>... strLists) { // ... } 呼び出し側の警告も抑制される List<String> b = ... List<String> s = ... notpol(b, s); 15 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 45. JavaSE7 Project Coin Fork/Join Framework InvokeDynamic More New I/O 16 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 46. Fork/Join Framework photo.2 17 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 47. Fork/Join Framework 並列処理のためのフレームワーク photo.2 17 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 48. Fork/Join Framework 並列処理のためのフレームワーク ? photo.2 17 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 49. Concurrency Utilities 18 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 50. Concurrency Utilities java.util.concurrent.ExecutorService (since: JavaSE5) 18 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 51. Concurrency Utilities java.util.concurrent.ExecutorService (since: JavaSE5) ExecutorService executor = Executors.newCachedThreadPool(); executor.submit(new Runnable() { @Override public void run() { // ... } }); executor.shutdown(); 18 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 52. Concurrency Utilities java.util.concurrent.ExecutorService (since: JavaSE5) ExecutorService executor = Executors.newCachedThreadPool(); executor.submit(new Runnable() { @Override public void run() { // ... } }); executor.shutdown(); 1つのタスクの粒度が大きい 18 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 53. 分割統治法 (Divide and Conquer Algorithm) 19 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 54. 分割統治法 (Divide and Conquer Algorithm) (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク Task 19 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 55. 分割統治法 (Divide and Conquer Algorithm) (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク Task fork() Task Task 19 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 56. 分割統治法 (Divide and Conquer Algorithm) (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク Task fork() Task Task Task Task Task Task 19 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 57. 分割統治法 (Divide and Conquer Algorithm) (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク Task fork() Task Task Task Task Task Task 19 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 58. 分割統治法 (Divide and Conquer Algorithm) (再帰的に)小さなタスクへ分割して並列に処理できるようなタスク Task join() fork() Task Task Task Task Task Task 19 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 59. Fork/Join Framework 20 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 60. Fork/Join Framework ForkJoinPool pool = new ForkJoinPool(); Integer r = pool.invoke(new MyTask()); pool.shutdown(); static class MyTask extends RecursiveTask<Integer> { private static final long serialVersionUID = 1L; @Override protected Integer compute() { if (size <= SMALL_ENOUGH) { return computeDirect(); // 直接処理 } MyTask task1 = divideTask(); // 分割 MyTask task2 = divideTask(); task1.fork(); Integer i2 = task2.compute(); Integer i1 = task1.join(); return combine(i1, i2); // 統合 } } 20 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 61. ワークスレッドの動き(1) WorkThread-1 processing push Deque task task task task pop take(steal) WorkThread-2 processing Deque task 21 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 62. ワークスレッドの動き(2) ワークスレッドはタスクを各々のDequeに持つ fork()したタスクをDequeの先頭にpushする join()してタスクの結果を取得する。 まだ結果が出ていない場合は、Dequeの先頭から 次のタスクをpopして処理を行う(LIFO) Dequeにタスクが無くなった場合、 他のワークスレッドのDequeの末尾からタスクを takeして処理を行う(work-stealing) 22 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 63. Merge Sort マージソートを Fork/Join Frameworkで 実装してみましょう 23 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 64. Merge Sort マージソートを 2 7 6 4 8 1 3 5 Fork/Join Frameworkで 実装してみましょう 23 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 65. Merge Sort マージソートを 2 7 6 4 8 1 3 5 Fork/Join Frameworkで 2 7 6 4 8 1 3 5 実装してみましょう 23 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 66. Merge Sort マージソートを 2 7 6 4 8 1 3 5 Fork/Join Frameworkで 2 7 6 4 8 1 3 5 実装してみましょう 2 7 6 4 8 1 3 5 23 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 67. Merge Sort マージソートを 2 7 6 4 8 1 3 5 Fork/Join Frameworkで 2 7 6 4 8 1 3 5 実装してみましょう 2 7 6 4 8 1 3 5 2 7 4 6 1 8 3 5 23 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 68. Merge Sort マージソートを 2 7 6 4 8 1 3 5 Fork/Join Frameworkで 2 7 6 4 8 1 3 5 実装してみましょう 2 7 6 4 8 1 3 5 2 7 4 6 1 8 3 5 2 4 6 7 1 3 5 8 23 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 69. Merge Sort マージソートを 2 7 6 4 8 1 3 5 Fork/Join Frameworkで 2 7 6 4 8 1 3 5 実装してみましょう 2 7 6 4 8 1 3 5 2 7 4 6 1 8 3 5 2 4 6 7 1 3 5 8 1 2 3 4 5 6 7 8 23 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 70. JavaSE7 Project Coin Fork/Join Framework InvokeDynamic More New I/O 24 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 71. InvokeDynamic (indy) 動的型付け言語向けの新たなサポート invokedynamic 新しいJavaバイトコード命令(メソッド呼び出し) MethodHandle 新しいメソッド・リンケージ・メカニズム 25 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 72. JavaSE7 Project Coin Fork/Join Framework InvokeDynamic More New I/O 26 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 73. More New I/O JavaSE1.4で導入されたNIOの積み残し NIO.2と呼ばれます 27 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 74. More New I/O JavaSE1.4で導入されたNIOの積み残し NIO.2と呼ばれます 新しいファイルシステムAPI 非同期I/O ソケットチャネルの機能追加 27 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 75. 新しいファイルシステムAPI java.nio.fileパッケージ以下 FileSystem ファイルシステム Attribute Files Path View ユーティリティ ファイル メタデータ ディレクトリ リンク Watch FileVisitor Service ツリー走査 監視 28 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 76. Basic Use FileSystem fs = FileSystems.getDefault(); Path path = fs.getPath("/path", "to", "file"); try (BufferedWriter bw = Files.newBufferedWriter(path, StandardCharsets.UTF_8, StandardOpenOption.CREATE)) { bw.write("Oh, NIO.2 !!"); } catch (IOException e) { e.printStackTrace(); } 29 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 77. Files Files.createFile(path1); Files.createSymbolicLink(link, path1); Files.copy(path1, path2, StandardCopyOption.COPY_ATTRIBUTES); Files.move(path1, path2, StandardCopyOption.ATOMIC_MOVE); byte[] bytes = Files.readAllBytes(path2); try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir)) { for (Path path : ds) { System.out.println(path); } } 30 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 78. AttributeView Path path = Paths.get("/path", "to", "file"); BasicFileAttributeView view = Files.getFileAttributeView(path, BasicFileAttributeView.class); PosixFileAttributeView view2 = Files.getFileAttributeView(path, PosixFileAttributeView.class); try { if (view != null) { BasicFileAttributes attributes = view.readAttributes(); System.out.println(attributes.creationTime()); System.out.println(attributes.lastModifiedTime()); System.out.println(attributes.lastAccessTime()); } if (view2 != null) { PosixFileAttributes attributes2 = view2.readAttributes(); System.out.println(attributes2.owner()); System.out.println(attributes2.group()); System.out.println(attributes2.permissions()); } } catch (IOException e) { e.printStackTrace(); } 31 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 79. FileVisitor ディレクトリツリーを深さ優先探索 Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){ @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { System.out.println("preVisitDir: " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { System.out.println("postVisitDir: " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println("visitFile: " + file); return FileVisitResult.CONTINUE; } }); 32 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 80. FileVisitor ディレクトリツリーを深さ優先探索 Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){ Visitor Pattern @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { System.out.println("preVisitDir: " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { System.out.println("postVisitDir: " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println("visitFile: " + file); return FileVisitResult.CONTINUE; } }); 32 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 81. FileVisitor ディレクトリツリーを深さ優先探索 Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){ Visitor Pattern @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { System.out.println("preVisitDir: " + dir); return FileVisitResult.CONTINUE; コールバック } @Override メソッドを実装 public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { System.out.println("postVisitDir: " + dir); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println("visitFile: " + file); return FileVisitResult.CONTINUE; } }); 32 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 82. FileVisitor ディレクトリツリーを深さ優先探索 Files.walkFileTree(dir, new SimpleFileVisitor<Path>(){ Visitor Pattern @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { System.out.println("preVisitDir: " + dir); return FileVisitResult.CONTINUE; コールバック } @Override メソッドを実装 public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { System.out.println("postVisitDir: " + dir); 戻り値4種類 return FileVisitResult.CONTINUE; } •CONTINUE @Override public FileVisitResult visitFile(Path file, •TERMINATE BasicFileAttributes attrs) throws IOException { System.out.println("visitFile: " + file); •SKIP_SUBTREE return FileVisitResult.CONTINUE; •SKIP_SIBLINGS }); } 32 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 83. WatchService 監視対象イベントの種類を指定して監視 WatchService watcher = fs.newWatchService(); dir.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE); boolean valid; do { WatchKey key = watcher.take(); // ブロック for(WatchEvent<?> event : key.pollEvents()) { if (event.kind() == StandardWatchEventKinds.OVERFLOW) { System.out.println("overflow!!"); } else { System.out.println( event.kind() + " : " + event.context()); } } valid = key.reset(); } while (valid); 33 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 84. 非同期I/O java.nio.channelsパッケージに追加 AsynchronousChannel Future<V> operation(...) or void operation(..., CompletionHandler<V, A>) 34 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 85. Puzzle Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 86. Puzzle 36 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 87. Puzzle 次のコードは何を表示しますか? 36 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 88. Puzzle 次のコードは何を表示しますか? List<String>[] stringLists = new List<String>[10]; stringLists[0] = Arrays.asList("first string!"); Object[] array = stringLists; array[0] = Arrays.asList(0); System.out.println(stringLists[0].get(0)); 36 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 89. Answer コンパイルエラー 通常、ジェネリック型の配列を生成することはできません。 仮に1行目の記述が許されるとすれば、5行目 でClassCastExceptionが発生することにな List<String>[] stringLists = new List<String>[10]; り、結果としてジェネリクスの型安全性が損 stringLists[0] = Arrays.asList("first string!"); なわれるためです。 Object[] array = stringLists; array[0] = Arrays.asList(0); このように潜在的な危険性を持つジェネリッ System.out.println(stringLists[0].get(0)); ク型の配列を生成できてしまうのが、ジェネ リック型の可変長引数を持つメソッドです。 37 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 90. JavaEE6 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 91. JavaEE Roadmap 2009 2010 2011 2012 2013 2009/12/10 2013 Q2 JavaEE6 JavaEE7 Extensibility Provisioning Profile 2011/2/28 Elasticity Pruning Multi-tenancy Glassfish Orchestration Server 3.1 Clustering Glassfish Glassfish v3 JavaEE6 support Server 4 JavaEE7 support 39 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 92. Themes of JavaEE6 (from JSR 316) In the past 8 years, the Java EE platform has grown and matured, and is now able to cover a wide range of enterprise and web application development needs. In addition, the Java EE platform has fostered a vibrant community and marketplace for additional technologies, frameworks, and applications that work with the platform. Some of these provide facilities that are missing from the platform. Others provide alternatives to platform facilities. A major theme for this release is to embrace and support those technologies as part of the overall Java EE landscape, while also continuing to simplify the platform to better target a wider range of developers. To that end we propose two goals for this release - extensibility and profiles. 40 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 93. Themes of JavaEE6 (from JSR 316) Simplify and Embrace 40 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 94. What’s New in JavaEE6 Servlet 3.0 CDI/DI JSF 2.0 / EL 2.2 Interceptors 1.1 EJB 3.1 (+Lite) Bean Validation Managed Beans JAX-RS 2.1 41 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 95. JavaEE6 Simplified Packaging ManagedBean CDI Sample 42 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 96. Simplified Packaging 43 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 97. Simplified Packaging javaee5.war WEB-INF/classes/ MyServlet.class MyFilter.class WEB-INF/lib/ someFramework.jar WEB-INF/ web.xml index.html css/style.css js/jquery.js js/plugin/jplugin.js 43 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 98. Simplified Packaging javaee5.war javaee6.war WEB-INF/classes/ WEB-INF/classes/ MyServlet.class MyServlet.class MyFilter.class MyFilter.class WEB-INF/lib/ WEB-INF/lib/ someFramework.jar someFramework.jar someResource.jar WEB-INF/ web.xml index.html index.html css/style.css css/style.css js/jquery.js js/plugin/jplugin.js 43 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 99. javax.servlet.annotation 44 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 100. javax.servlet.annotation @WebServlet(name="MyServlet", urlPatterns="/myServlet") @WebServlet public class MyServlet extends HttpServlet { // ... } 44 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 101. javax.servlet.annotation @WebServlet(name="MyServlet", urlPatterns="/myServlet") @WebServlet public class MyServlet extends HttpServlet { // ... } @WebFilter(filterName="MyFilter", urlPatterns="/*") @WebFilter public class MyFilter implements Filter { // ... } 44 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 102. javax.servlet.annotation @WebServlet(name="MyServlet", urlPatterns="/myServlet") @WebServlet public class MyServlet extends HttpServlet { // ... } @WebFilter(filterName="MyFilter", urlPatterns="/*") @WebFilter public class MyFilter implements Filter { // ... } @WebListener public class MyListener @WebListener implements ServletContextListener { // ... } 44 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 103. web-fragment.xml someFramework.jar com/fw/SomeFWServlet.class com/fw/SomeFWFilter.class META-INF/web-fragment.xml 45 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 104. web-fragment.xml someFramework.jar com/fw/SomeFWServlet.class com/fw/SomeFWFilter.class META-INF/web-fragment.xml web-fragment.xml <?xml version="1.0" encoding="UTF-8"?> <web-fragment xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd" version="3.0"> <!-- servlet --> <!-- filter --> <!-- ... --> </web-fragment> 45 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 105. Resource Jar app.war WEB-INF/lib/ someResource.jar http://serv.com:8080/app/ META-INF/resources/ js/jquery.js js/jquery.js js/plugin/jplugin.js js/plugin/jplugin.js css/jplugin.css css/jplugin.css images/jplugin.png images/jplugin.png 46 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 106. JavaEE6 Simplified Packaging ManagedBean CDI Sample 47 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 107. ManagedBean photo.3 48 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 108. ManagedBean Plain Java Objects photo.3 48 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 109. ManagedBean Plain Java Objects Lifecycle managed by container photo.3 48 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 110. ManagedBean Plain Java Objects Lifecycle managed by container @ManagedBean (javax.annotation) photo.3 48 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 111. Lifecycle 49 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 112. Lifecycle Scope (javax.enterprise.context) 49 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 113. Lifecycle @ApplicationScoped @SessionScoped Scope @ConversationScoped (javax.enterprise.context) @RequestScoped 49 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 114. Lifecycle @ApplicationScoped @SessionScoped Scope @ConversationScoped (javax.enterprise.context) @RequestScoped Callbacks (javax.annotation) 49 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 115. Lifecycle @ApplicationScoped @SessionScoped Scope @ConversationScoped (javax.enterprise.context) @RequestScoped @PostConstruct Callbacks @PreDestroy (javax.annotation) 49 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 116. JavaEE6 Simplified Packaging ManagedBean CDI Sample 50 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 117. CDI 51 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 118. CDI Context and Dependency Injection 51 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 119. CDI Context and Dependency Injection @Inject (javax.annotation) 51 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 120. Injection Points 52 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 121. Injection Points Field @Inject private MyService myService; Injection 52 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 122. Injection Points Field @Inject private MyService myService; Injection @Inject Constructor private MyBean(MyService myService) { // ... Injection } 52 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 123. Injection Points Field @Inject private MyService myService; Injection @Inject Constructor private MyBean(MyService myService) { // ... Injection } @Inject Parameter void init(MyService myService) { // ... Injection } 52 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 124. javax.enterprise.inject. Produces Factory Method provides Injection Object public class Factory { @Produces public static ComplexObject getInstance() { return new ComplexObject("prop1", "prop2"); } } 53 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 125. javax.inject.Qualifier @Qualifier @Retention(RetentionPolicy.RUNTIME) public @interface MyQualifier { } SomeInterface @MyQualifier public class OneImpl implements SomeInterface { // ... } OneImpl AnotherImpl @Inject @MyQualifier private SomeInterface some; 54 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 126. JavaEE6 Simplified Packaging ManagedBean CDI Sample 55 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 127. index.xhtml 56 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 128. index.xhtml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html> <html xmlns:h="http://java.sun.com/jsf/html"> <head> <title>Greeting</title> </head> <h:body> #{myBean.greeting} </h:body> </html> 56 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 129. MyBean.java 57 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 130. MyBean.java @Named public class MyBean { @Inject private MyService myService; public String getGreeting() { return myService.getGreeting(); } } 57 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 131. MyService.java 58 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 132. MyService.java @ManagedBean public class MyService { public String getGreeting() { return "Hello JavaEE6!!"; } } 58 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 133. beans.xml 59 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 134. beans.xml (empty) 59 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 135. faces-config.xml 60 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 136. faces-config.xml (empty) 60 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 137. Packaging app.war `---WEB-INF/ `---classes/ `---MyBean.class `---MyService.class `---beans.xml `---faces-config.xml `---index.xhtml 61 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 138. Deploy 62 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 139. Deploy $ asadmin deploy /path/to/app.war 62 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 140. Deploy $ asadmin deploy /path/to/app.war appという名前のアプリケーションがデプロイされました。 コマンドdeployは正常に実行されました。 62 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 141. Deploy $ asadmin deploy /path/to/app.war appという名前のアプリケーションがデプロイされました。 コマンドdeployは正常に実行されました。 $ curl "http://localhost:8080/app/index.jsf" 62 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 142. Deploy $ asadmin deploy /path/to/app.war appという名前のアプリケーションがデプロイされました。 コマンドdeployは正常に実行されました。 $ curl "http://localhost:8080/app/index.jsf" <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html> <html> <head> <title>Greeting</title> </head><body> Hello JavaEE6!! </body> </html> 62 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 143. Conclusion Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 144. Conclusion InvokeDynamic Fork/Join Framework Servlet 3.0 EJB 3.0 (+Lite) More New I/O G1GC CDI/DI Project Coin Bean Validation JAX-RS Managed Bean 64 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 145. Conclusion InvokeDynamic Fork/Join Framework Servlet 3.0 EJB 3.0 (+Lite) More New I/O Your Java, Update now!! G1GC CDI/DI Project Coin Bean Validation JAX-RS Managed Bean 64 Copyright © 2012 Akira Koyasu. Some rights reserved.
  • 146. Notes This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/ licenses/by-nc/3.0/. photo.1 http://www.flickr.com/photos/brockli/475833924/ from photo.2 http://www.flickr.com/photos/29487767@N02/2866453076/ from photo.3 http://www.flickr.com/photos/amanda28192/6216031916/ from 65 Copyright © 2012 Akira Koyasu. Some rights reserved.

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. \n
  154. \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n
  164. \n
  165. \n
  166. \n
  167. \n
  168. \n
  169. \n
  170. \n
  171. \n
  172. \n
  173. \n
  174. \n
  175. \n
  176. \n
  177. \n
  178. \n
  179. \n
  180. \n