This document outlines an approach to building scalable network services in Java using non-blocking I/O and an event-driven architecture based on the Reactor pattern. It describes how a basic single-threaded Reactor implementation works using Java NIO channels and selectors to dispatch event handlers without blocking. It then discusses ways to improve scalability through multithreading, including using worker threads to offload processing and multiple Reactor threads to distribute load across CPUs.
Vert.x is a tool for building reactive applications on the JVM. It is polyglot, allowing applications to be written in Java, Groovy, JavaScript and other languages. It uses an asynchronous and non-blocking model with shared-nothing communication between components. Modules communicate through publish/subscribe messaging on an event bus or directly through request-response patterns. Vert.x provides horizontal scaling and allows efficient use of server resources. It can also integrate with SockJS to provide WebSocket-like capabilities in browsers that do not support WebSockets.
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingLuciano Mammino
Learn how you can use some JavaScript/Node.js black magic to crack JWT tokens and impersonate other users or escalate privileges. Just add a pinch of ZeroMQ, a dose of parallel computing, a 4 leaf clover, mix everything applying some brute force and you'll get a powerful JWT cracking potion!
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...Codemotion
Apache OpenWhisk provides a powerful and flexible environment for deploying cloud-native applications driven by data, message, and API call events. We will show how and why we integrated Apache OpenWhisk and GitHub to make deployment as easy and transparent as `git push`. We will also discuss the benefit of using an open source cloud platform and explain how serverless allows developers to focus on writing value-adding code.
This document provides an introduction to Node.js, a platform for building fast, scalable network applications using JavaScript. Node.js uses a single-threaded event loop model that makes it lightweight and efficient. It allows JavaScript code to run on the server side. Common frameworks like Express.js provide Model-View-Controller (MVC) patterns to Node.js applications similar to other web frameworks. Node.js can access relational and non-relational databases to handle data persistence on the server.
You probably know the mantra that allocation is cheap. It usually is true, but devil is in the details. In your use case object allocation may impact processor caches evicting important data; burn CPU on executing constructor code; impact rates of object promotion to old generation and most importantly increase frequency of stop the word young gen pauses.
This presentation is for you if you are working on a Java based services that need to handle more and more traffic. As number of transactions per second rises you might hit performance wall that are young generation gc stopping whole application for precious milliseconds.
This presentation focuses on optimising object creation rate when dealing with seemingly mundane tasks. I will show few examples of surprising places in JDK and other libraries where garbage is created. I will explain how New Gen GC collection works and what costs are related to it. We will se escape analysis in action. Finally we will conclude that controlling allocation is the concern of library writers so that we can easily implement performant code without doing premature optimisations.
Asynchronous I/O in NodeJS - new standard or challenges?Dinh Pham
The document discusses asynchronous I/O in Node.js and compares processing models using processes, threads, and events. It explains how Node.js uses an event-driven and asynchronous model with callbacks to handle non-blocking I/O. It also discusses challenges with callbacks and introduces flow control libraries that can help address issues with readability and debugging of asynchronous code.
The document discusses servlets and how they work. Servlets are server-side Java programs that generate responses, usually in the form of HTML pages, to requests from web clients. Servlets run within a servlet container, which manages loading and executing servlets in response to requests. Servlets can access request parameters and session information, generate dynamic content, connect to databases, and more. Common methods include doGet() and doPost() to handle different HTTP request types.
Vert.x is a tool for building reactive applications on the JVM. It is polyglot, allowing applications to be written in Java, Groovy, JavaScript and other languages. It uses an asynchronous and non-blocking model with shared-nothing communication between components. Modules communicate through publish/subscribe messaging on an event bus or directly through request-response patterns. Vert.x provides horizontal scaling and allows efficient use of server resources. It can also integrate with SockJS to provide WebSocket-like capabilities in browsers that do not support WebSockets.
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingLuciano Mammino
Learn how you can use some JavaScript/Node.js black magic to crack JWT tokens and impersonate other users or escalate privileges. Just add a pinch of ZeroMQ, a dose of parallel computing, a 4 leaf clover, mix everything applying some brute force and you'll get a powerful JWT cracking potion!
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...Codemotion
Apache OpenWhisk provides a powerful and flexible environment for deploying cloud-native applications driven by data, message, and API call events. We will show how and why we integrated Apache OpenWhisk and GitHub to make deployment as easy and transparent as `git push`. We will also discuss the benefit of using an open source cloud platform and explain how serverless allows developers to focus on writing value-adding code.
This document provides an introduction to Node.js, a platform for building fast, scalable network applications using JavaScript. Node.js uses a single-threaded event loop model that makes it lightweight and efficient. It allows JavaScript code to run on the server side. Common frameworks like Express.js provide Model-View-Controller (MVC) patterns to Node.js applications similar to other web frameworks. Node.js can access relational and non-relational databases to handle data persistence on the server.
You probably know the mantra that allocation is cheap. It usually is true, but devil is in the details. In your use case object allocation may impact processor caches evicting important data; burn CPU on executing constructor code; impact rates of object promotion to old generation and most importantly increase frequency of stop the word young gen pauses.
This presentation is for you if you are working on a Java based services that need to handle more and more traffic. As number of transactions per second rises you might hit performance wall that are young generation gc stopping whole application for precious milliseconds.
This presentation focuses on optimising object creation rate when dealing with seemingly mundane tasks. I will show few examples of surprising places in JDK and other libraries where garbage is created. I will explain how New Gen GC collection works and what costs are related to it. We will se escape analysis in action. Finally we will conclude that controlling allocation is the concern of library writers so that we can easily implement performant code without doing premature optimisations.
Asynchronous I/O in NodeJS - new standard or challenges?Dinh Pham
The document discusses asynchronous I/O in Node.js and compares processing models using processes, threads, and events. It explains how Node.js uses an event-driven and asynchronous model with callbacks to handle non-blocking I/O. It also discusses challenges with callbacks and introduces flow control libraries that can help address issues with readability and debugging of asynchronous code.
The document discusses servlets and how they work. Servlets are server-side Java programs that generate responses, usually in the form of HTML pages, to requests from web clients. Servlets run within a servlet container, which manages loading and executing servlets in response to requests. Servlets can access request parameters and session information, generate dynamic content, connect to databases, and more. Common methods include doGet() and doPost() to handle different HTTP request types.
These are the slides to a talk I gave at Pittsburgh techFest 2012. The topic was an overview of the Node.js framework, and how you can use it to build amazing things.
* See more of my work at http://www.codehenge.net
This document provides an overview of web application development and servlet technology. It discusses the history and evolution of web pages to dynamic web applications. It then defines web applications and the request-response model. Common Gateway Interface (CGI) is introduced as the first technique for dynamic content, along with its limitations which led to the creation of servlets. Key servlet concepts like the servlet interface, generic servlet, HTTP servlet, and servlet lifecycle methods are covered. The document also examines the HttpServletRequest and HttpServletResponse interfaces and their various methods. Finally, it discusses session tracking approaches including cookies and the session API.
My Node.js workshop from Sela's Developer Conference 2015.
In the Workshop we covered The basics Node.js api's and the express web application framework.
This document discusses servlets, servlet configuration, servlet context, session tracking techniques, and servlet filters in Java web applications. It explains that servletconfig is used to configure individual servlets while servletcontext is used for global application configuration. Session tracking can be done via cookies, hidden form fields, URL rewriting, or HTTP session. Filters provide preprocessing and postprocessing of requests and have initialization, processing, and destruction lifecycle methods.
Servlet is java class which extends the functionality of web server by dynamically generating web pages.
Servlet technology is used to create Dynamic web application. Servlet technology is robust and scalable. init() and service() methods are more important in life cycle of a servlet. doGet() and doPost() are methods used under service() method.
Request dispatching allows one servlet to forward a request to another servlet, JSP, or HTML page for further processing. This is done using a RequestDispatcher object, which can be obtained from the servlet context or request object. The RequestDispatcher's forward() method dispatches the request without the client's knowledge, maintaining request parameters, while include() dispatches and includes the response in the original response without changing headers.
7.1 Identify which attribute scopes are thread-safe:
Local variables
Instance variables
Class variables
Request attributes
Session attributes
Context attributes
7.2 Identify correct statements about differences between the multithreaded and single-threaded servlet models.
7.3 Identify the interface used to declare that a servlet must use the single thread model.
The document discusses Spring Session, which provides a way to store and configure session data handling in a platform-independent manner. It introduces Spring Session's architecture and components, including the SessionRepositoryFilter, SessionRepository implementations, and HttpSession wrappers. It then outlines the steps to use Spring Session with Redis for session persistence, including configuration of the RedisConnectionFactory, session usage, and bootstrap of SpringSession.
Asynchronous web apps with the Play Framework 2.0Oscar Renalias
This document discusses Play's asynchronous capabilities for building scalable and responsive web applications. It begins by explaining the traditional blocking request processing model and Play's asynchronous non-blocking model. It then covers asynchronous requests using Futures and Promises in Play. Examples are provided for making actions asynchronous using asynchronous responses. The document also discusses reactive IO in Play using Enumerators and Iteratees for non-blocking streaming of data. Real world use cases for asynchronous programming include asynchronous web services, streaming files and data, and websockets.
Yet another presentation about Event Sourcing? Yes and no. Event Sourcing is a really great concept. Some could say it’s a Holy Grail of the software architecture. I might agree with that, while remembering that everything comes with a price. This session is a summary of my experience with ES gathered while working on 3 different commercial products. Instead of theoretical aspects, I will focus on possible challenges with ES implementation. What could explode (very often with delayed ignition)? How and where to store events effectively? What are possible schema evolution solutions? How to achieve the highest level of scalability and live with eventual consistency? And many other interesting topics that you might face when experimenting with ES.
The servlet lifecycle consists of four main steps:
1) Loading and instantiation where the servlet class is loaded and an instance is created.
2) Initialization where the init() method is called to perform initialization.
3) Request handling where the service() method handles client requests.
4) End of service where the destroy() method is called before the servlet is removed from service to clean up resources.
The main lifecycle methods are init(), service(), and destroy(). The init() method performs initialization, service() handles requests, and destroy() performs cleanup before removal.
Mark Thomas gave a presentation on Tomcat 7 and the new features in Servlet 3.0. Some of the major changes covered included support for asynchronous processing, web fragments, dynamic configuration through programmatic additions of servlets and filters, and additional annotations. The timeline for finalizing Servlet 3.0 was discussed, as well as the current status of Tomcat 7 development to support the new specification.
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Codemotion
Yet another presentation about Event Sourcing? Yes and no. Event Sourcing is a really great concept. Some could say it’s a Holy Grail of the software architecture. True, but everything comes with a price. This session is a summary of my experience with ES gathered while working on 3 different commercial products. Instead of theoretical aspects, I will focus on possible challenges with ES implementation. What could explode? How and where to store events effectively? What are possible schema evolution solutions? How to achieve the highest level of scalability and live with eventual consistency?
The document provides an overview of servlets, including:
- What servlets are and how they work
- The lifecycle of a servlet from initialization to handling requests to destruction
- Options for server-side development like CGI, FastCGI, PHP
- Advantages of using servlets like performance, portability, and security
CLS & asyncListener: asynchronous observability for Node.jsForrest Norvell
Slides from my presentation at PDXNode in October 2013 before RealtimeConf. Thanks to Tracy Abrahms, Ben Acker, and the rest of the PDXNode community for accommodating and hosting me at the last minute!
Node.js is a JavaScript runtime built on Chrome's V8 engine. It is asynchronous and event-driven, which allows it to handle many connections with few threads. The document discusses Node.js architecture, including the event loop and worker pool. It emphasizes that blocking the event loop or worker pool can degrade performance. Tasks should be partitioned and offloaded to avoid blocking and minimize variation in task times.
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...Codemotion
Samuele Resca is an Microsoft MVP Visual Studio and Development Technologies, Software Engineer, specializing mainly on ASP.NET MVC and in general about everything that revolves around the web. Samuele was born in 1994, and works as a software developer @YOOX NET-A-PORTER Group He loves the MVC frameworks, ASP.NET MVC, Javascript, Node.js and Typescript.
The servlet lifecycle consists of 5 steps: (1) loading and instantiation of servlets by the servlet container, (2) initialization via the init() method, (3) processing of client requests via the service() method, (4) finalization via the destroy() method, and (5) garbage collection. The service() method handles each client request by dispatching to doGet() or doPost() depending on the request type, while init() and destroy() are called once per servlet instance.
The document discusses Java I/O and provides an overview of key concepts like streams, readers/writers, files, serialization, and tokenization. It describes the different types of input/output streams, readers, and writers in Java and best practices for working with them. Examples are provided to demonstrate reading from and writing to files, streams, and using serialization and tokenization.
This document provides an overview of Java I/O including different types of I/O, how Java supports I/O through streams and classes like File, serialization, compression, Console, and Properties. It discusses byte and character streams, buffered streams, reading/writing files, and preferences. Key points are that Java I/O uses streams as an abstraction, byte streams operate on bytes while character streams use characters, and buffered streams improve efficiency by buffering reads/writes.
These are the slides to a talk I gave at Pittsburgh techFest 2012. The topic was an overview of the Node.js framework, and how you can use it to build amazing things.
* See more of my work at http://www.codehenge.net
This document provides an overview of web application development and servlet technology. It discusses the history and evolution of web pages to dynamic web applications. It then defines web applications and the request-response model. Common Gateway Interface (CGI) is introduced as the first technique for dynamic content, along with its limitations which led to the creation of servlets. Key servlet concepts like the servlet interface, generic servlet, HTTP servlet, and servlet lifecycle methods are covered. The document also examines the HttpServletRequest and HttpServletResponse interfaces and their various methods. Finally, it discusses session tracking approaches including cookies and the session API.
My Node.js workshop from Sela's Developer Conference 2015.
In the Workshop we covered The basics Node.js api's and the express web application framework.
This document discusses servlets, servlet configuration, servlet context, session tracking techniques, and servlet filters in Java web applications. It explains that servletconfig is used to configure individual servlets while servletcontext is used for global application configuration. Session tracking can be done via cookies, hidden form fields, URL rewriting, or HTTP session. Filters provide preprocessing and postprocessing of requests and have initialization, processing, and destruction lifecycle methods.
Servlet is java class which extends the functionality of web server by dynamically generating web pages.
Servlet technology is used to create Dynamic web application. Servlet technology is robust and scalable. init() and service() methods are more important in life cycle of a servlet. doGet() and doPost() are methods used under service() method.
Request dispatching allows one servlet to forward a request to another servlet, JSP, or HTML page for further processing. This is done using a RequestDispatcher object, which can be obtained from the servlet context or request object. The RequestDispatcher's forward() method dispatches the request without the client's knowledge, maintaining request parameters, while include() dispatches and includes the response in the original response without changing headers.
7.1 Identify which attribute scopes are thread-safe:
Local variables
Instance variables
Class variables
Request attributes
Session attributes
Context attributes
7.2 Identify correct statements about differences between the multithreaded and single-threaded servlet models.
7.3 Identify the interface used to declare that a servlet must use the single thread model.
The document discusses Spring Session, which provides a way to store and configure session data handling in a platform-independent manner. It introduces Spring Session's architecture and components, including the SessionRepositoryFilter, SessionRepository implementations, and HttpSession wrappers. It then outlines the steps to use Spring Session with Redis for session persistence, including configuration of the RedisConnectionFactory, session usage, and bootstrap of SpringSession.
Asynchronous web apps with the Play Framework 2.0Oscar Renalias
This document discusses Play's asynchronous capabilities for building scalable and responsive web applications. It begins by explaining the traditional blocking request processing model and Play's asynchronous non-blocking model. It then covers asynchronous requests using Futures and Promises in Play. Examples are provided for making actions asynchronous using asynchronous responses. The document also discusses reactive IO in Play using Enumerators and Iteratees for non-blocking streaming of data. Real world use cases for asynchronous programming include asynchronous web services, streaming files and data, and websockets.
Yet another presentation about Event Sourcing? Yes and no. Event Sourcing is a really great concept. Some could say it’s a Holy Grail of the software architecture. I might agree with that, while remembering that everything comes with a price. This session is a summary of my experience with ES gathered while working on 3 different commercial products. Instead of theoretical aspects, I will focus on possible challenges with ES implementation. What could explode (very often with delayed ignition)? How and where to store events effectively? What are possible schema evolution solutions? How to achieve the highest level of scalability and live with eventual consistency? And many other interesting topics that you might face when experimenting with ES.
The servlet lifecycle consists of four main steps:
1) Loading and instantiation where the servlet class is loaded and an instance is created.
2) Initialization where the init() method is called to perform initialization.
3) Request handling where the service() method handles client requests.
4) End of service where the destroy() method is called before the servlet is removed from service to clean up resources.
The main lifecycle methods are init(), service(), and destroy(). The init() method performs initialization, service() handles requests, and destroy() performs cleanup before removal.
Mark Thomas gave a presentation on Tomcat 7 and the new features in Servlet 3.0. Some of the major changes covered included support for asynchronous processing, web fragments, dynamic configuration through programmatic additions of servlets and filters, and additional annotations. The timeline for finalizing Servlet 3.0 was discussed, as well as the current status of Tomcat 7 development to support the new specification.
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...Codemotion
Yet another presentation about Event Sourcing? Yes and no. Event Sourcing is a really great concept. Some could say it’s a Holy Grail of the software architecture. True, but everything comes with a price. This session is a summary of my experience with ES gathered while working on 3 different commercial products. Instead of theoretical aspects, I will focus on possible challenges with ES implementation. What could explode? How and where to store events effectively? What are possible schema evolution solutions? How to achieve the highest level of scalability and live with eventual consistency?
The document provides an overview of servlets, including:
- What servlets are and how they work
- The lifecycle of a servlet from initialization to handling requests to destruction
- Options for server-side development like CGI, FastCGI, PHP
- Advantages of using servlets like performance, portability, and security
CLS & asyncListener: asynchronous observability for Node.jsForrest Norvell
Slides from my presentation at PDXNode in October 2013 before RealtimeConf. Thanks to Tracy Abrahms, Ben Acker, and the rest of the PDXNode community for accommodating and hosting me at the last minute!
Node.js is a JavaScript runtime built on Chrome's V8 engine. It is asynchronous and event-driven, which allows it to handle many connections with few threads. The document discusses Node.js architecture, including the event loop and worker pool. It emphasizes that blocking the event loop or worker pool can degrade performance. Tasks should be partitioned and offloaded to avoid blocking and minimize variation in task times.
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...Codemotion
Samuele Resca is an Microsoft MVP Visual Studio and Development Technologies, Software Engineer, specializing mainly on ASP.NET MVC and in general about everything that revolves around the web. Samuele was born in 1994, and works as a software developer @YOOX NET-A-PORTER Group He loves the MVC frameworks, ASP.NET MVC, Javascript, Node.js and Typescript.
The servlet lifecycle consists of 5 steps: (1) loading and instantiation of servlets by the servlet container, (2) initialization via the init() method, (3) processing of client requests via the service() method, (4) finalization via the destroy() method, and (5) garbage collection. The service() method handles each client request by dispatching to doGet() or doPost() depending on the request type, while init() and destroy() are called once per servlet instance.
The document discusses Java I/O and provides an overview of key concepts like streams, readers/writers, files, serialization, and tokenization. It describes the different types of input/output streams, readers, and writers in Java and best practices for working with them. Examples are provided to demonstrate reading from and writing to files, streams, and using serialization and tokenization.
This document provides an overview of Java I/O including different types of I/O, how Java supports I/O through streams and classes like File, serialization, compression, Console, and Properties. It discusses byte and character streams, buffered streams, reading/writing files, and preferences. Key points are that Java I/O uses streams as an abstraction, byte streams operate on bytes while character streams use characters, and buffered streams improve efficiency by buffering reads/writes.
The document discusses techniques, challenges, and best practices for handling input/output (I/O) operations in Java. It covers the different types of I/O, how Java supports I/O through streams and readers/writers, issues with streams, alternatives like NIO that support non-blocking I/O using buffers and channels, and "Hiranya's Laws" with guidelines for proper I/O handling.
The document discusses Java streams and I/O. It defines streams as abstract representations of input/output devices that are sources or destinations of data. It describes byte and character streams, the core stream classes in java.io, predefined System streams, common stream subclasses, reading/writing files and binary data with byte streams, and reading/writing characters with character streams. It also covers object serialization/deserialization and compressing files with GZIP.
The Java I/O package supports Java's basic input/output system for accessing external data from sources like files and networks. It defines streams as logical entities that produce or consume information, with byte streams for binary data and character streams for Unicode text. Streams are linked to physical devices and behave consistently across different types of devices. The package defines hierarchies of input and output stream classes, with abstract base classes like InputStream/OutputStream for bytes and Reader/Writer for characters.
The document discusses Java input/output (I/O) streams. It covers byte streams like FileInputStream and FileOutputStream for reading and writing bytes. It also covers character streams like FileReader and FileWriter for reading and writing characters. Filtered streams like BufferedInputStream are discussed which add functionality to underlying streams. The document also covers random access files and the File class.
The document discusses Java packages and classes. It describes common Java API packages like java.lang, java.util, java.io, java.awt, and java.net and what types of classes they contain. It also provides examples of using packages like Vector, Random, Date, and Calendar classes and their key methods. The Calendar class allows interpreting dates and times, defining constants used for components like MONTH, DATE, HOUR, etc.
The document outlines an approach to scalable network services in Java using event-driven and non-blocking I/O. It discusses using the reactor pattern to handle I/O events asynchronously by dispatching tasks to handlers. This allows for high performance by reducing blocking and leveraging available resources like CPUs. It provides examples of how this can be implemented using Java's NIO APIs including channels, buffers, selectors and selection keys.
Original slides from Ryan Dahl's NodeJs intro talkAarti Parikh
These are the original slides from the nodejs talk. I was surprised not find them on slideshare so adding them. The video link is here https://www.youtube.com/watch?v=ztspvPYybIY
The document provides an introduction to server-side JavaScript using Node.js. It discusses Node.js basics, how it uses an event-driven and non-blocking model, and provides examples of building HTTP and TCP servers. It also covers Node.js modules, benchmarks, when to use/not use Node.js, and popular companies using Node.js in production.
Node.js is an asynchronous JavaScript runtime that allows for efficient handling of I/O operations. The presentation discusses developing with Node.js by using modules from NPM, debugging with node-inspector, common pitfalls like blocking loops, and best practices like avoiding large heaps and offloading intensive tasks. Key Node.js modules demonstrated include Express for web frameworks and Socket.io for real-time applications.
Asynchronous Web Programming with HTML5 WebSockets and JavaJames Falkner
(Talk originally given @ KCDC - http://kcdc.info ).
Over the last decade, advances in web computing have removed many of the barriers to entry for developers. New languages, frameworks, and development methodologies have kickstarted new ideas and new ways to develop web applications to make modern life easier and more efficient. WebSockets (introduced as part of HTML5) is one such technology that enables a new class of scalable, super-responsive, collaborative, and real-time web applications with a wide range of uses.
In this talk, we will first cover the basics of asynchronous web programming using WebSockets, including predecessors such as polling and long-polling, applications of WebSockets, its limitations and potential bottlenecks, and potential future improvements.
Next, we will demo and dissect a real-world use case for realtime social data analytics, using the Apache Tomcat implementation of WebSockets and the Java-based Liferay Portal Server. This will include a discussion about development of WebSocket endpoints, its lifecycle within the application container and browser, debugging WebSockets, and scalability topics.
This document provides an introduction and overview of a Node.js tutorial presented by Tom Hughes-Croucher. The tutorial covers topics such as building scalable server-side code with JavaScript using Node.js, debugging Node.js applications, using frameworks like Express.js, and best practices for deploying Node.js applications in production environments. The tutorial includes exercises for hands-on learning and demonstrates tools and techniques like Socket.io, clustering, error handling and using Redis with Node.js applications.
Node has captured the attention of early adopters by clearly differentiating itself as being asynchronous from the ground up while remaining accessible. Now that server side JavaScript is at the cutting edge of the asynchronous, real time web, it is in a much better position to establish itself as the go to language for also making synchronous, CRUD webapps and gain a stronger foothold on the server.
This talk covers the current state of server side JavaScript beyond Node. It introduces Common Node, a synchronous CommonJS compatibility layer using node-fibers which bridges the gap between the different platforms. We look into Common Node's internals, compare its performance to that of other implementations such as RingoJS and go through some ideal use cases.
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine that allows JavaScript to be run on the server side. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, especially for real-time applications with many simultaneous connections. Node.js can be used for anything from building chat servers and analytics backends to developing full-stack web applications. While it is not a web framework itself, modules like Express allow it to function as one. Node.js runs in a single thread using an event loop to handle asynchronous callbacks instead of blocking on I/O, making it highly scalable.
The document discusses the future of server-side JavaScript. It covers various Node.js frameworks and libraries that support both synchronous and asynchronous programming styles. CommonJS aims to provide interoperability across platforms by implementing synchronous proposals using fibers. Examples demonstrate how CommonJS allows for synchronous-like code while maintaining asynchronous behavior under the hood. Benchmarks show it has comparable performance to Node.js. The author advocates for toolkits over frameworks and continuing development of common standards and packages.
The document is a presentation about Node.js, a JavaScript runtime built on Chrome's V8 JavaScript engine. It discusses how Node.js uses an event-driven, non-blocking I/O model that makes it particularly suited for real-time web applications and I/O-intensive applications compared to traditional threaded server models. It provides examples of Node.js features like asynchronous I/O, event loops, modules and the npm package manager.
Node.js is an asynchronous event-driven JavaScript runtime that allows JavaScript to be used on the server-side. It uses a non-blocking I/O model that makes it suitable for real-time web applications. WebSockets provide a standardized way for the browser and server to establish two-way communication. However, not all browsers support WebSockets yet. Socket.io addresses this by providing a WebSocket-like experience across all browsers through fallbacks like long-polling. It allows real-time applications to be developed more easily.
Mathilde Lemée & Romain Maton
La théorie, c’est bien, la pratique … aussi !
Venez nous rejoindre pour découvrir les profondeurs de Node.js !
Nous nous servirons d’un exemple pratique pour vous permettre d’avoir une premiere experience complete autour de Node.js et de vous permettre de vous forger un avis sur ce serveur Javascript qui fait parler de lui !
http://soft-shake.ch/2011/conference/sessions/incubator/2011/09/01/hands-on-nodejs.html
A language for the Internet: Why JavaScript and Node.js is right for Internet...Tom Croucher
Increasingly we want to do more with the web and Internet applications we build. We have more features, more data, more users, more devices and all of it needs to be in real-time. With all of these demands how can we keep up? The answer is choosing a language and a platform that are optimized for the kind of architecture Internet and web applications really have. The traditional approach prioritises computation, assigning server resources before they are actually needed. JavaScript and Node.js both take an event driven approach only assigning resources to events as they happen. This allows us to make dramatic gains in performance and resource utilization while still having an environment which is fun and easy to program.
Basic Understanding and Implement of Node.jsGary Yeh
Node.js is an event-driven JavaScript runtime built on Chrome's V8 engine. It uses non-blocking I/O and an event loop to handle multiple connections simultaneously without blocking. The document discusses Node.js' event loop model and asynchronous I/O, how callbacks allow non-blocking operations, and how modules and frameworks like Express allow building scalable network applications.
Krzysztof Sobkowiak presented on serverless Java on Kubernetes. Serverless computing refers to building applications without server management by deploying functions that automatically scale in response to demand. Function as a Service (FaaS) platforms like Apache OpenWhisk allow running Java code as stateless functions on Kubernetes. OpenWhisk supports Java actions and integrates with services through triggers and rules to enable event-driven architectures. Spring Cloud Functions provides a framework for building serverless applications using Spring Boot and Java.
Richard Lee is an iOS, Ruby, and JavaScript developer and co-founder of Polydice, Inc. He gave an introduction to Node.js, an event-driven I/O framework for building scalable network applications. Node.js uses an event loop model and non-blocking I/O, making it fast and efficient for handling many concurrent connections. Common uses include building HTTP servers and implementing long polling or comet techniques. The community around Node.js is large and supportive, with many online resources and books available.
Node.js is an extremely light weight framework for rapidly developing and deploying next generation web and mobile apps. It enables developers to have full stack development. Not only does it save lines of code, but also saves a lot of time in writing those critical code.
Node.js is built on open source Chrome V8 engine. Its built on top of C++ layer. JS code is compiles into machine code for blazing execution on your machine or server.
This slide gives a jump start and a sneak peak for node.js.
About Parth:
Parth Joshi is a Tech - Entrepreneur and a Corporate Trainer. He has been part of two internet startups and has been lead technical architect and project manager. He has zeal for exploring new technology and how innovation solves problems of people at large. He currently acts as consultant for various startups. He also trains tech teams to make them startup ready. For more information about how Parth can train your team visit: www.parthjoshi.in/Training
Follow him on
Twitter: twitter.com/joshiparthin
Connect with him on LinkedIN : linkedin.com/in/joshiparthin
A language for the Internet: Why JavaScript and Node.js is right for Internet...Tom Croucher
Node.js and JavaScript are well-suited for Internet applications because Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, capable of supporting many more concurrent connections than traditional server-side models like Apache. This event loop system allows Node.js to handle multiple requests simultaneously without blocking any specific request. It also minimizes memory usage so more requests can be served from fewer servers.
The document discusses Node.js, which allows JavaScript to run outside the browser. Node.js has an event-loop approach that makes it easy to build scalable network servers in a non-blocking and asynchronous way. It uses an event model with callbacks to handle parallel input/output operations more efficiently than nested callbacks for serial operations. Modules and the EventEmitter class provide ways to organize code and handle events in Node.js applications.
Generative AI Use cases applications solutions and implementation.pdfmahaffeycheryld
Generative AI solutions encompass a range of capabilities from content creation to complex problem-solving across industries. Implementing generative AI involves identifying specific business needs, developing tailored AI models using techniques like GANs and VAEs, and integrating these models into existing workflows. Data quality and continuous model refinement are crucial for effective implementation. Businesses must also consider ethical implications and ensure transparency in AI decision-making. Generative AI's implementation aims to enhance efficiency, creativity, and innovation by leveraging autonomous generation and sophisticated learning algorithms to meet diverse business challenges.
https://www.leewayhertz.com/generative-ai-use-cases-and-applications/
Prediction of Electrical Energy Efficiency Using Information on Consumer's Ac...PriyankaKilaniya
Energy efficiency has been important since the latter part of the last century. The main object of this survey is to determine the energy efficiency knowledge among consumers. Two separate districts in Bangladesh are selected to conduct the survey on households and showrooms about the energy and seller also. The survey uses the data to find some regression equations from which it is easy to predict energy efficiency knowledge. The data is analyzed and calculated based on five important criteria. The initial target was to find some factors that help predict a person's energy efficiency knowledge. From the survey, it is found that the energy efficiency awareness among the people of our country is very low. Relationships between household energy use behaviors are estimated using a unique dataset of about 40 households and 20 showrooms in Bangladesh's Chapainawabganj and Bagerhat districts. Knowledge of energy consumption and energy efficiency technology options is found to be associated with household use of energy conservation practices. Household characteristics also influence household energy use behavior. Younger household cohorts are more likely to adopt energy-efficient technologies and energy conservation practices and place primary importance on energy saving for environmental reasons. Education also influences attitudes toward energy conservation in Bangladesh. Low-education households indicate they primarily save electricity for the environment while high-education households indicate they are motivated by environmental concerns.
Software Engineering and Project Management - Software Testing + Agile Method...Prakhyath Rai
Software Testing: A Strategic Approach to Software Testing, Strategic Issues, Test Strategies for Conventional Software, Test Strategies for Object -Oriented Software, Validation Testing, System Testing, The Art of Debugging.
Agile Methodology: Before Agile – Waterfall, Agile Development.
Software Engineering and Project Management - Introduction, Modeling Concepts...Prakhyath Rai
Introduction, Modeling Concepts and Class Modeling: What is Object orientation? What is OO development? OO Themes; Evidence for usefulness of OO development; OO modeling history. Modeling
as Design technique: Modeling, abstraction, The Three models. Class Modeling: Object and Class Concept, Link and associations concepts, Generalization and Inheritance, A sample class model, Navigation of class models, and UML diagrams
Building the Analysis Models: Requirement Analysis, Analysis Model Approaches, Data modeling Concepts, Object Oriented Analysis, Scenario-Based Modeling, Flow-Oriented Modeling, class Based Modeling, Creating a Behavioral Model.
Supermarket Management System Project Report.pdfKamal Acharya
Supermarket management is a stand-alone J2EE using Eclipse Juno program.
This project contains all the necessary required information about maintaining
the supermarket billing system.
The core idea of this project to minimize the paper work and centralize the
data. Here all the communication is taken in secure manner. That is, in this
application the information will be stored in client itself. For further security the
data base is stored in the back-end oracle and so no intruders can access it.
Accident detection system project report.pdfKamal Acharya
The Rapid growth of technology and infrastructure has made our lives easier. The
advent of technology has also increased the traffic hazards and the road accidents take place
frequently which causes huge loss of life and property because of the poor emergency facilities.
Many lives could have been saved if emergency service could get accident information and
reach in time. Our project will provide an optimum solution to this draw back. A piezo electric
sensor can be used as a crash or rollover detector of the vehicle during and after a crash. With
signals from a piezo electric sensor, a severe accident can be recognized. According to this
project when a vehicle meets with an accident immediately piezo electric sensor will detect the
signal or if a car rolls over. Then with the help of GSM module and GPS module, the location
will be sent to the emergency contact. Then after conforming the location necessary action will
be taken. If the person meets with a small accident or if there is no serious threat to anyone’s
life, then the alert message can be terminated by the driver by a switch provided in order to
avoid wasting the valuable time of the medical rescue team.
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Sinan KOZAK
Sinan from the Delivery Hero mobile infrastructure engineering team shares a deep dive into performance acceleration with Gradle build cache optimizations. Sinan shares their journey into solving complex build-cache problems that affect Gradle builds. By understanding the challenges and solutions found in our journey, we aim to demonstrate the possibilities for faster builds. The case study reveals how overlapping outputs and cache misconfigurations led to significant increases in build times, especially as the project scaled up with numerous modules using Paparazzi tests. The journey from diagnosing to defeating cache issues offers invaluable lessons on maintaining cache integrity without sacrificing functionality.
Null Bangalore | Pentesters Approach to AWS IAMDivyanshu
#Abstract:
- Learn more about the real-world methods for auditing AWS IAM (Identity and Access Management) as a pentester. So let us proceed with a brief discussion of IAM as well as some typical misconfigurations and their potential exploits in order to reinforce the understanding of IAM security best practices.
- Gain actionable insights into AWS IAM policies and roles, using hands on approach.
#Prerequisites:
- Basic understanding of AWS services and architecture
- Familiarity with cloud security concepts
- Experience using the AWS Management Console or AWS CLI.
- For hands on lab create account on [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
# Scenario Covered:
- Basics of IAM in AWS
- Implementing IAM Policies with Least Privilege to Manage S3 Bucket
- Objective: Create an S3 bucket with least privilege IAM policy and validate access.
- Steps:
- Create S3 bucket.
- Attach least privilege policy to IAM user.
- Validate access.
- Exploiting IAM PassRole Misconfiguration
-Allows a user to pass a specific IAM role to an AWS service (ec2), typically used for service access delegation. Then exploit PassRole Misconfiguration granting unauthorized access to sensitive resources.
- Objective: Demonstrate how a PassRole misconfiguration can grant unauthorized access.
- Steps:
- Allow user to pass IAM role to EC2.
- Exploit misconfiguration for unauthorized access.
- Access sensitive resources.
- Exploiting IAM AssumeRole Misconfiguration with Overly Permissive Role
- An overly permissive IAM role configuration can lead to privilege escalation by creating a role with administrative privileges and allow a user to assume this role.
- Objective: Show how overly permissive IAM roles can lead to privilege escalation.
- Steps:
- Create role with administrative privileges.
- Allow user to assume the role.
- Perform administrative actions.
- Differentiation between PassRole vs AssumeRole
Try at [killercoda.com](https://killercoda.com/cloudsecurity-scenario/)
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...shadow0702a
This document serves as a comprehensive step-by-step guide on how to effectively use PyCharm for remote debugging of the Windows Subsystem for Linux (WSL) on a local Windows machine. It meticulously outlines several critical steps in the process, starting with the crucial task of enabling permissions, followed by the installation and configuration of WSL.
The guide then proceeds to explain how to set up the SSH service within the WSL environment, an integral part of the process. Alongside this, it also provides detailed instructions on how to modify the inbound rules of the Windows firewall to facilitate the process, ensuring that there are no connectivity issues that could potentially hinder the debugging process.
The document further emphasizes on the importance of checking the connection between the Windows and WSL environments, providing instructions on how to ensure that the connection is optimal and ready for remote debugging.
It also offers an in-depth guide on how to configure the WSL interpreter and files within the PyCharm environment. This is essential for ensuring that the debugging process is set up correctly and that the program can be run effectively within the WSL terminal.
Additionally, the document provides guidance on how to set up breakpoints for debugging, a fundamental aspect of the debugging process which allows the developer to stop the execution of their code at certain points and inspect their program at those stages.
Finally, the document concludes by providing a link to a reference blog. This blog offers additional information and guidance on configuring the remote Python interpreter in PyCharm, providing the reader with a well-rounded understanding of the process.
Height and depth gauge linear metrology.pdfq30122000
Height gauges may also be used to measure the height of an object by using the underside of the scriber as the datum. The datum may be permanently fixed or the height gauge may have provision to adjust the scale, this is done by sliding the scale vertically along the body of the height gauge by turning a fine feed screw at the top of the gauge; then with the scriber set to the same level as the base, the scale can be matched to it. This adjustment allows different scribers or probes to be used, as well as adjusting for any errors in a damaged or resharpened probe.
3. http://gee.cs.oswego.edu
Network Services
" Web services, Distributed Objects, etc
" Most have same basic structure:
Read request
Decode request
Process service
Encode reply
Send reply
" But differ in nature and cost of each step
XML parsing, File transfer, Web page
generation, computational services, ...
5. http://gee.cs.oswego.edu
Classic ServerSocket Loop
class Server implements Runnable {
public void run() {
try {
ServerSocket ss = new ServerSocket(PORT);
while (!Thread.interrupted())
new Thread(new Handler(ss.accept())).start();
// or, single-threaded, or a thread pool
} catch (IOException ex) { /* ... */ }
}
static class Handler implements Runnable {
final Socket socket;
Handler(Socket s) { socket = s; }
public void run() {
try {
byte[] input = new byte[MAX_INPUT];
socket.getInputStream().read(input);
byte[] output = process(input);
socket.getOutputStream().write(output);
} catch (IOException ex) { /* ... */ }
}
private byte[] process(byte[] cmd) { /* ... */ }
}
}
Note: most exception handling elided from code examples
6. http://gee.cs.oswego.edu
Scalability Goals
" Graceful degradation under increasing load
(more clients)
" Continuous improvement with increasing
resources (CPU, memory, disk, bandwidth)
" Also meet availability and performance goals
Short latencies
Meeting peak demand
Tunable quality of service
" Divide-and-conquer is usually the best
approach for achieving any scalability goal
7. http://gee.cs.oswego.edu
Divide and Conquer
" Divide processing into small tasks
Each task performs an action without blocking
" Execute each task when it is enabled
Here, an IO event usually serves as trigger
" Basic mechanisms supported in java.nio
Non-blocking reads and writes
Dispatch tasks associated with sensed IO events
" Endless variation possible
A family of event-driven designs
read decode compute encode send
handler
8. http://gee.cs.oswego.edu
Event-driven Designs
" Usually more efficient than alternatives
Fewer resources
" Don't usually need a thread per client
Less overhead
" Less context switching, often less locking
But dispatching can be slower
" Must manually bind actions to events
" Usually harder to program
Must break up into simple non-blocking actions
" Similar to GUI event-driven actions
" Cannot eliminate all blocking: GC, page faults, etc
Must keep track of logical state of service
9. http://gee.cs.oswego.edu
Background: Events in AWT
Event
Event
Button
public void actionPerformed(...) {
doSomething();
}
ActionListener
AWT thread
AWT Event Queue
Event-driven IO uses similar ideas but in different designs
...
click!
10. http://gee.cs.oswego.edu
Reactor Pattern
" Reactor responds to IO events by dispatching
the appropriate handler
Similar to AWT thread
" Handlers perform non-blocking actions
Similar to AWT ActionListeners
" Manage by binding handlers to events
Similar to AWT addActionListener
" See Schmidt et al, Pattern-Oriented Software
Architecture, Volume 2 (POSA2)
Also Richard Stevens's networking books, Matt
Welsh's SEDA framework, etc
12. http://gee.cs.oswego.edu
java.nio Support
" Channels
Connections to files, sockets etc that support
non-blocking reads
" Buffers
Array-like objects that can be directly read or
written by Channels
" Selectors
Tell which of a set of Channels have IO events
" SelectionKeys
Maintain IO event status and bindings
13. http://gee.cs.oswego.edu
Reactor 1: Setup
class Reactor implements Runnable {
final Selector selector;
final ServerSocketChannel serverSocket;
Reactor(int port) throws IOException {
selector = Selector.open();
serverSocket = ServerSocketChannel.open();
serverSocket.socket().bind(
new InetSocketAddress(port));
serverSocket.configureBlocking(false);
SelectionKey sk =
serverSocket.register(selector,
SelectionKey.OP_ACCEPT);
sk.attach(new Acceptor());
}
/*
Alternatively, use explicit SPI provider:
SelectorProvider p = SelectorProvider.provider();
selector = p.openSelector();
serverSocket = p.openServerSocketChannel();
*/
14. http://gee.cs.oswego.edu
Reactor 2: Dispatch Loop
// class Reactor continued
public void run() { // normally in a new
Thread
try {
while (!Thread.interrupted()) {
selector.select();
Set selected = selector.selectedKeys();
Iterator it = selected.iterator();
while (it.hasNext())
dispatch((SelectionKey)(it.next());
selected.clear();
}
} catch (IOException ex) { /* ... */ }
}
void dispatch(SelectionKey k) {
Runnable r = (Runnable)(k.attachment());
if (r != null)
r.run();
}
15. http://gee.cs.oswego.edu
Reactor 3: Acceptor
// class Reactor continued
class Acceptor implements Runnable { // inner
public void run() {
try {
SocketChannel c = serverSocket.accept();
if (c != null)
new Handler(selector, c);
}
catch(IOException ex) { /* ... */ }
}
}
}
client
client
client
read decode compute encode send
read decode compute encode send
read decode compute encode send
Reactor
acceptor
dispatch
16. http://gee.cs.oswego.edu
Reactor 4: Handler setup
final class Handler implements Runnable {
final SocketChannel socket;
final SelectionKey sk;
ByteBuffer input = ByteBuffer.allocate(MAXIN);
ByteBuffer output = ByteBuffer.allocate(MAXOUT);
static final int READING = 0, SENDING = 1;
int state = READING;
Handler(Selector sel, SocketChannel c)
throws IOException {
socket = c; c.configureBlocking(false);
// Optionally try first read now
sk = socket.register(sel, 0);
sk.attach(this);
sk.interestOps(SelectionKey.OP_READ);
sel.wakeup();
}
boolean inputIsComplete() { /* ... */ }
boolean outputIsComplete() { /* ... */ }
void process() { /* ... */ }
17. http://gee.cs.oswego.edu
Reactor 5: Request handling
// class Handler continued
public void run() {
try {
if (state == READING) read();
else if (state == SENDING) send();
} catch (IOException ex) { /* ... */ }
}
void read() throws IOException {
socket.read(input);
if (inputIsComplete()) {
process();
state = SENDING;
// Normally also do first write now
sk.interestOps(SelectionKey.OP_WRITE);
}
}
void send() throws IOException {
socket.write(output);
if (outputIsComplete()) sk.cancel();
}
}
18. http://gee.cs.oswego.edu
Per-State Handlers
" A simple use of GoF State-Object pattern
Rebind appropriate handler as attachment
class Handler { // ...
public void run() { // initial state is reader
socket.read(input);
if (inputIsComplete()) {
process();
sk.attach(new Sender());
sk.interest(SelectionKey.OP_WRITE);
sk.selector().wakeup();
}
}
class Sender implements Runnable {
public void run(){ // ...
socket.write(output);
if (outputIsComplete()) sk.cancel();
}
}
}
19. http://gee.cs.oswego.edu
Multithreaded Designs
" Strategically add threads for scalability
Mainly applicable to multiprocessors
" Worker Threads
Reactors should quickly trigger handlers
" Handler processing slows down Reactor
Offload non-IO processing to other threads
" Multiple Reactor Threads
Reactor threads can saturate doing IO
Distribute load to other reactors
" Load-balance to match CPU and IO rates
20. http://gee.cs.oswego.edu
Worker Threads
" Offload non-IO processing to speed up
Reactor thread
Similar to POSA2 Proactor designs
" Simpler than reworking compute-bound
processing into event-driven form
Should still be pure nonblocking computation
" Enough processing to outweigh overhead
" But harder to overlap processing with IO
Best when can first read all input into a buffer
" Use thread pool so can tune and control
Normally need many fewer threads than clients
22. http://gee.cs.oswego.edu
Handler with Thread Pool
class Handler implements Runnable {
// uses util.concurrent thread pool
static PooledExecutor pool = new PooledExecutor(...);
static final int PROCESSING = 3;
// ...
synchronized void read() { // ...
socket.read(input);
if (inputIsComplete()) {
state = PROCESSING;
pool.execute(new Processer());
}
}
synchronized void processAndHandOff() {
process();
state = SENDING; // or rebind attachment
sk.interest(SelectionKey.OP_WRITE);
}
class Processer implements Runnable {
public void run() { processAndHandOff(); }
}
}
23. http://gee.cs.oswego.edu
Coordinating Tasks
" Handoffs
Each task enables, triggers, or calls next one
Usually fastest but can be brittle
" Callbacks to per-handler dispatcher
Sets state, attachment, etc
A variant of GoF Mediator pattern
" Queues
For example, passing buffers across stages
" Futures
When each task produces a result
Coordination layered on top of join or wait/notify
24. http://gee.cs.oswego.edu
Using PooledExecutor
" A tunable worker thread pool
" Main method execute(Runnable r)
" Controls for:
The kind of task queue (any Channel)
Maximum number of threads
Minimum number of threads
"Warm" versus on-demand threads
Keep-alive interval until idle threads die
" to be later replaced by new ones if necessary
Saturation policy
" block, drop, producer-runs, etc
25. http://gee.cs.oswego.edu
Multiple Reactor Threads
" Using Reactor Pools
Use to match CPU and IO rates
Static or dynamic construction
" Each with own Selector, Thread, dispatch loop
Main acceptor distributes to other reactors
Selector[] selectors; // also create threads
int next = 0;
class Acceptor { // ...
public synchronized void run() { ...
Socket connection = serverSocket.accept();
if (connection != null)
new Handler(selectors[next], connection);
if (++next == selectors.length) next = 0;
}
}
27. http://gee.cs.oswego.edu
Using other java.nio features
" Multiple Selectors per Reactor
To bind different handlers to different IO events
May need careful synchronization to coordinate
" File transfer
Automated file-to-net or net-to-file copying
" Memory-mapped files
Access files via buffers
" Direct buffers
Can sometimes achieve zero-copy transfer
But have setup and finalization overhead
Best for applications with long-lived connections
28. http://gee.cs.oswego.edu
Connection-Based Extensions
" Instead of a single service request,
Client connects
Client sends a series of messages/requests
Client disconnects
" Examples
Databases and Transaction monitors
Multi-participant games, chat, etc
" Can extend basic network service patterns
Handle many relatively long-lived clients
Track client and session state (including drops)
Distribute services across multiple hosts
30. http://gee.cs.oswego.edu
Buffer
abstract class Buffer {
int capacity();
int position();
Buffer position(int newPosition);
int limit();
Buffer limit(int newLimit);
Buffer mark();
Buffer reset();
Buffer clear();
Buffer flip();
Buffer rewind();
int remaining();
boolean hasRemaining();
boolean isReadOnly();
}
position capacitylimit
mark
a b c
37. http://gee.cs.oswego.edu
FileChannel
abstract class FileChannel implements ... {
int read(ByteBuffer dst);
int read(ByteBuffer dst, long position);
int read(ByteBuffer[] dsts, int offset, int length);
int read(ByteBuffer[] dsts);
int write(ByteBuffer src);
int write(ByteBuffer src, long position);
int write(ByteBuffer[] srcs, int offset, int length);
int write(ByteBuffer[] srcs);
long position();
void position(long newPosition);
long size();
void truncate(long size);
void force(boolean flushMetaDataToo);
int transferTo(long position, int count,
WritableByteChannel dst);
int transferFrom(ReadableByteChannel src,
long position, int count);
FileLock lock(long position, long size, boolean shared);
FileLock lock();
FileLock tryLock(long pos, long size, boolean shared);
FileLock tryLock();
static final int MAP_RO, MAP_RW, MAP_COW;
MappedByteBuffer map(int mode, long position, int size);
}
NOTE: ALL methods throw IOException
38. http://gee.cs.oswego.edu
Selector
abstract class Selector {
static Selector open() throws IOException;
Set keys();
Set selectedKeys();
int selectNow() throws IOException;
int select(long timeout) throws IOException;
int select() throws IOException;
void wakeup();
void close() throws IOException;
}
39. http://gee.cs.oswego.edu
SelectionKey
abstract class SelectionKey {
static final int OP_READ, OP_WRITE,
OP_CONNECT, OP_ACCEPT;
SelectableChannel channel();
Selector selector();
boolean isValid();
void cancel();
int interestOps();
void interestOps(int ops);
int readyOps();
boolean isReadable();
boolean isWritable();
boolean isConnectable();
boolean isAcceptable();
Object attach(Object ob);
Object attachment();
}