- 博客(22)
- 资源 (2)
- 收藏
- 关注
转载 Java NIO(13-NIO vs. IO)
When studying both the Java NIO and IO API's, a question quickly pops into mind:When should I use IO and when should I use NIO?In this text I will try to shed some light on the differences bet
2013-10-27 19:13:35 656
转载 Java NIO(12-Pipe)
A Java NIO Pipe is a one-way data connection between two threads. A Pipe has a source channel and a sink channel. You write data to the sink channel. This data can then be read from the source channel
2013-10-27 19:12:29 609
转载 Java NIO(11-DatagramChannel)
A Java NIO DatagramChannel is a channel that can send and receive UDP packets. Since UDP is a connection-less network protocol, you cannot just by default read and write to a DatagramChannel like you
2013-10-27 19:11:39 449
转载 Java NIO(10-ServerSocketChannel)
A Java NIO ServerSocketChannel is a channel that can listen for incoming TCP connections, just like a ServerSocketin standard Java IO. The ServerSocketChannel class is located in the java.nio.channe
2013-10-27 19:10:52 500
转载 Java NIO(9-Socket Channel)
A Java NIO SocketChannel is a channel that is connected to a TCP network socket. There are two ways aSocketChannel can be created:You open a SocketChannel and connect to a server somewhere on the
2013-10-27 19:10:01 528
转载 Java NIO(8-FileChannel)
A Java NIO FileChannel is a channel that is connected to a file. Using a file channel you can read data from a file, and write data to a file.A FileChannel cannot be set into non-blocking mode. It
2013-10-27 19:09:03 513
转载 Java NIO(7-Selector)
A Selector is a Java NIO component which can examine one or more NIO Channel's, and determine which channels are ready for e.g. reading or writing. This way a single thread can manage multiple channel
2013-10-27 19:08:01 507
转载 Java NIO(6-Channel to Channel Transfers)
In Java NIO you can transfer data directly from one channel to another, if one of the channels is a FileChannel. TheFileChannel class has a transferTo() and a transferFrom() method which does this f
2013-10-27 19:06:13 478
转载 Java NIO(5-Scatter / Gather)
Java NIO comes with built-in scatter / gather support. Scatter / gather are concepts used in reading from, and writing to channels.A scattering read from a channel is a read operation that reads d
2013-10-27 19:04:58 529
转载 Java NIO(4-Buffer)
Java NIO Buffers are used when interacting with NIO Channels. As you know, data is read from channels into buffers, and written from buffers into channels.A buffer is essentially a block of memory
2013-10-27 19:03:04 547
转载 Java NIO(3-Channel)
Java NIO Channels are similar to streams with a few differences:You can both read and write to a Channels. Streams are typically one-way (read or write).Channels can be read and written asynchrono
2013-10-27 19:00:56 493
转载 Java NIO(2-Overview)
Java NIO consist of the following core components:ChannelsBuffersSelectorsJava NIO has more classes and components than these, but the Channel, Buffer and Selector forms the core of the API,
2013-10-27 18:59:46 532
转载 Java NIO(1-Introduction)
Java NIO (New IO) is an alternative IO API for Java (from Java 1.4), meaning alternative to the standard Java IO API's. Java NIO offers a different way of working with IO than the standard IO API's.
2013-10-27 18:57:27 623
转载 Java单例模式在多线程环境中的实现
在Java开发中,如果某个实例的创建需要消耗很多系统资源,那么我们通常会使用惰性加载机制,也就是说只有当使用到这个实例的时候才会创建这个实例,这个好处在单例模式中得到了广泛应用。该机制在single-threaded(单线程)环境下的实现非常简单,然而在multi-threaded(多线程)环境下却存在隐患。本文重点介绍惰性加载机制以及其在多线程环境下的使用方法。(作者numberzero,参考I
2013-10-20 16:16:11 709
转载 Spring Bean scopes
4.4 Bean scopesWhen you create a bean definition what you are actually creating is a recipe for creating actual instances of the class defined by that bean definition. The idea that a bean d
2013-10-16 16:07:40 780
转载 ByteBuffer.allocate() vs. ByteBuffer.allocateDirect()
Ron Hitches in his excellent book Java NIO seems to offer what I thought could be a good answer to this question:Operating systems perform I/O operations on memory areas. These memory areas, a
2013-10-12 17:29:59 886
转载 EJB 3 Introduction
EJB 3 IntroductionAn EJB platform is for building portable, reusable and scalable business applications using the Java programming language. EJB is a component or framework that lets you build ent
2013-10-10 19:41:35 747
转载 The difference between NoClassDefFoundError and ClassNotFoundException
The difference from the Java API Specifications is as follows.For ClassNotFoundException:Thrown when an application tries to load in a class through its string name using:The forName m
2013-10-10 19:01:14 724
原创 Java线程的5种状态及切换
Java中的线程的生命周期大体可分为5种状态。①NEW:这种情况指的是,通过New关键字创建了Thread类(或其子类)的对象②RUNNABLE:这种情况指的是Thread类的对象调用了start()方法,这时的线程就等待时间片轮转到自己这,以便获得CPU;第二种情况是线程在处于RUNNABLE状态时并没有运行完自己的run方法,时间片用完之后回到RUNNABLE状态;还有种情况就
2013-10-10 07:51:27 969
转载 Java heap terminology: young, old and permanent generations
This seems like a common misunderstanding. In Oracle's JVM, the permanent generation is not part of the heap. It's a separate space for class definitions and related data. In Java 6 and earlier, inter
2013-10-09 17:57:10 1387
转载 深入探讨 Java 类加载器
类加载器(class loader)是 Java™中的一个很重要的概念。类加载器负责加载 Java 类的字节代码到 Java 虚拟机中。本文首先详细介绍了 Java 类加载器的基本概念,包括代理模式、加载类的具体过程和线程上下文类加载器等,接着介绍如何开发自己的类加载器,最后介绍了类加载器在 Web 容器和 OSGi™中的应用。类加载器是 Java 语言的一个创新,也是 Java
2013-10-07 19:22:49 706
转载 EJB invocations from a remote client using JNDI
This chapter explains how to invoke EJBs from a remote client by using the JNDI API to first lookup the bean proxy and then invoke on that proxy.After you have read this article, do re
2013-10-02 23:02:33 1242
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人