- 博客(31)
- 资源 (1)
- 收藏
- 关注
转载 40个Java多线程问题总结
转自:http://www.cnblogs.com/xrq730/p/5060921.html前言Java多线程分类中写了21篇多线程的文章,21篇文章的内容很多,个人认为,学习,内容越多、越杂的知识,越需要进行深刻的总结,这样才能记忆深刻,将知识变成自己的。这篇文章主要是对多线程的问题进行总结的,因此罗列了40个多线程的问题。这些多线程的问题,有些来源于各大网站、有些来源
2016-11-20 21:45:14 344
转载 用java语言实现事件委托模式
事件委托模式是一个比较常用的设计模式,但是Java语言本身没有对其做一定的封装,因此实现起来有一定难度(了解原理后很简单),相比之下.NET就容易了很多。身为一个Java爱好者,怎么向这样一个小困难低头,但是上网搜索,却没发现相关解决方案,得,自己来做一个封装吧。其实结合例子更好,那么我就用一个小例子来引出这种设计模式。一个班级,有两类学生,A类:不学习,玩,但是玩的东西不一样,有的是
2016-11-18 00:00:45 494
转载 ConcurrentHashMap源码分析--Java8
本文首写于有道云笔记,并在小组分享会分享,先整理发布,希望和大家交流探讨。云笔记地址概述:1、设计首要目的:维护并发可读性(get、迭代相关);次要目的:使空间消耗比HashMap相同或更好,且支持多线程高效率的初始插入(empty table)。2、HashTable线程安全,但采用synchronized,多线程下效率低下。线程1put时,线程2无法put或get。
2016-11-09 19:55:19 876
转载 闭锁/栅栏/信号量/FutureTask分析及使用
1、闭锁 用途:可用于命令一组线程在同一个时刻开始执行某个任务,或者等待一组相关的操作结束。尤其适合计算并发执行某个任务的耗时。 Java代码 public class CountDownLatchTest { public void timeTasks(int nThreads, final Runnable task) throws Inte
2016-11-09 01:57:04 955
转载 OSGI (面向Java的动态模型系统)
OSGi(Open Service Gateway Initiative)技术是Java动态化模块化系统的一系列规范。OSGi一方面指维护OSGi规范的OSGI官方联盟,另一方面指的是该组织维护的基于Java语言的服务(业务)规范。简单来说,OSGi可以认为是Java平台的模块层。OSGi服务平台向Java提供服务,这些服务使Java成为软件集成和软件开发的首选环境。Java提供在多个平台
2016-11-08 21:22:16 2160
转载 Java的SPI机制与简单的示例
一、SPI机制这里先说下SPI的一个概念,SPI英文为Service Provider Interface单从字面可以理解为Service提供者接口,正如从SPI的名字去理解SPI就是Service提供者接口;我对SPI的定义:提供给服务提供厂商与扩展框架功能的开发者使用的接口。在我们日常开发的时候都是对问题进行抽象成Api然后就提供各种Api的实现,这些Api的实现都是封装与我们
2016-11-08 21:12:32 403
转载 spi协议及工作原理分析
说明.文章摘自:SPI协议及其工作原理浅析 http://bbs.chinaunix.NET/thread-1916003-1-1.html一、概述. SPI, Serial Perripheral Interface, 串行外围设备接口, 是 Motorola 公司推出的一种同步串行接口技术. SPI 总线在物理上是通过接在外围设备微控制器(PICmicro) 上面的微处
2016-11-08 21:10:10 445
转载 理解MySQL——索引与优化
原文转自:http://www.cnblogs.com/hustcat/archive/2009/10/28/1591648.html写在前面:索引对查询的速度有着至关重要的影响,理解索引也是进行数据库性能调优的起点。考虑如下情况,假设数据库中一个表有10^6条记录,DBMS的 页面大小为4K,并存储100条记录。如果没有索引,查询将对整个表进行扫描,最坏的情况下,如果所有数据页都不在内存
2016-11-08 01:53:54 460
转载 Java NIO浅析
NIO(Non-blocking I/O,在Java领域,也称为New I/O),是一种同步非阻塞的I/O模型,也是I/O多路复用的基础,已经被越来越多地应用到大型应用服务器,成为解决高并发与大量连接、I/O处理问题的有效方式。那么NIO的本质是什么样的呢?它是怎样与事件模型结合来解放线程、提高系统吞吐的呢?本文会从传统的阻塞I/O和线程池模型面临的问题讲起,然后对比几种常见I/O
2016-11-08 00:25:05 954
转载 MySQL索引原理及慢查询优化
MySQL凭借着出色的性能、低廉的成本、丰富的资源,已经成为绝大多数互联网公司的首选关系型数据库。虽然性能出色,但所谓“好马配好鞍”,如何能够更好的使用它,已经成为开发工程师的必修课,我们经常会从职位描述上看到诸如“精通MySQL”、“SQL语句优化”、“了解数据库原理”等要求。我们知道一般的应用系统,读写比例在10:1左右,而且插入操作和一般的更新操作很少出现性能问题,遇到最多的,也是最容易出问
2016-11-07 23:56:47 401
转载 B-树,B+树,B*树详解
B-树B-树是一种多路搜索树(并不一定是二叉的)1970年,R.Bayer和E.mccreight提出了一种适用于外查找的树,它是一种平衡的多叉树,称为B树(或B-树、B_树)。一棵m阶B树(balanced tree of order m)是一棵平衡的m路搜索树。它或者是空树,或者是满足下列性质的树:1、根结点至少有两个子女;2、每个非根节点所包含的关键字
2016-11-07 23:17:04 53610 3
转载 AQS详解
一、概述 谈到并发,不得不谈ReentrantLock;而谈到ReentrantLock,不得不谈AbstractQueuedSynchronized(AQS)! 类如其名,抽象的队列式的同步器,AQS定义了一套多线程访问共享资源的同步器框架,许多同步类实现都依赖于它,如常用的ReentrantLock/Semaphore/CountDownLatch...。 以下是本文的目录大
2016-11-02 21:51:57 437
转载 JAVA CAS原理深度分析
看了一堆文章,终于把JAVA CAS的原理深入分析清楚了。感谢GOOGLE强大的搜索,借此挖苦下百度,依靠百度什么都学习不到! 参考文档:http://www.blogjava.net/xylz/archive/2010/07/04/325206.htmlhttp://blog.hesey.net/2011/09/resolve-aba-by-atomics
2016-11-02 21:29:04 275
转载 【Java线程】Java内存模型总结
学习资料:http://www.infoq.com/cn/articles/Java-memory-model-1Java的并发采用的是共享内存模型(而非消息传递模型),线程之间共享程序的公共状态,线程之间通过写-读内存中的公共状态来隐式进行通信。多个线程之间是不能直接传递数据交互的,它们之间的交互只能通过共享变量来实现同步是显式进行的。程序员必须显式指定某个方法或某段
2016-11-02 01:18:11 247
转载 桥接模式和适配器模式的区别
很多时候经常容易把桥接模式和适配器模式弄混。那什么时候用桥接,什么时候用适配器呢 ?共同点桥接和适配器都是让两个东西配合工作不同点出发点不同。 1)适配器:改变已有的两个接口,让他们相容。 2)桥接模式:分离抽象化和实现,使两者的接口可以不同,目的是分离。 所以说,如果你拿到两个已有模块,想让
2016-11-02 00:37:02 358
转载 Semaphore
The java.util.concurrent.Semaphore class is a counting semaphore. That means that it has two main methods:acquire()release()The counting semaphore is initialized with a given number of "perm
2016-11-01 23:48:04 367
转载 Exchanger
ExchangerThe java.util.concurrent.Exchanger class represents a kind of rendezvous point where two threads can exchange objects. Here is an illustration of this mechanism:Two threads
2016-11-01 23:47:35 267
转载 CyclicBarrier
The java.util.concurrent.CyclicBarrier class is a synchronization mechanism that can synchronize threads progressing through some algorithm. In other words, it is a barrier that all threads must wait
2016-11-01 23:47:13 227
转载 CountDownLatch
A java.util.concurrent.CountDownLatch is a concurrency construct that allows one or more threads to wait for a given set of operations to complete.A CountDownLatch is initialized with a given coun
2016-11-01 23:46:48 303
转载 ConcurrentNavigableMap
The java.util.concurrent.ConcurrentNavigableMap class is a java.util.NavigableMap with support for concurrent access, and which has concurrent access enabled for its submaps. The "submaps" are the m
2016-11-01 23:46:20 491
转载 ConcurrentMap
java.util.concurrent.ConcurrentMapThe java.util.concurrent.ConcurrentMap interface represents a Map which is capable of handling concurrent access (puts and gets) to it.The ConcurrentMap has
2016-11-01 23:45:52 355
转载 LinkedBlockingDeque
The LinkedBlockingDeque class implements the BlockingDeque interface. Read the BlockingDeque text for more information about the interface.The word Deque comes from the term "Double Ended Queu
2016-11-01 23:45:03 336
转载 BlockingDeque
The BlockingDeque interface in the java.util.concurrent class represents a deque which is thread safe to put into, and take instances from. In this text I will show you how to use this BlockingDeque.
2016-11-01 23:44:24 445
转载 SynchronousQueue
The SynchronousQueue class implements the BlockingQueue interface. Read the BlockingQueue text for more information about the interface.The SynchronousQueue is a queue that can only contain a
2016-11-01 23:43:58 203
转载 PriorityBlockingQueue
The PriorityBlockingQueue class implements the BlockingQueue interface. Read the BlockingQueue text for more information about the interface.The PriorityBlockingQueue is an unbounded concurren
2016-11-01 23:42:26 292
转载 LinkedBlockingQueue
The LinkedBlockingQueue class implements the BlockingQueue interface. Read the BlockingQueue text for more information about the interface.The LinkedBlockingQueue keeps the elements internally
2016-11-01 23:41:58 233
转载 DelayQueue
DelayQueue class implements the BlockingQueue interface. Read the BlockingQueue text for more information about the interface.The DelayQueue blocks the elements internally until a certain
2016-11-01 23:41:34 270
转载 ArrayBlockingQueue
The ArrayBlockingQueue class implements the BlockingQueue interface. Read the BlockingQueue text for more information about the interface.ArrayBlockingQueue is a bounded, blocking queue that s
2016-11-01 23:41:03 379
转载 BlockingQueue
The Java BlockingQueue interface in the java.util.concurrent package represents a queue which is thread safe to put into, and take instances from. In this text I will show you how to use this Blocki
2016-11-01 23:40:36 308
转载 Java Lambda Expressions
Java lambda expressions are new in Java 8. Java lambda expressions are Java's first step into functional programming. A Java lambda expression is thus a function which can be created without belonging
2016-11-01 23:38:35 1524
转载 九大基础排序总结与对比
一、对比分析图均按从小到大排列k代表数值中的”数位”个数n代表数据规模m代表数据的最大值减最小值 稳定性:稳定排序算法会让原本有相等键值的纪录维持相对次序。也就是如果一个排序算法是稳定的,当有两个相等键值的纪录R和S,且在原本的列表中R出现在S之前,在排序过的列表中R也将会是在S之前。二
2016-11-01 19:22:31 341
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人