`
songbin0201
  • 浏览: 319898 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
zookeeper's namespace 1、znode     Znodes maintain a stat structure that includes version numbers for data changes, ACL changes, and timestamps.( znode节点的数据结构)     The data stored at each znode in a namespace is read and written atomically.(读写的原子性)     ZooKeeper also has the notion of ephemeral node ...
git 的错误操作,导致丢失了重要的commit,真是痛不欲生; 最后通过git神器终于找回了丢失的commit,但是需要总结和反思的地方有一些,同时需要加深git的学习,特献上本文以供参考 执行git reset --hard HEAD~1 ,删除了commit3,但是 ...
编译过程可以参考 http://robey.github.com/kestrel/readme.html 参考kestrel官方的readme文档,一步步开始安装kestrel 一、依赖环境的安装 1、sbt wget http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.2/sbt-launch.jar mv sbt-launch.jar /usr/local/bin/ echo 'java -Xmx512M -jar `dirname $0` ...
public class TransObjectJava implements TransObject{ @Override public Person decoder(String objstr) { ObjectInputStream ois = null; try { ByteArrayInputStream bai = new ByteArrayInputStream(objstr.getBytes()); ois = new ObjectInputStream(bai); ...
OutputStream缓存方式写数据的包装器类,将多个字节写入缓存中,从缓存中写入输出流,减少IO访问次数 public BufferedOutputStream(OutputStream out) { this(out, 8192); /** 创建默认大小为8192的字节数组缓存 */ } public synchronized void write(int b) throws IOException { if (count >= buf.length) { flushBuffer(); /** 当写入缓存字节个数大于等于 ...
创建缓冲区,将要写入输出流的数据通过缓存的方式一次性写入 写入输出流的方法如下: void writeTo(OutputStream out) String toString() public ByteArrayOutputStream() { this(32); /** 创建一个默认长度为32字节数组 */ } public ByteArrayOutputStream(int size) { if (size < 0) { throw new IllegalArgumentExcept ...
将字节数组,作为输入流使用 一、主要方法及接口: public synchronized int read(); public void mark(int readAheadLimit); public synchronized void reset(); 二、源码解读: 使用方法类似 BufferedInputStream,也是通过mark和reset方法的使用,从mark位置开始缓存部分数据,有区别的是:read方法是直接从byte b[] 中读取,因此ByteArrayInputStream 的输入流就是字节数组,而 BufferedInputStream 的输入流可以是任 ...
一、主要方法及接口: public synchronized int read(); private void fill(); public synchronized void mark(int readlimit); public synchronized void reset(); 二、源码解读: 1)public synchronized int read() 重载了父类FilterInputStream的read方法,主要作用还是按照字节从输入流中读取数据,但是第一次调用该方法时,会调用顶级类InputStream中的read(byte b[], int off, int ...
今天听到同事在讨论java是哪种类型的语言(编译型、解释型),以前稍微有些接触,但是概念比较模糊,为了不至于让别人的思想左右自己,所以查了些资料,找到了很多热心网友给出的答案,终于有些明白。这里先给出编译型语言和解释型语言的定义。 定义:     编译型语言:把做好的源程序全部编译成二进制代码的可运行程序。然后,可直接运行这个程序。     解释型语言:把做好的源程序翻译一句,然后执行一句,直至结束! 区别:     编译型语言,执行速度快、效率高;依赖编译器、跨平台性差些。     解释型语言,执行速度慢、效率低;依赖解释器、跨平台性好。     个人认为,java是解释型的语言 ...
将java接口用作常量接口,凡是实现这个接口的java类自动继承这些常量。如果在实现类中定义了和接口中同名的常量,就会导致实现类中定义的常量被接口中常量覆盖       按照接口多态性的使用方式:       Interface instants = new Implements();       常量的定义按照声明类型的定义(方法的定义按照实现类型的定义),因此就会造成在实现了接口的java类中定义的常量被接口中的常量定义覆盖,带来无法预知的异常。
hibernate 提供了多种生成标志符的策略,一般这种标识符多会被用来作为数据表的主键。 比较常用的有:increment、sequence、identity、native、hilo 1、increment        适用于代理主键,由hibernate以递增的方式生成标识符,例如save(table_name),采用increment方式,hibernate在持久化table_name对象时,同时会采用select max(id) from table_name的方式得到标识符。        显而易见的好处:不依赖底层数据库的选择,并且有hibernate自动提供主键标识符的生成, ...
Tomcat可以设置URL 请求的编码格式,默认情况为不设置,内置编码格式为ISO-8859-1,这个字符集不能直接支持中文等双字节的信息 <Connector port="8080" maxHttpHeaderSize="8192"                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"                enableLookups="false" redire ...
spymemcached 项目地址:http://github.com/dustin/java-memcached-client asfmemcached(memcached-client-forjava) 项目地址:http://code.google.com/p/memcache-client-forjava/ xmemcached 项目地址:http://code.google.com/p/xmemcached/ memcached-java-client(whalin make it for meetup.com) 项目地址:http://github.com/gwhalin/M ...
系统环境: OS:Ubuntu 10.10 (2G) Servlet Container:tomcat-tomcat-7.0.23  (最大内存:default 256M  maxThreads:500) Web server: apache2.2 (maxClient:250) 设置apache最大连接数 在/usr/local/etc/apache22/httpd.conf中加载MPM配置(去掉前面的注释): # Server-pool management (MPM specific) Include etc/apache22/extra/httpd-mpm.conf 修改d ...
继上次的内存调优分析后(参考[url] http://dmouse.iteye.com/blog/1264118[/url]),gc导致服务器不稳定的情况依然存在,以下记录了后续的调优和分析过程 目前线上有较多的 "Unloading class sun.reflect.GeneratedSerializationConstructorAccessor"、“promotion failed”、“concurrent mode failure”的错误、 关于这三个错误产生的原因,可以参考如下文章 http://www.oracle.com/technetwork/java ...
Global site tag (gtag.js) - Google Analytics