‹#›
‹#›
‹#›
‹#›
‹#›
‹#›
‹#›
‹#›
‹#›
‹#›
6                                   Worker	                                     Thread                                   W...
                 		                                            	                    	       B	                       B	   ...
‹#›
no9fyno9fy        ‹#›
Selector selector = Selector.open();!ServerSocketChannel serverChannel = ServerSocketChannel.open();!serverChannel.configu...
SocketChannel channel = serverChannel.accept();!AsynchronousServerSocketChannel server =AsynchronousServerSocketChannel.op...
‹#›
‹#›
GlassFish glassfish = GlassFishRuntime.bootstrap().!     !     !     !     !     !     !     !newGlassFish();!glassfish.st...
public class HelloWorldAdapter extends GrizzlyAdapter {!    @Override!    public void service(GrizzlyRequest request, Griz...
GrizzlyWebServer gws = new GrizzlyWebServer(8080, "no staticcontent");!!ServletAdapter simpleServletAdapter = new ServletA...
‹#›
-Dcom.sun.grizzly.displayConfiguration = true!Grizzly running on Darwin - 10.8.0 under JDK version: 1.7.0-internal -Oracle...
-­‐Dcom.sun.grizzly.enableSnoop=true![#|2011-­‐09-­‐01T22:00:39.319+0900|INFO|glassfish3.1.1|com.sun.grizzly.config.GrizzlyS...
-client!-Xmx512m!-server !-Xmx3500m -Xms3500m -Xss128k !-XX:+AggressiveHeap !-XX:+DisableExplicitGC!                      ...
‹#›
Upcoming SlideShare
Loading in …5
×

Grizzly1.9.3x

2,309 views

Published on

This explain the history and the new feature of Grizzly.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,309
On SlideShare
0
From Embeds
0
Number of Embeds
44
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Grizzly1.9.3x

  1. 1. ‹#›
  2. 2. ‹#›
  3. 3. ‹#›
  4. 4. ‹#›
  5. 5. ‹#›
  6. 6. ‹#›
  7. 7. ‹#›
  8. 8. ‹#›
  9. 9. ‹#›
  10. 10. ‹#›
  11. 11. 6 Worker   Thread Worker   Thread Web Container Worker   HTTP Engine Thread Worker   VS Select Thread Acceptor   Worker   NSAPI Engine Thread Thread 4 5 Acceptor   Worker   … Thread Thread 1 2 3 7 KeepAlive   Thread KeepAlive   Thread9 8 ‹#›
  12. 12.     B   B   Thread-­‐1   Thread-­‐1   B   B   Thread-­‐2   Thread-­‐2   B   B   Thread-­‐3   Thread-­‐3   ‹#›
  13. 13. ‹#›
  14. 14. no9fyno9fy ‹#›
  15. 15. Selector selector = Selector.open();!ServerSocketChannel serverChannel = ServerSocketChannel.open();!serverChannel.configureBlocking(false);// !serverChannel.socket().bind(new InetSocketAddress(9090));!serverChannel.register(selector, SelectionKey.OP_ACCEPT);!while (selector.select() > 0) {!    for (Iterator it = selector.selectedKeys().iterator();it.hasNext();) {!       SelectionKey key = (SelectionKey) it.next();!       it.remove();!       if (key.isAcceptable()) {!           ServerSocketChannel serverChannel =! (ServerSocketChannel) key.channel();! SocketChannel channel = serverChannel.accept();! channel.configureBlocking(false);!           channel.register(selector, SelectionKey.OP_READ);! ‹#›
  16. 16. SocketChannel channel = serverChannel.accept();!AsynchronousServerSocketChannel server =AsynchronousServerSocketChannel.open().bind(9900);!Future<AsynchronousSocketChannel> acceptFuture = server.accept();!AsynchronousSocketChannel worker = future.get();!//AsynchronousSocketChannel worker = future.get(10,TimeUnit.SECONDS); // ! ‹#›
  17. 17. ‹#›
  18. 18. ‹#›
  19. 19. GlassFish glassfish = GlassFishRuntime.bootstrap().! ! ! ! ! ! ! !newGlassFish();!glassfish.start();!!CommandRunner commandRunner = glassfish.getService(CommandRunner.class);!CommandResult commandResult = commandRunner.run("create-http-listener", "--listenerport=9090", "--listeneraddress=0.0.0.0","--defaultvs=server", "my-http-listener");!!Deployer deployer = glassfish.getDeployer();!deployer.deploy(new File(“HelloWorldWeb-GA.war"));! ‹#›
  20. 20. public class HelloWorldAdapter extends GrizzlyAdapter {! @Override! public void service(GrizzlyRequest request, GrizzlyResponseresponse) {! try {! response.getWriter().println("HelloWorld");! } catch (IOException ex) {! ex.printStackTrace();! }}!<adapters>! <adapter context-root="/helloworld" class-name="co.jp.oracle.http.HelloWorldAdapter"/>!</adapters>!> asadmin deploy helloworld.jar ‹#›
  21. 21. GrizzlyWebServer gws = new GrizzlyWebServer(8080, "no staticcontent");!!ServletAdapter simpleServletAdapter = new ServletAdapter();!simpleServletAdapter.setContextPath("/hello");!simpleServletAdapter.setServletInstance(new MyServlet());!gws.addGrizzlyAdapter(simpleServletAdapter, new String[]{"/hello"});!!gws.start();! ‹#›
  22. 22. ‹#›
  23. 23. -Dcom.sun.grizzly.displayConfiguration = true!Grizzly running on Darwin - 10.8.0 under JDK version: 1.7.0-internal -Oracle Corporation ! port: 4848! Thread Pool:com.sun.enterprise.v3.services.impl.monitor.MonitorableThreadPool@7e8e68bd, port=4848! Read Selector: -1! ByteBuffer size: 8192 ! maxHttpHeaderSize: 8192! sendBufferSize: 8192! maxKeepAliveRequests: 250! keepAliveTimeoutInSeconds: 30 ! Static File Cache enabled: false! ‹#› Adapter : com.sun.enterprise.v3.services.impl.ContainerMapper ! Asynchronous Request Processing enabled: false|#]!
  24. 24. -­‐Dcom.sun.grizzly.enableSnoop=true![#|2011-­‐09-­‐01T22:00:39.319+0900|INFO|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=67;_ThreadName=Thread-­‐2;|GRIZZLY0020:  SocketChannel  headers  java.nio.channels.SocketChannel[connected  local=/127.0.0.1:4848  remote=/127.0.0.1:55379]  are:    ===  MimeHeaders  ===  host  =  127.0.0.1:4848  user-­‐agent  =  Mozilla/5.0  (Macintosh;  Intel  Mac  OS  X  10.6;  rv:6.0.1)  Gecko/20100101  Firefox/6.0.1  accept  =  text/html,applica9on/xhtml+xml,applica9on/xml;q=0.9,*/*;q=0.8  accept-­‐language  =  ja,en;q=0.7,en-­‐us;q=0.3  accept-­‐encoding  =  gzip,  deflate  accept-­‐charset  =  Shil_JIS,un-­‐8;q=0.7,*;q=0.7   ‹#›
  25. 25. -client!-Xmx512m!-server !-Xmx3500m -Xms3500m -Xss128k !-XX:+AggressiveHeap !-XX:+DisableExplicitGC! ‹#›
  26. 26. ‹#›

×