丁树同的博客
丁树同 · 共 14 篇文章
[置顶] 1) eclipse 添加字体
* 假设在字体当中没有找到你想要的字体,那么点击“显示更多字体”,会显示系统所有字体,找到你要的字体右键选择显示。返回字体设置对话框,选择新添加的字体。
2014-01-25 15:51 · eclipse · 评论(0)
bat 脚本启动windows服务
@echo off title stop/start windows service :allStart cls echo [1] MySQL echo [2] Apache echo [3] Windows Update echo [4] Oracle echo [5] VMWare echo [e] exit set in= set /p in=please enter the num: if "%in%"=="1" goto mysql if "%in%"=="2" goto apache if "%in%"=="3" goto windowsUpdate if "%in%"=="4"…
2014-08-26 21:23 · 评论(0)
3)用zookeeper实现分布式锁
在我们的项目当中,可能有许多组件在并行的运行。这些组件可能需要更新我们的数据存储。所以这些组件应该有解决冲突的能力,避免脏数据。但是这些组件往往运行在不同的服务器上,甚至编程语言,文件系统结构都是不同的。这些差异给我们的分布式协作带来困难。 zookeeper给我们提供了解决方案。那么如何借助zookeeper来管理我们的分布式系统,达到系统之间的协作呢?我们可以通过zookeeper来实现分布式锁的概念,从而达到系统之间的协作目的。 public class DistributedLock { private final ZooKeeper zk; private final String…
2014-03-07 00:10 · ZooKeeper · 评论(0)
2)The structure of znode
1) the Stat structure of znode 在zookeeper的数据模型中,每个数据节点称为znode. 每个znode维护一个Stat structure.这个Stat structure 由下面几个属性构成: ·czxid 每一次对zookeeper znode做的更新都会对应唯一transactionID,这个id称为zxid.由于zxid是递增的,所以它实际上表示对zookeeper更新的一种顺序。例如zxid1 小于 zxid2 那么zxid1对应的操作在zxid2对应的操作之前发生。 Czxid表示znode创建时对应的zxid. ·mzxid 最近一次对zn…
2014-03-05 22:55 · ZooKeeper · 评论(0)
1)zookeeper数据模型
1.1 数据模型 Zookeeper 维护一个层级的命名空间。这个命名空间就像一个文件系统。如图1-1所示: 图1-1 zookeeper的数据模型 在每个节点上都可以有数据与该节点相关联。就像父节点下面可以有子节点。数据不应该太大,不应该大于1M数据。Zookeeper不是用来做数据存储的,操作大数据会影响性能,如果迫不得已要进行大数据的操作,建议只在znode里面存储数据的位置。 到每个节点的路径被表示成标准的,绝对的,以斜线分隔的路径。不存在相对路径,所以路径中存在 ”.”, ”..” 是不被允许的。 “zookeeper”作为保留字在路径中不被使用。
2014-03-05 22:51 · ZooKeeper · 评论(0)
zookeeper client on windows cannot connect to the server on the linux
异常: 2014-02-16 22:07:19,284 [myid:] - WARN [main-SendThread(192.168.177.128:2181):ClientCnxn$SendThread@1089] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection timed out: no further information at sun.nio.ch.Soc…
2014-02-16 22:12 · ZooKeeper · 评论(0)
mvn install failed when the project depends on the zookeeper
写道 [ERROR] Failed to execute goal on project zookeeper: Could not resolve dependencies for project com.zqz:zookeeper:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: javax.jms:jms:jar:1.1 , com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact jav…
2)Maven命令
1)创建maven项目 在命令行中,进入到项目所在的路径,比如:D:\MyProjects 运行如下命令: mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false groupId为包名,artifactId为项目名。 命令运行成功后会在当前目录下建立你的maven项目。 目录结构如下所示: The src/main/java directory contains …
2014-01-25 12:29 · Maven · 评论(0)
ActiveMQ 安装(1)
Pre-Installation Requirements Hardware: 33 MB of free disk space for the ActiveMQ 4.x binary distribution. 200 MB of free disk space for the ActiveMQ 4.x source or developer's distributions. Operating Systems: Windows: Windows XP SP2, Windows 2000, Windows Vista, Windows 7. Unix: Ubuntu Linux, Powe…
2014-01-13 23:41 · EMS · 评论(0)
1)Maven 安装
Maven其实就是一个java tool. 系统要求 JDK:JDK1.5或者1.5以上。 内存空间和磁盘空间没有限制。 操作系统,windows和linux都可以装 安装步骤: For Windows 1.解压缩 apache-maven-3.1.1-bin.zip 到你想安装maven到哪个目录里面,假设你选择了C:\Program Files\Apache,解压缩后会生成一个子目录--apache-maven-3.1.1。 2.设置系统环境变量M2_HOME,变量值为C:\Program Files\Apache Software Foundation\apache-maven-3.1…
JMS Message
1)recap The Message interface is the root interface of all JMS messages. It defines the message header and the acknowledge method used for all messages. Most message-oriented middleware (MOM) products treat messages as lightweight entities that consist of a header and a payload. The header contains…
2014-01-10 00:16 · EMS · 评论(0)
JMS结构
JMS结构模型 1.ConnectionFactory A ConnectionFactory object encapsulates a set of connection configuration parameters that has been defined by an administrator. A client uses it to create a connection with a JMS provider. A ConnectionFactory object is a JMS administered object and supports concurrent us…
2014-01-08 22:32 · EMS · 评论(0)
Using MessageConverter
In order to facilitate the sending of domain model objects, the JmsTemplate has various send methods that take a Java object as an argument for a message's data content. The overloaded methods convertAndSend and receiveAndConvert in JmsTemplate delegate the conversion process to an instance of the …
Send Message by Spring JMS
The JmsTemplate contains many convenience methods to send a message. There are send methods that specify the destination using a javax.jms.Destination object and those that specify the destination using a string for use in a JNDI lookup. The send method that takes no destination argument uses the d…