自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 资源 (2)
  • 收藏
  • 关注

原创 BubbleSort

这个算法的名字由来是因为越小的元素会经由交换慢慢“浮”到数列的顶端,故名。冒泡排序算法的运作如下:(从后往前)比较相邻的元素。如果第一个比第二个大,就交换他们两个。对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对。在这一点,最后的元素应该会是最大的数。针对所有的元素重复以上的步骤,除了最后一个。持续每次对越来越少的元素重复上面的步骤,直到没

2014-04-30 17:12:11 448

转载 可扩展性设计之数据切分

前言通过MySQLReplication功能所实现的扩展总是会受到数据库大小的限制,一旦数据库过于庞大,尤其是当写入过于频繁,很难由一台主机支撑的时候,我们还是会面临到扩展瓶颈。这时候,我们就必须许找其他技术手段来解决这个瓶颈,那就是我们这一章所要介绍恶的数据切分技术。 何谓数据切分可能很多读者朋友在网上或者杂志上面都已经多次见到关于数据切分的相关文章了,只不过在有

2014-04-29 18:23:57 592

转载 数据库水平切分的实现原理解析

第1章  引言随着互联网应用的广泛普及,海量数据的存储和访问成为了系统设计的瓶颈问题。对于一个大型的互联网应用,每天几十亿的PV无疑对数据库造成了相当高的负载。对于系统的稳定性和扩展性造成了极大的问题。通过数据切分来提高网站性能,横向扩展数据层已经成为架构研发人员首选的方式。水平切分数据库,可以降低单台机器的负载,同时最大限度的降低了了宕机造成的损失。通过负载均衡策略,有效的降低了单台机器

2014-04-29 18:21:52 443

转载 JBoss AS 7 classloading explained

As mandated by Java EE specifications, an application server should ideally give its deployed applications the freedom to use whatever utility library and whatever version of it, regardless of the pre

2014-04-28 17:20:33 675

转载 Java 位运算符

位运算符用来对二进制位进行操作 ,Java中提 供 了 如 下所 示 的 位 运 算符 : 位 运 算 符 (>>,<<,>>>,&,|,^,~ ) ,位运 算 符 中 ,除 ~ 以 外 ,其余 均 为 二 元 运 算 符 。 操 作 数 只 能 为 整 型 和字 符 型 数 据 。 基础知识 补码 所有的整数类型(除了char 类型之外)都是有符号的整数。这意味着

2014-04-25 13:56:42 368

转载 JAVA基础(JAVA移位运算符)

移位运算符就是在二进制的基础上对数字进行平移。按照平移的方向和填充数字的规则分为三种:>(带符号右移)和>>>(无符号右移)。  在移位运算时,byte、short和char类型移位后的结果会变成int类型,对于byte、short、char和int进行移位时,规定实际移动的次数是移动次数和32的余数,也就是移位33次和移位1次得到的结果相同。移动long型的数值时,规定实际移动的次数是移动次

2014-04-25 13:54:15 386

转载 Binary Search(二分法查找)

/** * Searches the specified array of ints for the specified value using the * binary search algorithm. The array must be sorted (as * by the {@link #sort(int[])} method) prior to maki

2014-04-24 17:01:39 545

转载 探讨如何解决数据库中的死锁问题

所谓死锁: 是指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去.此时称系统处于死锁状态或系统产生了死锁,这些永远在互相等待的进程称为死锁进程.由于资源占用是互斥的,当某个进程提出申请资源后,使得有关进程在无外力协助下,永远分配不到必需的资源而无法继续运行,这就产生了一种特殊现象死锁。 一种情形,此时执行程序中两个或多个线程

2014-04-23 15:35:39 900

转载 TransactionAttributeType(transaction propagation behaviors)

The enum TransactionAttributeType is used with the TransactionAttribute annotation to specify whether the methods of a session bean or message driven bean are called with a valid transaction context

2014-04-17 14:32:02 756

转载 Mergesort in Java

1. Mergesort1.1. OverviewThe Mergesort algorithm can be used to sort a collection of objects. Mergesort is so calleddivide and conquer algorithm. Divide and conquer algorithms divide t

2014-04-11 17:09:05 552

原创 遍历文件目录结构

public class TraverseDirectory { public static void traverse(File file) { LinkedList queue = new LinkedList<>(); queue.push(file); while (!queue.isEmpty()) { File f = queue.pop(); Syste

2014-04-11 12:58:08 569

原创 和最大的连续子数组

public class SubArrayWithMaxSum { public static int maxSumofSubArray(int[] src) { int curSum = 0; int maxSum = src[0]; for (int i = 0; i < src.length; i++) { if (curSum >= 0) { curSum

2014-04-11 12:55:45 428

转载 (前、中、后)序遍历二叉树的递归、非递归算法!

[java] view plaincopypackage tree;    import java.util.Stack;    // 二叉树节点   class BTNode {      private char key;      private BTNode left, right;      public BTNode(ch

2014-04-11 11:25:49 502

转载 Linux系统Load average负载详细解释

我们知道判断一个系统的负载可以使用top,uptime等命令去查看,它分别记录了一分钟、五分钟、以及十五分钟的系统平均负载例如我的某台服务器:$ uptime09:50:21 up 200 days, 15:07, 1 user, load average: 0.27, 0.33, 0.37大部分的人都认为这个数字越小越好,其实有很多关联的提示信息,今天看到这个好文

2014-04-10 15:48:14 500

转载 浅谈Java泛型中的extends和super关键字

泛型是在Java 1.5中被加入了,这里不讨论泛型的细节问题,这个在Thinking in Java第四版中讲的非常清楚,这里要讲的是super和extends关键字,以及在使用这两个关键字的时候为什么会不同的限制。    首先,我们定义两个类,A和B,并且假设B继承自A。下面的代码中,定义了几个静态泛型方法,这几个例子随便写的,并不是特别完善,我们主要考量编译失败的问题: Jav

2014-04-10 15:10:47 476

转载 difference between <? super T> and <? extends T> in Java

extendsThe wildcard declaration of List<? extends Number> foo3 means that any of these are legal assignments:List extends Number> foo3 = new ArrayListNumber>; // Number "extends" Number (in t

2014-04-10 12:53:56 495

转载 Difference between HashMap, LinkedHashMap and TreeMap in Java

All the three represent mapping from unique keys to values, and therefore implement the Map interface.1) HashMap is a map based on hashing of the keys. It makes absolutely no guarantees about th

2014-04-09 16:41:11 535

转载 How to Iterate Over a Map in Java

There are several ways of iterating over a Map in Java. Lets go over the most common methods and review their advantages and disadvantages. Since all maps in Java implement Mapinterface, following t

2014-04-09 16:20:46 524

转载 What is the diff between a TreeMap vs. HashMap?

Thelargest difference between the two is the underlying structure used in theimplementation.HashMapsuse an array and a hashing function to store elements. When you try to insert ordelete an item in

2014-04-09 16:02:35 464

转载 A Strategy for Defining Immutable Objects

The following rules define a simple strategy for creating immutable objects. Not all classes documented as "immutable" follow these rules. This does not necessarily mean the creators of these classes

2014-04-09 11:33:53 310

转载 why string is immutable and why all wrapper class are immutable?

By default, all Java classes are mutable i.e contents of their instances can be modified. But there are few advantages that immutability offers (http://download.oracle.com/javase/tutorial/essential/

2014-04-09 11:23:52 471

转载 JPA Caching

JPA Level 1 cachingJPA has 2 levels of caching. The first level of caching is the persistence context. The JPA Entity Manager maintains a set of Managed Entities in the Persistence Context. 

2014-04-08 17:37:05 478

转载 Hibernate Examples

Caching is all about application performance optimization and it sits between your application and the database to avoid the number of database hits as many as possible to give a better performance fo

2014-04-08 16:47:02 524

转载 Hibernate Caching

Caching is all about application performance optimization and it sits between your application and the database to avoid the number of database hits as many as possible to give a better performance fo

2014-04-08 16:41:04 580

转载 What is the advantage of load() vs get() in Hibernate?

Use get() when you want to load an objectUse load() when you need to obtain a reference to the object without issuing extra SQL queries, for example, to create a relationship with another object:

2014-04-08 16:23:42 529

转载 JPA 2.0 Concurrency and locking

Optimistic ConcurrencyOptimistic locking lets concurrent transactions process simultaneously, but detects and prevent collisions, this works best for applications where most concurrent transaction

2014-04-03 18:50:07 973

转载 JPA 高级分析

1.JPA的实体生命周期:JPA的实体有以下4中生命周期状态:(1).New:瞬时对象,尚未有id,还未和Persistence Context建立关联的对象。(2).Managed:持久化受管对象,有id值,已经和Persistence Context建立了关联的对象。(3).Datached:游离态离线对象,有id值,但没有和Persistence Contex

2014-04-03 17:59:15 490

转载 Oracle Flashback 技术总结

写在前面:            2009年的时候结合网上的资料整理了下Flashback的用法。 2011年5月份起,把我这几年来的整理的资料又重新进行了一个整理,暂定为《David Dai Oracle 学习手册》, 等第一版整理完会免费上传到网络。 对Flashback 这块又重新整理了一下。  这个比之前的版本要完整很多,内容上也要更加严谨一些。            所以对这块先

2014-04-03 17:06:45 597

转载 JPA ID生成策略

数据的唯一性是很平常的要求,但是如果框架不能提供相关的控制而由程序员完全控制是很危险的,在JPA中,有下面四种策略。A.容器自动生成---GeneratorType.AUTO  由JPA自动生成B.使用数据库的自动增长字段生成---GenerationType.IDENTITY JPA 容器将使用数据库的自增长字段为新增加的实体对象赋唯一值。这种情况下需要数据库提供对自增长字段的支

2014-04-03 16:07:11 702

转载 RESTful Web services: The basics

The basicsDevelop skills on this topicThis content is part of a progressive knowledge path for advancing your skills. SeeBuild RESTful web services with Java technologyREST defines a

2014-04-03 14:40:01 697

转载 Understanding JVM Internals

Every developer who uses Java knows that Java bytecode runs in a JRE (Java Runtime Environment). The most important element of the JRE is Java Virtual Machine (JVM), which analyzes and executes Java b

2014-04-02 13:31:15 643

转载 JAVA RMI 远程方法调用简单实例

RMI的概念RMI(Remote Method Invocation)远程方法调用是一种计算机之间利用远程对象互相调用实现双方通讯的一种通讯机制。使用这种机制,某一台计算机上的对象可以调用另外一台计算机上的对象来获取远程数据。RMI是Enterprise JavaBeans的支柱,是建立分布式Java应用程序的方便途径。在过去,TCP/IP套接字通讯是远程通讯的主要手段,但此开发方式没有使用面

2014-04-01 17:48:21 457

转载 MaxClients in Apache and its effect on Tomcat during Full GC

This is the fourth article in the series of "Become a Java GC Expert". In the first issue Understanding Java Garbage Collection we have learned about the processes for different GC algorithms, about

2014-04-01 16:54:42 557

转载 How to Tune Java Garbage Collection

This is the third article in the series of "Become a Java GC Expert". In the first issue Understanding Java Garbage Collection we have learned about the processes for different GC algorithms, about

2014-04-01 16:18:58 587

HTTP1.1(English).pdf

HTTP1.1(English).pdf

2015-06-09

HTTP1.1 Protocol

Http1.1 Protocol介绍HTTP1.1的协议的介绍,值得一看。

2015-03-04

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除